/** * @bunkor/crypto - Bunkor Integration Client * * Utilities for uploading/downloading encrypted files to Bunkor */ import { EncryptionAlgorithm } from '../encryption.service'; import { BunkorConfig } from '../config'; /** * File upload response from Bunkor */ export interface BunkorUploadResponse { fileId: string; fileName: string; size: number; checksum: string; encryptionAlgorithm: EncryptionAlgorithm; salt: string; iv: string; uploadedAt: string; expiresAt?: string; } /** * File download metadata from Bunkor */ export interface BunkorFileMetadata { fileId: string; fileName: string; size: number; encryptionAlgorithm: EncryptionAlgorithm; salt: string; iv: string; createdAt: string; updatedAt: string; ownerId: string; isShared: boolean; } /** * Bunkor Client - Handle encrypted file operations with Bunkor */ export declare class BunkorClient { private config; private encryptionService; private cryptoService; constructor(config: BunkorConfig); /** * Upload and encrypt a file to Bunkor * * @param file File to upload * @param password Encryption password * @param algorithm Encryption algorithm (default: AES-256-GCM) * @param fileName Optional custom file name * @returns Upload response with file ID and encryption metadata * * @example * ```typescript * const client = new BunkorClient({ * apiUrl: 'https://api.bunkor.io', * apiToken: 'sk_live_...', * }); * * const response = await client.uploadEncrypted( * file, * 'secure-password', * 'AES-256-GCM', * 'my-document.pdf' * ); * * console.log(response.fileId); // Store this for later download * ``` */ uploadEncrypted(file: File | Blob, password: string, algorithm?: EncryptionAlgorithm, fileName?: string): Promise; /** * Download and decrypt a file from Bunkor * * @param fileId File ID from Bunkor * @param password Decryption password * @param onProgress Optional progress callback (0-100) * @returns Decrypted file blob * * @example * ```typescript * const decrypted = await client.downloadDecrypted( * 'file_abc123', * 'secure-password', * (progress) => console.log(`Downloaded: ${progress}%`) * ); * * // Download to user's device * const url = URL.createObjectURL(decrypted); * const a = document.createElement('a'); * a.href = url; * a.download = 'document.pdf'; * a.click(); * ``` */ downloadDecrypted(fileId: string, password: string, onProgress?: (progress: number) => void): Promise; /** * Get file metadata from Bunkor (encryption details, size, etc.) */ getFileMetadata(fileId: string): Promise; /** * Delete a file from Bunkor */ deleteFile(fileId: string): Promise; /** * List all files in the organization */ listFiles(options?: { limit?: number; offset?: number; }): Promise; /** * Share a file with another user */ shareFile(fileId: string, email: string, expiresIn?: number): Promise<{ shareId: string; shareUrl: string; }>; /** * Get audit log for a file */ getAuditLog(fileId: string): Promise>; /** * Check Bunkor API health/connectivity */ healthCheck(): Promise; /** * Internal: Generate IV for encryption algorithm */ private generateIv; /** * Internal: Calculate SHA-256 checksum of file */ private calculateChecksum; /** * Internal: Make authenticated request to Bunkor API */ private fetchBunkor; } //# sourceMappingURL=bunkor-client.d.ts.map