We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7a55edb commit 7a4cd0bCopy full SHA for 7a4cd0b
routes/users.js
@@ -15,7 +15,7 @@ const db = [
15
];
16
17
function encrypt(text) {
18
- const cipher = crypto.createCipheriv(algorithm, secret, iv);
+ const cipher = crypto.createCipheriv(algorithm, secret.slice(0, 32), iv);
19
20
const encrypted = Buffer.concat([cipher.update(text), cipher.final()]);
21
@@ -28,7 +28,7 @@ function encrypt(text) {
28
function decrypt(hash) {
29
const decipher = crypto.createDecipheriv(
30
algorithm,
31
- secret,
+ secret.slice(0, 32),
32
Buffer.from(hash.iv, "hex")
33
);
34
0 commit comments