Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
node.dialProtocol(targetPeerInfo, PROTOCOL_DELIVER_PUBKEY, (err, conn) => waterfall([
(cb) => pull(
conn,
lp.decode({
maxLength: MARSHALLED_PUBLIC_KEY_SIZE
}),
pull.take(1),
pull.drain((data) => cb(null, data))
),
(pubKey, cb) => PeerId.createFromPubKey(pubKey, cb),
(peerId, cb) => {
const peerInfo = new PeerInfo(peerId)
peerInfo.multiaddrs.replace([], targetPeerInfo.multiaddrs.toArray())
cb(null, peerInfo)
}
], cb))
}
module.exports = function (name, callback, self) {
var nameErrors = Utils.validateJSONWithSchema(name, "string", stringSchema);
if ( nameErrors )
return callback(new InvalidPayloadError("Must be a string", nameErrors));
async.waterfall(
[
function (next) { self.requestsManager.verifyCredentials(next); },
function (next) { self.requestsManager.channel(name, next); }
],
callback
);
};
function notifyPlatform(deviceTokens, notification, callback, self) {
async.waterfall(
[
function (next) { self.requestsManager.verifyCredentials(next); },
function (next) { self.requestsManager.notify(deviceTokens, notification, next); }
],
callback
);
}
module.exports = (self) => (to, cb) => {
let restoreTx
waterfall([
(cb) => self.node.peerRouting.findPeer(to, cb),
(peerInfo, cb) => self.node.dialProtocol(peerInfo, PROTOCOL_PAYMENT_CHANNEL, cb),
(conn, cb) => {
restoreTx = new Transaction()
restoreTx.nonce = randomBytes(Transaction.NONCE_LENGTH)
restoreTx.value = (new BN(toWei('1', 'shannon'))).toBuffer('be', Transaction.VALUE_LENGTH)
restoreTx.index = numberToBuffer(1, Transaction.INDEX_LENGTH)
restoreTx.sign(self.node.peerInfo.id)
pull(
pull.once(restoreTx.toBuffer()),
lp.encode(),
conn,
lp.decode(),
function queryNode(peerId, cb) {
waterfall([
(cb) => node.peerRouting.findPeer(PeerId.createFromB58String(peerId), cb),
(peerInfo, cb) => node.dialProtocol(peerInfo, PROTOCOL_CRAWLING, cb),
(conn, cb) => pull(
conn,
lp.decode({
maxLength: MARSHALLED_PUBLIC_KEY_SIZE
}),
pull.asyncMap((pubKey, cb) => PeerId.createFromPubKey(pubKey, cb)),
pull.filter(peerId => {
if (peerId.isEqual(node.peerInfo.id))
return false
const found = node.peerBook.has(peerId.toB58String())
node.peerBook.put(new PeerInfo(peerId))
return !found
function benchNeoAsync (done) {
neoAsync.waterfall(toCall, done)
}
module.exports = function (deviceTokens, channels, callback, self) {
var deviceTokensErrors = Utils.validateJSONWithSchema(deviceTokens, "device_tokens", deviceTokensSchema);
if ( deviceTokensErrors )
return callback(new InvalidPayloadError("Device tokens must be an array with at least one item or unique items of type string", deviceTokensErrors));
debug("Device tokens: " + JSON.stringify(deviceTokens));
async.waterfall(
[
function (next) { self.requestsManager.verifyCredentials(next); },
function (next) {
if ( typeof channels === "function" )
registerDeviceTokens(deviceTokens, next, self);
else
registerDeviceTokensForChannels(deviceTokens, channels, next, self);
}
],
callback
);
};
function broadcastDevices(notification, callback, self) {
var notificationErrors = Utils.validateJSONWithSchema(notification, "notification", notificationSchema);
if ( notificationErrors )
return callback(new InvalidPayloadError("Unknown notification object type. Must be a valid iOS/MacOS, Safari or Android notification object", notificationErrors));
debug("Notification object: " + JSON.stringify(notification));
async.waterfall(
[
function (next) { self.requestsManager.verifyCredentials(next); },
function (next) { self.requestsManager.broadcast(null, notification, next); }
],
callback
);
}
'neo-async': function(callback) {
neo_async.waterfall(tasks, callback);
}
};
var options = {
from: input,
to: output
};
Object.keys(commonOptions).forEach(function(opt) {
options[opt] = commonOptions[opt];
});
processor
.process(css, options)
.then(function(result) { fn(null, result); })
.catch(fn);
}
async.waterfall([
async.apply(fs.readFile, input),
doProcess,
async.apply(dumpWarnings),
async.apply(writeResult, output)
], fn);
}