diff --git a/src/common/crypto-enc.ts b/src/common/crypto-enc.ts index 7c96018..8f63f55 100644 --- a/src/common/crypto-enc.ts +++ b/src/common/crypto-enc.ts @@ -61,7 +61,7 @@ export function importCipher(ensureKeys: () => CryptoKey | Promise): const encrKey = await fetchKey(); const iv = crypto.getRandomValues(new Uint8Array(12)); const encoded = new TextEncoder().encode(data); - const encrypted = await crypto.subtle.encrypt({ name: "AES-GCM", iv }, encrKey, encoded); + const encrypted = await crypto.subtle.encrypt({ ...encrAlgo, iv }, encrKey, encoded); // Combine IV + encrypted data (which includes auth tag) const combined = new Uint8Array(iv.length + encrypted.byteLength); @@ -79,7 +79,7 @@ export function importCipher(ensureKeys: () => CryptoKey | Promise): const iv = combined.slice(0, 12); const encrypted = combined.slice(12); const decrypted = await crypto.subtle.decrypt( - { name: "AES-GCM", iv }, + { ...encrAlgo, iv }, encrKey, encrypted, );