Skip to content

Commit

Permalink
🛠️Fix: Error on lower versions of Node.js
Browse files Browse the repository at this point in the history
Fixes #3
  • Loading branch information
arnav-kr committed Oct 15, 2022
1 parent 8524be7 commit 560545e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/decode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export function decode(
let payloads: string = payload + '.' + timestamp;

try {
let hmacsha256: Hmac = createHmac('sha-256', scryptSync(secret, "", 32));
let hmacsha256: Hmac = createHmac('sha256', scryptSync(secret, "", 32));
hmacsha256.update(splited.slice(0, 2).join("."));
authedSignature = hmacsha256.digest("base64url")
}
Expand Down
2 changes: 1 addition & 1 deletion src/sign.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export function sign(
let payloads: string =
Buffer.from(payload, "utf-8").toString("base64url") + '.' + customTimestamp.create(timestamp);

let signature: Hmac = createHmac('sha-256', scryptSync(secret, "", 32));
let signature: Hmac = createHmac('sha256', scryptSync(secret, "", 32));
signature.update(payloads);
let token: string = payloads + '.' + signature.digest("base64url");

Expand Down

0 comments on commit 560545e

Please sign in to comment.