Align backend plan with codebase
This commit is contained in:
1 parent
fe54390849
commit
c8e930552b
36 files changed
+2216
-2
No files matched your search
@@ -0,0 +1,17 @@
|
||||
import { createHash, randomBytes } from "crypto";
|
||||
|
||||
export function sha256Hex(input: string): string {
|
||||
return createHash("sha256").update(input, "utf8").digest("hex");
|
||||
}
|
||||
|
||||
export function hashOtpCode(code: string, pepper: string): string {
|
||||
return sha256Hex(`${pepper}:otp:${code}`);
|
||||
}
|
||||
|
||||
export function hashSessionToken(token: string, pepper: string): string {
|
||||
return sha256Hex(`${pepper}:session:${token}`);
|
||||
}
|
||||
|
||||
export function newSessionToken(): string {
|
||||
return randomBytes(32).toString("base64url");
|
||||
}
|
||||
Reference in new issue
Block a user