MCPcopy Create free account
hub / github.com/PIKACHUIM/CFWorkerACME / randomString

Function randomString

frontend/src/utils/crypto.ts:65–72  ·  view source on GitHub ↗
(len = 32)

Source from the content-addressed store, hash-verified

63 * 生成随机字符串(用作 API Token 等)
64 */
65export function randomString(len = 32): string {
66 const arr = new Uint8Array(len);
67 crypto.getRandomValues(arr);
68 return Array.from(arr)
69 .map((b) => b.toString(16).padStart(2, '0'))
70 .join('')
71 .slice(0, len);
72}
73
74/**
75 * 生成 ECC P-256 私钥并编码为 PKCS8 PEM 格式

Callers 1

handleGenerateTokenFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected