10 lines
243 B
JavaScript
10 lines
243 B
JavaScript
import crypto from 'node:crypto'
|
|
|
|
export function randomToken(bytes = 24) {
|
|
return crypto.randomBytes(bytes).toString('hex')
|
|
}
|
|
|
|
export function randomId(prefix, bytes = 6) {
|
|
return `${prefix}${crypto.randomBytes(bytes).toString('hex')}`
|
|
}
|