diff --git a/src/lib/sessionCrypto.ts b/src/lib/sessionCrypto.ts index 83898b9..91baa69 100644 --- a/src/lib/sessionCrypto.ts +++ b/src/lib/sessionCrypto.ts @@ -88,7 +88,7 @@ export async function encryptJsonToBlob(data: T): Promise { const ciphertext = await window.crypto.subtle.encrypt( { name: KEY_ALGORITHM, - iv: iv as Uint8Array, + iv: new Uint8Array(iv), }, sessionKey, plaintext, @@ -121,10 +121,10 @@ export async function decryptBlobToJson(blob: EncryptedBlob): Promise { const decrypted = await window.crypto.subtle.decrypt( { name: KEY_ALGORITHM, - iv: iv, + iv: new Uint8Array(iv), }, sessionKey, - ciphertext, + new Uint8Array(ciphertext), ); const jsonString = new TextDecoder().decode(decrypted);