forked from boos/BoosAPI
Merge pull request #204 from Shinku-Chen/rand-sk-2
生成密钥的时候,能随机生成,同时能复制token
This commit is contained in:
@@ -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}`;
|
||||
}
|
||||
Reference in New Issue
Block a user