/** * E2E Encryption Module * * AES-256-GCM 대칭 암호화를 사용하여 메모리 content/embedding 보호 * Node.js 내장 crypto 모듈만 사용 (외부 의존성 없음) */ export interface EncryptedPayload { ciphertext: string; iv: string; tag: string; } export interface EncryptionConfig { enabled: boolean; algorithm: 'aes-256-gcm'; } export interface KeyDerivationResult { key: Buffer; salt: Buffer; } /** * 랜덤 암호화 키 생성 (32 bytes) */ export declare function generateEncryptionKey(): Buffer; /** * PBKDF2로 사용자 비밀번호에서 키 유도 * @param password - 사용자 입력 비밀번호 * @param salt - 선택적 salt (재현성 필요 시 제공) * @returns 키와 salt */ export declare function deriveKey(password: string, salt?: Buffer): KeyDerivationResult; /** * 텍스트 암호화 (AES-256-GCM) * @param plaintext - 원본 텍스트 * @param key - 32 bytes 암호화 키 * @returns 암호화된 페이로드 */ export declare function encryptContent(plaintext: string, key: Buffer): EncryptedPayload; /** * 텍스트 복호화 (AES-256-GCM) * @param encrypted - 암호화된 페이로드 * @param key - 32 bytes 암호화 키 * @returns 원본 텍스트 * @throws 키가 잘못되었거나 데이터가 변조된 경우 */ export declare function decryptContent(encrypted: EncryptedPayload, key: Buffer): string; /** * 임베딩 벡터 암호화 * @param embedding - number[] 벡터 * @param key - 32 bytes 암호화 키 * @returns base64 암호화된 문자열 */ export declare function encryptEmbedding(embedding: number[], key: Buffer): string; /** * 임베딩 벡터 복호화 * @param encrypted - base64 암호화된 문자열 * @param key - 32 bytes 암호화 키 * @returns number[] 벡터 */ export declare function decryptEmbedding(encrypted: string, key: Buffer): number[]; /** * EncryptedPayload 검증 */ export declare function isValidEncryptedPayload(obj: unknown): obj is EncryptedPayload; /** * 암호화된 컨텐츠를 JSON으로 래핑 */ export declare function wrapEncryptedContent(encrypted: EncryptedPayload): string; /** * JSON에서 암호화된 컨텐츠 추출 */ export declare function unwrapEncryptedContent(wrapped: string): EncryptedPayload | null; //# sourceMappingURL=encryption.d.ts.map