declare const PROTOCOL_VERSION = "rtm-ecdh-v1"; declare const HANDSHAKE_CLIENT_OK = "rtm-handshake-ok"; declare const HANDSHAKE_SERVER_OK = "rtm-handshake-server-ok"; export declare const HANDSHAKE_EVENTS: { readonly INIT: "key_exchange_init"; readonly RESPONSE: "key_exchange_response"; readonly COMPLETE: "key_exchange_complete"; readonly ACK: "key_exchange_ack"; readonly ERROR: "key_exchange_error"; }; export interface EncryptedEnvelope { encrypted: true; seq: number; iv: string; ciphertext: string; tag: string; } export interface DirectionalKeys { k_c2s: CryptoKey; k_s2c: CryptoKey; } declare function encodeBase64(buffer: ArrayBuffer | Uint8Array): string; declare function decodeBase64(value: string): Uint8Array; export declare function isEncryptedEnvelope(data: unknown): data is EncryptedEnvelope; export declare function generateEphemeralKeyPair(): Promise; export declare function exportUncompressedPublicKey(publicKey: CryptoKey): Promise; export declare function importUncompressedPublicKey(bytes: Uint8Array): Promise; export declare function computeSharedSecret(privateKey: CryptoKey, peerPublicKey: CryptoKey): Promise; export declare function deriveDirectionalKeys(sharedSecret: Uint8Array, c2sNonce: Uint8Array, s2cNonce: Uint8Array): Promise; export declare function buildSignaturePayload(clientPublicKey: Uint8Array, serverPublicKey: Uint8Array, c2sNonce: Uint8Array, s2cNonce: Uint8Array, sessionId: string): Uint8Array; export declare function importSigningPublicKey(pem: string): Promise; export declare function verifyHandshakeSignature(signatureB64: string, clientPublicKey: Uint8Array, serverPublicKey: Uint8Array, c2sNonce: Uint8Array, s2cNonce: Uint8Array, sessionId: string, signingPublicKey: CryptoKey): Promise; export declare function encrypt(key: CryptoKey, plaintext: string, seq: number): Promise; export declare function decrypt(key: CryptoKey, envelope: EncryptedEnvelope, seq: number): Promise; export declare function encryptPayload(key: CryptoKey, payload: unknown, seq: number): Promise; export declare function decryptPayload(key: CryptoKey, envelope: EncryptedEnvelope, seq: number): Promise; export declare function randomNonce4(): Uint8Array; export { PROTOCOL_VERSION, HANDSHAKE_CLIENT_OK, HANDSHAKE_SERVER_OK, encodeBase64, decodeBase64, };