From bbae4cfea75bf54fe8602c5b6cee6710f3122d93 Mon Sep 17 00:00:00 2001 From: Jonathan Raphaelson Date: Wed, 11 Jun 2025 00:49:16 -0600 Subject: [PATCH] use the shared consts --- src/common/crypto-enc.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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, ); -- 2.51.2