mirror of
https://github.com/fluencelabs/js-libp2p-secio
synced 2025-03-15 01:40:51 +00:00
refactor: clean up callbacks to avoid naming collision
This commit is contained in:
parent
edc4eb5b7a
commit
b6e1baa8ca
@ -188,8 +188,8 @@ exports.generateKeys = (state, callback) => {
|
||||
log('2.3. mac + cipher')
|
||||
|
||||
parallel([
|
||||
(cb) => support.makeMacAndCipher(state.protocols.local, cb),
|
||||
(cb) => support.makeMacAndCipher(state.protocols.remote, cb)
|
||||
(_cb) => support.makeMacAndCipher(state.protocols.local, _cb),
|
||||
(_cb) => support.makeMacAndCipher(state.protocols.remote, _cb)
|
||||
], cb)
|
||||
}
|
||||
], callback)
|
||||
|
@ -11,7 +11,7 @@ log.error = debug('libp2p:secio:error')
|
||||
|
||||
// step 2. Exchange
|
||||
// -- exchange (signed) ephemeral keys. verify signatures.
|
||||
module.exports = function exchange (state, cb) {
|
||||
module.exports = function exchange (state, callback) {
|
||||
log('2. exchange - start')
|
||||
|
||||
log('2. exchange - writing exchange')
|
||||
@ -27,9 +27,9 @@ module.exports = function exchange (state, cb) {
|
||||
},
|
||||
(cb) => crypto.generateKeys(state, cb)
|
||||
], (err) => {
|
||||
if (err) { return cb(err) }
|
||||
if (err) { return callback(err) }
|
||||
|
||||
log('2. exchange - finish')
|
||||
cb()
|
||||
callback()
|
||||
})
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ const crypto = require('./crypto')
|
||||
|
||||
// step 3. Finish
|
||||
// -- send expected message to verify encryption works (send local nonce)
|
||||
module.exports = function finish (state, cb) {
|
||||
module.exports = function finish (state, callback) {
|
||||
log('3. finish - start')
|
||||
|
||||
const proto = state.protocols
|
||||
@ -40,7 +40,7 @@ module.exports = function finish (state, cb) {
|
||||
sink (read) {
|
||||
}
|
||||
})
|
||||
cb(err)
|
||||
callback(err)
|
||||
}
|
||||
|
||||
if (err) return fail(err)
|
||||
@ -55,6 +55,6 @@ module.exports = function finish (state, cb) {
|
||||
|
||||
// Awesome that's all folks.
|
||||
state.secure.resolve(shake.handshake.rest())
|
||||
cb()
|
||||
callback()
|
||||
})
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ log.error = debug('libp2p:secio:error')
|
||||
|
||||
// step 1. Propose
|
||||
// -- propose cipher suite + send pubkeys + nonce
|
||||
module.exports = function propose (state, cb) {
|
||||
module.exports = function propose (state, callback) {
|
||||
log('1. propose - start')
|
||||
|
||||
log('1. propose - writing proposal')
|
||||
@ -26,10 +26,10 @@ module.exports = function propose (state, cb) {
|
||||
(cb) => crypto.selectProtocols(state, cb)
|
||||
], (err) => {
|
||||
if (err) {
|
||||
return cb(err)
|
||||
return callback(err)
|
||||
}
|
||||
|
||||
log('1. propose - finish')
|
||||
cb()
|
||||
callback()
|
||||
})
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user