|
|
|
@ -1,8 +1,9 @@
|
|
|
|
|
define([
|
|
|
|
|
'/common/common-util.js',
|
|
|
|
|
'/common/common-interface.js',
|
|
|
|
|
'/bower_components/chainpad-crypto/crypto.js',
|
|
|
|
|
'/bower_components/tweetnacl/nacl-fast.min.js'
|
|
|
|
|
], function (Util, Crypto) {
|
|
|
|
|
], function (Util, UI, Crypto) {
|
|
|
|
|
var Nacl = window.nacl;
|
|
|
|
|
|
|
|
|
|
var Hash = {};
|
|
|
|
@ -176,14 +177,14 @@ Version 1
|
|
|
|
|
secret.keys = Crypto.createEditCryptor(parsed.key);
|
|
|
|
|
secret.key = secret.keys.editKeyStr;
|
|
|
|
|
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");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (parsed.mode === 'view') {
|
|
|
|
|
secret.keys = Crypto.createViewCryptor(parsed.key);
|
|
|
|
|
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");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|