fix(storage-manager): correctly use encryption key in decrypt call
This commit is contained in:
parent
001614522e
commit
9e9726e173
@ -300,7 +300,7 @@ export class StorageManager {
|
||||
_getFromStorage(storage, location, options=this._options) {
|
||||
const encryption = options.encryption && (options.encryption.all || options.encryption[location]);
|
||||
if (encryption && storage.encryption) {
|
||||
return { ...storage, ...JSON.parse(decrypt(storage.encryption.ciphertext, encryption.key) || '{}') };
|
||||
return { ...storage, ...JSON.parse(decrypt(storage.encryption.ciphertext, this._encryptionKey[location]) || '{}') };
|
||||
} else {
|
||||
return storage;
|
||||
}
|
||||
@ -365,7 +365,7 @@ function encrypt(plaintext, key) {
|
||||
|
||||
sodium.crypto_secretbox_easy(cipherB, plaintextB, nonceB, keyB);
|
||||
|
||||
return cipherB.toString('base64');
|
||||
return cipherB;
|
||||
}
|
||||
|
||||
// TODO debug unnecessary calls of decrypt
|
||||
|
||||
Loading…
Reference in New Issue
Block a user