Skip to content

Commit 50cea71

Browse files
author
lucifer
committed
fix: hex
1 parent f8ccf4c commit 50cea71

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

routes/users.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const secret = process.env.secret;
66

77
const clientId = "c16b80e7b58a5a007157";
88
const algorithm = "aes-256-ctr";
9-
const iv = crypto.randomBytes(16).toString("hex");
9+
const iv = crypto.randomBytes(16);
1010

1111
const db = [
1212
{
@@ -26,7 +26,7 @@ function decrypt(content) {
2626
const decipher = crypto.createDecipheriv(
2727
algorithm,
2828
secret.slice(0, 32),
29-
Buffer.from(iv, "hex")
29+
Buffer.from(iv.toString("hex"), "hex")
3030
);
3131

3232
const decrpyted = Buffer.concat([

0 commit comments

Comments
 (0)