and move everything around just to annoy Zere

This commit is contained in:
Jiiks 2018-08-11 04:33:00 +03:00
parent ed4adf21f4
commit 60cdec3ae4
1 changed files with 9 additions and 9 deletions

View File

@ -17,15 +17,6 @@ export default class Security {
return `${prefix}${aes256.encrypt(key, content)}`;
}
static deepDecrypt(keys, content, prefix = '') {
let decrypt = null;
for (const key of keys.reverse()) {
if (decrypt === null) decrypt = this.decrypt(key, content, prefix);
else decrypt = this.decrypt(key, decrypt, prefix);
}
return decrypt;
}
static decrypt(key, content, prefix = '') {
if (key instanceof Array) return this.deepDecrypt(key, content, prefix);
return aes256.decrypt(key, content.replace(prefix, ''));
@ -40,4 +31,13 @@ export default class Security {
return encrypt;
}
static deepDecrypt(keys, content, prefix = '') {
let decrypt = null;
for (const key of keys.reverse()) {
if (decrypt === null) decrypt = this.decrypt(key, content, prefix);
else decrypt = this.decrypt(key, decrypt, prefix);
}
return decrypt;
}
}