14 lines
388 B
TypeScript
14 lines
388 B
TypeScript
import { randomBytes } from "node:crypto";
|
|
|
|
export function createPublicId(prefix: string): string {
|
|
return `${prefix}_${randomBytes(16).toString("base64url")}`;
|
|
}
|
|
|
|
export function createClientSecret(): string {
|
|
return `fps_${randomBytes(32).toString("base64url")}`;
|
|
}
|
|
|
|
export function previewSecret(secret: string): string {
|
|
return `${secret.slice(0, 7)}...${secret.slice(-6)}`;
|
|
}
|