Fix exception in options.js on first run

Fixes #22 Uncaught ReferenceError: getRandomBytes is not defined
options.js:41
This commit is contained in:
lilia 2014-05-11 14:44:32 -07:00
commit 1d95fcc027
3 changed files with 5 additions and 4 deletions

View file

@ -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); }