chore: 重构项目结构
This commit is contained in:
8
cwd-api/src/utils/crypto.ts
Normal file
8
cwd-api/src/utils/crypto.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
export async function hashKey(key: string): Promise<string> {
|
||||
const encoder = new TextEncoder();
|
||||
const data = encoder.encode(key);
|
||||
const hash = await crypto.subtle.digest('SHA-256', data);
|
||||
return Array.from(new Uint8Array(hash))
|
||||
.map((b) => b.toString(16).padStart(2, '0'))
|
||||
.join('');
|
||||
}
|
||||
Reference in New Issue
Block a user