From e1a398206cd838eab19a7159f37e4d9aaf5c31bf Mon Sep 17 00:00:00 2001 From: Friedel Ziegelmayer Date: Sun, 22 Jan 2017 17:04:12 +0100 Subject: [PATCH 1/2] chore(deps): update to latest --- package.json | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index f3fa4c9..722cec3 100644 --- a/package.json +++ b/package.json @@ -25,26 +25,26 @@ "author": "Friedel Ziegelmayer ", "license": "MIT", "dependencies": { - "async": "^2.1.2", - "debug": "^2.3.2", + "async": "^2.1.4", + "debug": "^2.6.0", "interface-connection": "^0.3.0", - "libp2p-crypto": "^0.7.2", + "libp2p-crypto": "^0.7.6", "multihashing-async": "^0.3.0", - "peer-id": "^0.8.0", - "protocol-buffers": "^3.1.8", + "peer-id": "^0.8.1", + "protocol-buffers": "^3.2.1", "pull-defer": "^0.2.2", "pull-handshake": "^1.1.4", "pull-length-prefixed": "^1.2.0", "pull-stream": "^3.5.0" }, "devDependencies": { - "aegir": "^9.2.1", - "benchmark": "^2.1.2", + "aegir": "^9.3.3", + "benchmark": "^2.1.3", "chai": "^3.5.0", "gulp": "^3.9.1", "libp2p-websockets": "^0.9.1", - "multistream-select": "^0.13.0", - "pre-commit": "^1.2.0", + "multistream-select": "^0.13.2", + "pre-commit": "^1.2.2", "pull-goodbye": "0.0.1", "pull-pair": "^1.1.0" }, From 73d0b41249013dae46153c7d79739103940865ce Mon Sep 17 00:00:00 2001 From: Friedel Ziegelmayer Date: Sun, 22 Jan 2017 17:08:15 +0100 Subject: [PATCH 2/2] 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,