export declare function encrypt(data: unknown, key: Uint8Array): Promise<{ n: string; c: string; z?: boolean; }>; export declare function decrypt(encrypted: { n: string; c: string; z?: boolean; }, key: Uint8Array): Promise; export declare function isEncrypted(msg: unknown): msg is { n: string; c: string; z?: boolean; }; export declare function decodeKey(encodedKey: string): Uint8Array; export declare function parseMessage(data: string, sessionKey: Uint8Array | null): Promise | null>; export declare function encryptAndSend(ws: { send: (data: string) => void; readyState: number; }, msg: unknown, sessionKey: Uint8Array | null): Promise; export declare function encryptAndSendConfirmed(ws: { send: (data: string, callback: (error?: Error) => void) => void; readyState: number; }, msg: unknown, sessionKey: Uint8Array | null): Promise; export interface E2EEnvelope { e2e: true; n: string; c: string; z?: boolean; } /** * E2E-encrypt data with the shared e2eKey. * Wraps the existing encrypt() output with an `e2e: true` flag. */ export declare function e2eEncrypt(data: unknown, e2eKey: Uint8Array): Promise; /** * E2E-decrypt an E2E envelope. Returns null on failure. */ export declare function e2eDecrypt(msg: { n: string; c: string; z?: boolean; }, e2eKey: Uint8Array): Promise; /** * Check if a message is an E2E-encrypted envelope (has e2e: true + n + c). */ export declare function isE2EEncrypted(msg: unknown): msg is E2EEnvelope;