mirror of
https://github.com/chrononeko/chronocat.git
synced 2024-11-16 21:00:22 +00:00
feat(shell): add token utils
This commit is contained in:
parent
f59c581d58
commit
c53fe624c9
9
packages/shell/src/utils/token.ts
Normal file
9
packages/shell/src/utils/token.ts
Normal 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
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user