/** * Beam Shield — E2E Encryption (S5) * X25519 Key Agreement + ChaCha20-Poly1305 AEAD * * Flow: * 1. Sender generates ephemeral X25519 keypair * 2. ECDH(ephemeral.private, recipient.dhPublicKey) → sharedSecret * 3. HKDF(sharedSecret) → encryptionKey * 4. ChaCha20-Poly1305(key, nonce, payload) → ciphertext * 5. Send: { encrypted: true, ephemeralPublicKey, ciphertext, nonce } */ export interface X25519KeyPair { publicKey: string; privateKey: string; } export interface EncryptedPayload { encrypted: true; ephemeralPublicKey: string; ciphertext: string; nonce: string; algorithm: 'chacha20-poly1305'; } /** Generate a new X25519 keypair for E2E encryption */ export declare function generateX25519KeyPair(): X25519KeyPair; /** Encrypt a payload for a recipient with their X25519 DH public key */ export declare function encryptPayload(payload: Record, recipientDhPublicKeyBase64: string): EncryptedPayload; /** Decrypt a payload using own X25519 DH private key */ export declare function decryptPayload(encryptedPayload: EncryptedPayload, myDhPrivateKeyBase64: string): Record; /** Check if a payload is encrypted */ export declare function isEncryptedPayload(payload: unknown): payload is EncryptedPayload;