Fix: System-wide type hardening and V3 API alignment

This commit is contained in:
Scott Idem
2026-01-22 19:22:16 -05:00
parent 9de1d4b23e
commit 4976f2d897
11 changed files with 87 additions and 56 deletions

View File

@@ -15,9 +15,9 @@ export const encrypt_content = async function encrypt_content(content: string, k
'encrypt'
]);
const encodedContent = await crypto.subtle.encrypt(
{ name: 'AES-CBC', iv },
{ name: 'AES-CBC', iv: iv.buffer as ArrayBuffer },
key,
new TextEncoder().encode(content)
new TextEncoder().encode(content).buffer as ArrayBuffer
);
const base64 = btoa(String.fromCharCode(...new Uint8Array(encodedContent)));
if (log_lvl) {
@@ -79,9 +79,9 @@ export const decrypt_content = async function decrypt_content(
]);
const encryptedContent = Uint8Array.from(atob(base64Content), (c) => c.charCodeAt(0));
const decryptedContent = await crypto.subtle.decrypt(
{ name: 'AES-CBC', iv },
{ name: 'AES-CBC', iv: iv.buffer as ArrayBuffer },
key,
encryptedContent
encryptedContent.buffer as ArrayBuffer
);
const decodedContent = new TextDecoder().decode(decryptedContent);
// console.log('Decrypted Content:', decodedContent);