Commit 36de09c97bf4ab11665bc129f764c5612bed702e
randombytes mutates arg, ignore return value
Dominic Tarr committed on 9/4/2016, 7:05:53 AMParent: d07c56db9283161c98f4bf5fc8dec7649b1ea137
Files changed
sodium.js | changed |
sodium.js | ||
---|---|---|
@@ -5,9 +5,10 @@ | ||
5 | 5 | |
6 | 6 | curves: ['ed25519'], |
7 | 7 | |
8 | 8 | generate: function (seed) { |
9 | - seed = seed || sodium.randombytes(seed = new Buffer(32)) | |
9 | + if(!seed) sodium.randombytes(seed = new Buffer(32)) | |
10 | + | |
10 | 11 | var keys = seed ? sodium.crypto_sign_seed_keypair(seed) : sodium.crypto_sign_keypair() |
11 | 12 | return { |
12 | 13 | curve: 'ed25519', |
13 | 14 | public: keys.publicKey, |
@@ -29,4 +30,6 @@ | ||
29 | 30 | } |
30 | 31 | |
31 | 32 | |
32 | 33 | |
34 | + | |
35 | + |
Built with git-ssb-web