fix decrypt/encrypt wording in error message

This commit is contained in:
Bruno Windels 2020-11-11 13:17:05 +01:00
parent 8b16d8bc99
commit f23312b0d3

View file

@ -217,7 +217,7 @@ class AESCrypto {
['encrypt'], ['encrypt'],
), "importKey"); ), "importKey");
} catch (err) { } catch (err) {
throw new Error(`Could not import key for AES-CTR decryption: ${err.message}`); throw new Error(`Could not import key for AES-CTR encryption: ${err.message}`);
} }
try { try {
const ciphertext = await subtleCryptoResult(this._subtleCrypto.encrypt( const ciphertext = await subtleCryptoResult(this._subtleCrypto.encrypt(
@ -228,7 +228,7 @@ class AESCrypto {
), "encrypt"); ), "encrypt");
return new Uint8Array(ciphertext); return new Uint8Array(ciphertext);
} catch (err) { } catch (err) {
throw new Error(`Could not decrypt with AES-CTR: ${err.message}`); throw new Error(`Could not encrypt with AES-CTR: ${err.message}`);
} }
} }