/** * 패킷 암호화 키를 유도합니다. * - HMAC 모드 (`hmacSecret` 유효 시): HKDF-SHA256(hmac_secret, "entity-server:packet-encryption") * - JWT 모드: HKDF-SHA256(jwt_token, "entity-server:packet-encryption") */ export declare function derivePacketKey(hmacSecret: string, token: string): Uint8Array; /** * 평문 바이트를 XChaCha20-Poly1305로 암호화합니다. * 포맷: [random_magic:K][random_nonce:24][ciphertext+tag] * K = 2 + key[31] % 14 (패킷 키에서 자동 파생) */ export declare function encryptPacket(plaintext: Uint8Array, key: Uint8Array): Uint8Array; /** * XChaCha20-Poly1305 패킷을 복호화해 JSON 객체로 변환합니다. * 포맷: [magic:K][nonce:24][ciphertext+tag] * K = 2 + key[31] % 14 (패킷 키에서 자동 파생) */ export declare function decryptPacket(buffer: ArrayBuffer, key: Uint8Array): T; /** * 요청 바디를 파싱합니다. `application/octet-stream`이면 복호화, 그 외는 JSON 파싱합니다. * * @param requireEncrypted `true`이면 암호화된 요청만 허용합니다. */ export declare function parseRequestBody(body: ArrayBuffer | Uint8Array | string | T | null | undefined, contentType: string, requireEncrypted: boolean, key: Uint8Array): T;