Skip to content

Commit

Permalink
fix: stored iv at prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhilverma360 committed Apr 29, 2024
1 parent 98da4c7 commit 2d4c08c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib/crypto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const encrypt = (data: string): string => {
const cipher = crypto.createCipheriv("aes-256-cbc", secretKey, iv);
let encryptedData = cipher.update(data, "utf-8", "hex");
encryptedData += cipher.final("hex");
return encryptedData;
return `${iv.toString("hex")}:${encryptedData}`;
};

// TODO: decrypt function

0 comments on commit 2d4c08c

Please sign in to comment.