feat(shell): add token utils

This commit is contained in:
Il Harper 2024-03-04 00:41:54 +08:00
parent f59c581d58
commit c53fe624c9
No known key found for this signature in database
GPG Key ID: 4B71FCA698E7E8EC

View File

@ -0,0 +1,9 @@
import { randomBytes } from 'node:crypto'
export const generateToken = () => randomBytes(32).toString('hex')
export const generateToken16 = () => randomBytes(16).toString('hex')
export const buildEventIdCounter = () => {
let i = 0
return () => ++i
}