Fix Hash.alert not a function

This commit is contained in:
yflory 2017-05-15 14:21:15 +02:00
parent 0e58859393
commit 8172f117a7

View File

@ -1,8 +1,9 @@
define([ define([
'/common/common-util.js', '/common/common-util.js',
'/common/common-interface.js',
'/bower_components/chainpad-crypto/crypto.js', '/bower_components/chainpad-crypto/crypto.js',
'/bower_components/tweetnacl/nacl-fast.min.js' '/bower_components/tweetnacl/nacl-fast.min.js'
], function (Util, Crypto) { ], function (Util, UI, Crypto) {
var Nacl = window.nacl; var Nacl = window.nacl;
var Hash = {}; var Hash = {};
@ -176,14 +177,14 @@ Version 1
secret.keys = Crypto.createEditCryptor(parsed.key); secret.keys = Crypto.createEditCryptor(parsed.key);
secret.key = secret.keys.editKeyStr; secret.key = secret.keys.editKeyStr;
if (secret.channel.length !== 32 || secret.key.length !== 24) { if (secret.channel.length !== 32 || secret.key.length !== 24) {
Hash.alert("The channel key and/or the encryption key is invalid"); UI.alert("The channel key and/or the encryption key is invalid");
throw new Error("The channel key and/or the encryption key is invalid"); throw new Error("The channel key and/or the encryption key is invalid");
} }
} }
else if (parsed.mode === 'view') { else if (parsed.mode === 'view') {
secret.keys = Crypto.createViewCryptor(parsed.key); secret.keys = Crypto.createViewCryptor(parsed.key);
if (secret.channel.length !== 32) { if (secret.channel.length !== 32) {
Hash.alert("The channel key is invalid"); UI.alert("The channel key is invalid");
throw new Error("The channel key is invalid"); throw new Error("The channel key is invalid");
} }
} }