Skip to content

Commit

Permalink
fix: b64 encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
Vexcited committed Nov 5, 2024
1 parent ac61d64 commit 4d84c6a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/api/private/otp.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { base64urlnopad } from "@scure/base";
import { base64url, base64 } from "@scure/base";
import { packBigEndian } from "~/core/pack";
import { hashWithHMAC } from "~/core/hmac";

export const otp = (seed: string, counter: number): string => {
const packedCounter = packBigEndian(counter);
return base64urlnopad.encode(hashWithHMAC(packedCounter, base64urlnopad.decode(seed)));
return base64url.encode(hashWithHMAC(packedCounter, base64.decode(seed)));
};

0 comments on commit 4d84c6a

Please sign in to comment.