Merge pull request #44 from libp2p/fix/random

fix: update deps and usageof crypto.randomBytes
This commit is contained in:
Friedel Ziegelmayer 2017-01-22 17:13:36 +01:00 committed by GitHub
commit 5fe67a834c
3 changed files with 10 additions and 14 deletions

View File

@ -25,26 +25,26 @@
"author": "Friedel Ziegelmayer <dignifiedquire@gmail.com>",
"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"
},

View File

@ -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(','),

View File

@ -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,