Clean old code

This commit is contained in:
yflory
2017-11-09 18:17:49 +01:00
parent be848c1bec
commit 354c63bd64
21 changed files with 134 additions and 2988 deletions

View File

@@ -1,9 +1,8 @@
define([
'/common/common-util.js',
'/common/common-interface.js',
'/bower_components/chainpad-crypto/crypto.js',
'/bower_components/tweetnacl/nacl-fast.min.js'
], function (Util, UI, Crypto) {
], function (Util, Crypto) {
var Nacl = window.nacl;
var Hash = {};
@@ -211,14 +210,12 @@ Version 1
secret.keys = Crypto.createEditCryptor(parsed.key);
secret.key = secret.keys.editKeyStr;
if (secret.channel.length !== 32 || secret.key.length !== 24) {
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) {
UI.alert("The channel key is invalid");
throw new Error("The channel key is invalid");
}
}