Skip to content

Commit

Permalink
fix: decrypting fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
ImJustChew committed Jun 18, 2024
1 parent eca20a7 commit ee14951
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/lib/headless_ais.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,12 @@ export const decrypt = async (encryptedPassword: string) => {

// Extract the IV from the first part of the Base64 string
const ivBase64 = encryptedPassword.slice(0, 24); // First 24 characters are the Base64 encoded IV
const iv = new Uint8Array(atob(ivBase64).split('').map(char => char.charCodeAt(0)));
const iv = Uint8Array.from(atob(ivBase64).split('').map(char => char.charCodeAt(0)));

// Extract the encrypted data
const encryptedData = encryptedPassword.slice(24);
const encryptedArrayBuffer = new Uint8Array(atob(encryptedData).split('').map(char => char.charCodeAt(0))).buffer;
const encryptedArrayBuffer = Uint8Array.from(atob(encryptedData).split('').map(char => char.charCodeAt(0)));


// Decrypt the data
const decryptedBuffer = await crypto.subtle.decrypt(
Expand Down

0 comments on commit ee14951

Please sign in to comment.