Fix exception in options.js on first run
Fixes #22 Uncaught ReferenceError: getRandomBytes is not defined options.js:41
This commit is contained in:
parent
3b79dd256c
commit
1d95fcc027
3 changed files with 5 additions and 4 deletions
|
@ -2,7 +2,7 @@
|
|||
var crypto_tests = {};
|
||||
|
||||
window.crypto = (function() {
|
||||
function getRandomBytes(size) {
|
||||
crypto.getRandomBytes = function(size) {
|
||||
//TODO: Better random (https://www.grc.com/r&d/js.htm?)
|
||||
try {
|
||||
var buffer = new ArrayBuffer(size);
|
||||
|
@ -60,7 +60,7 @@ window.crypto = (function() {
|
|||
var privToPub = function(privKey, isIdentity) { return crypto_tests.privToPub(privKey, isIdentity); }
|
||||
|
||||
crypto_tests.createNewKeyPair = function(isIdentity) {
|
||||
return privToPub(getRandomBytes(32), isIdentity);
|
||||
return privToPub(crypto.getRandomBytes(32), isIdentity);
|
||||
}
|
||||
var createNewKeyPair = function(isIdentity) { return crypto_tests.createNewKeyPair(isIdentity); }
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue