mirror of
https://github.com/fluencelabs/js-libp2p-secio
synced 2025-03-15 09:50:55 +00:00
fix: update to the new crypto.randomBytes method
This commit is contained in:
parent
e1a398206c
commit
73d0b41249
@ -18,7 +18,7 @@ const nonceSize = 16
|
||||
|
||||
exports.createProposal = (state) => {
|
||||
state.proposal.out = {
|
||||
rand: support.randomBytes(nonceSize),
|
||||
rand: crypto.randomBytes(nonceSize),
|
||||
pubkey: state.key.local.public.bytes,
|
||||
exchanges: support.exchanges.join(','),
|
||||
ciphers: support.ciphers.join(','),
|
||||
|
@ -76,10 +76,6 @@ function makeCipher (cipherType, iv, key, callback) {
|
||||
callback(new Error(`unrecognized cipher type: ${cipherType}`))
|
||||
}
|
||||
|
||||
exports.randomBytes = (nonceSize) => {
|
||||
return Buffer.from(crypto.webcrypto.getRandomValues(new Uint8Array(nonceSize)))
|
||||
}
|
||||
|
||||
exports.selectBest = (local, remote, cb) => {
|
||||
exports.digest(Buffer.concat([
|
||||
remote.pubKeyBytes,
|
||||
|
Loading…
x
Reference in New Issue
Block a user