Who wants to call them directly anyways

This commit is contained in:
Jiiks 2018-08-11 04:31:13 +03:00
parent be1a183e62
commit a8f0e239cf
1 changed files with 2 additions and 0 deletions

View File

@ -13,6 +13,7 @@ import aes256 from 'aes256';
export default class Security {
static encrypt(key, content, prefix = '') {
if (key instanceof Array) return this.deepDecrypt(key, content, prefix);
return `${prefix}${aes256.encrypt(key, content)}`;
}
@ -26,6 +27,7 @@ export default class Security {
}
static decrypt(key, content, prefix = '') {
if (key instanceof Array) return this.deepDecrypt(key, content, prefix);
return aes256.decrypt(key, content.replace(prefix, ''));
}