about summary refs log tree commit diff
path: root/bskylink/src/util.ts
blob: 0b57dd5c5bfdf9a2b7672ee3694836bec3f66db1 (plain) (blame)
1
2
3
4
5
6
7
8
import {randomBytes} from 'node:crypto'

import {toString} from 'uint8arrays'

// 40bit random id of 5-7 characters
export const randomId = () => {
  return toString(randomBytes(5), 'base58btc')
}