Skip to content

Commit ff325a4

Browse files
author
DylanBulmer
committed
fix decrypt bug
1 parent dd92cc1 commit ff325a4

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@codrjs/core",
3-
"version": "1.0.4",
3+
"version": "1.0.4-patch1",
44
"description": "An open-sourced customizable annotation tool",
55
"main": "index.js",
66
"repository": "git@github.com:CodrJS/Core.git",

src/services/auth.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,16 @@ class Authentication {
4646
let secretKey = md5(process.env.SECRET as string);
4747
secretKey = Buffer.concat([secretKey, secretKey.subarray(0, 8)]);
4848
const decipher = crypto.createDecipheriv("des-ede3", secretKey, "");
49-
let decrypted = decipher.update(text, "utf8", "hex");
49+
let decrypted = decipher.update(text, "hex");
50+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
51+
// @ts-ignore
5052
decrypted += decipher.final();
51-
return decrypted;
53+
return decrypted as unknown as string;
54+
}
55+
56+
generateCode(payload: Record<string, any>) {
57+
const data = JSON.stringify(payload);
58+
return this.encrypt(data);
5259
}
5360

5461
async signinWithEmail(
@@ -91,7 +98,7 @@ class Authentication {
9198
),
9299
});
93100

94-
// send email with magic link
101+
// send email with access code/token
95102
const link =
96103
process.env["DOMAIN"] +
97104
"/auth/email/verify?token=" +

0 commit comments

Comments
 (0)