From 73d0b41249013dae46153c7d79739103940865ce Mon Sep 17 00:00:00 2001 From: Friedel Ziegelmayer Date: Sun, 22 Jan 2017 17:08:15 +0100 Subject: [PATCH] fix: update to the new crypto.randomBytes method --- src/handshake/crypto.js | 2 +- src/support.js | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/handshake/crypto.js b/src/handshake/crypto.js index 09dc488..8d5a768 100644 --- a/src/handshake/crypto.js +++ b/src/handshake/crypto.js @@ -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(','), diff --git a/src/support.js b/src/support.js index 71eba0e..55d317f 100644 --- a/src/support.js +++ b/src/support.js @@ -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,