mirror of
https://github.com/hanzoai/dataroom.git
synced 2026-10-30 18:41:07 +00:00
15 lines
279 B
TypeScript
15 lines
279 B
TypeScript
import { createHash } from "crypto";
|
|
|
|
export const hashToken = (
|
|
token: string,
|
|
{
|
|
noSecret = false,
|
|
}: {
|
|
noSecret?: boolean;
|
|
} = {},
|
|
) => {
|
|
return createHash("sha256")
|
|
.update(`${token}${noSecret ? "" : process.env.NEXTAUTH_SECRET}`)
|
|
.digest("hex");
|
|
};
|