Merge pull request #204 from Shinku-Chen/rand-sk-2

生成密钥的时候,能随机生成,同时能复制token
This commit is contained in:
Shinku
2026-03-20 16:17:51 +08:00
committed by GitHub
parent 5e872b331e
commit e2595bcab3
3 changed files with 179 additions and 30 deletions
@@ -0,0 +1,6 @@
export function generateDownstreamSkKey(prefix: string): string {
const bytes = new Uint8Array(32);
crypto.getRandomValues(bytes);
const hex = Array.from(bytes, (b) => b.toString(16).padStart(2, '0')).join('');
return `${prefix}${hex}`;
}