feat: render relay description content

This commit is contained in:
codytseng 2026-01-19 22:07:53 +08:00
parent 0d6f8789d0
commit ee90ae99c1
3 changed files with 9 additions and 4 deletions

View file

@ -1,9 +1,11 @@
const SEED = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
const HEX_SEED = 'abcdef0123456789'
export function randomString(len = 32) {
export function randomString(len = 32, { hex } = { hex: false }) {
let str = ''
const seed = hex ? HEX_SEED : SEED
for (let i = 0; i < len; i++) {
str += SEED[Math.floor(Math.random() * SEED.length)]
str += seed[Math.floor(Math.random() * SEED.length)]
}
return str
}