Fix: System-wide type hardening and V3 API alignment
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user