mirror of
https://github.com/hanzo-apps/dataroom.git
synced 2026-10-30 14:47:36 +00:00
14 lines
370 B
TypeScript
14 lines
370 B
TypeScript
import crypto from "crypto";
|
|
|
|
export function generateChecksum(url: string): string {
|
|
// Use a secure secret key stored in environment variables
|
|
const secret = process.env.NEXT_PRIVATE_VERIFICATION_SECRET!;
|
|
|
|
// Create HMAC using SHA-256
|
|
const hmac = crypto.createHmac("sha256", secret);
|
|
hmac.update(url);
|
|
|
|
// Return hex digest
|
|
return hmac.digest("hex");
|
|
}
|