mirror of
https://github.com/fluencelabs/js-libp2p-secio
synced 2025-03-16 02:10:52 +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) => {
|
exports.createProposal = (state) => {
|
||||||
state.proposal.out = {
|
state.proposal.out = {
|
||||||
rand: support.randomBytes(nonceSize),
|
rand: crypto.randomBytes(nonceSize),
|
||||||
pubkey: state.key.local.public.bytes,
|
pubkey: state.key.local.public.bytes,
|
||||||
exchanges: support.exchanges.join(','),
|
exchanges: support.exchanges.join(','),
|
||||||
ciphers: support.ciphers.join(','),
|
ciphers: support.ciphers.join(','),
|
||||||
|
@ -76,10 +76,6 @@ function makeCipher (cipherType, iv, key, callback) {
|
|||||||
callback(new Error(`unrecognized cipher type: ${cipherType}`))
|
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.selectBest = (local, remote, cb) => {
|
||||||
exports.digest(Buffer.concat([
|
exports.digest(Buffer.concat([
|
||||||
remote.pubKeyBytes,
|
remote.pubKeyBytes,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user