monorepo 버전 준비

## @strpc
기존 RPC를 package화

### @strpc/express
express의 middleware + router 결함

## @sammo
게임 전체
- server, client
- gateway_server, gateway_client
This commit is contained in:
2023-09-23 16:29:18 +00:00
parent 734e0cb7bf
commit e59f9a9659
197 changed files with 15458 additions and 3 deletions
+48
View File
@@ -0,0 +1,48 @@
const subtle = globalThis.crypto.subtle;
export type ValidEncAlg = 'AES256-GCM' | 'AES128-GCM' | 'AES256-CBC' | 'AES128-CBC';
const encAlgMap: Record<ValidEncAlg, AesDerivedKeyParams> = {
'AES256-GCM': {
name: 'AES-GCM',
length: 256,
},
'AES128-GCM' : {
name: 'AES-GCM',
length: 128,
},
'AES256-CBC' : {
name: 'AES-CBC',
length: 256,
},
'AES128-CBC' : {
name: 'AES-CBC',
length: 128,
},
}
export async function PBKDF2_SHA512(password: string, salt: BufferSource, alg: ValidEncAlg = 'AES256-GCM', iterations = 600000): Promise<CryptoKey> {
const param: Pbkdf2Params = {
name: 'PBKDF2',
hash: 'SHA-512',
salt: salt,
iterations,
};
const encoder = new TextEncoder();
const baseKey = await subtle.importKey(
"raw",
encoder.encode(password),
{ name: "PBKDF2" },
false,
["deriveBits", "deriveKey"]
);
return await subtle.deriveKey(
param,
baseKey,
encAlgMap[alg],
true,
["encrypt", "decrypt"]
);
}