10 lines
273 B
TypeScript
10 lines
273 B
TypeScript
import { createHash, randomBytes } from 'node:crypto';
|
|
|
|
export function generateDeviceToken(): string {
|
|
return randomBytes(48).toString('base64url');
|
|
}
|
|
|
|
export function hashDeviceToken(token: string): string {
|
|
return createHash('sha256').update(token).digest('hex');
|
|
}
|