/**
 * @module xchange
 * XorIDA-based key transport for split-channel messaging.
 *
 * Replaces KEM with a random AES-256-GCM key bundled with ciphertext,
 * then split via XorIDA. Each channel carries a share of the bundle —
 * no lattice assumptions, unconditionally secure.
 *
 * Bundle format: [rawKey(32B) || IV(12B) || ciphertext]
 */
import type { Result } from '@private.me/shared';
import type { ProgressCallback } from '@private.me/ux-helpers';
/** Generated Xchange key material. */
export interface XchangeKey {
    /** AES-256-GCM CryptoKey for encryption/decryption. */
    readonly cryptoKey: CryptoKey;
    /** Raw 32-byte key material for bundling. */
    readonly rawKey: Uint8Array;
}
/** Xchange error codes. */
export type XchangeError = 'XCHANGE_KEYGEN_FAILED' | 'XCHANGE_ENCRYPT_FAILED' | 'XCHANGE_DECRYPT_FAILED' | 'INVALID_BUNDLE' | 'INVALID_BUNDLE:TOO_SHORT';
/** AES-256 key length in bytes. */
export declare const AES_KEY_BYTES = 32;
/** AES-GCM IV length in bytes. */
export declare const AES_IV_BYTES = 12;
/** Bundle header size: key + IV. */
export declare const BUNDLE_HEADER_BYTES: number;
/**
 * Generate a random AES-256-GCM key for Xchange transport.
 *
 * @param options - Optional progress callback
 * @returns XchangeKey with both CryptoKey and raw bytes, or error.
 */
export declare function generateXchangeKey(options?: {
    readonly onProgress?: ProgressCallback;
}): Promise<Result<XchangeKey, XchangeError>>;
/**
 * Encrypt plaintext and bundle key + IV + ciphertext.
 *
 * The bundle is then split via XorIDA — each share carries part of the
 * key, so no single channel reveals the plaintext or the key.
 *
 * @param plaintext - Data to encrypt.
 * @param key - XchangeKey from generateXchangeKey().
 * @param options - Optional progress callback
 * @returns Bundle bytes [rawKey(32) || IV(12) || ciphertext].
 */
export declare function xchangeEncrypt(plaintext: Uint8Array, key: XchangeKey, options?: {
    readonly onProgress?: ProgressCallback;
}): Promise<Result<Uint8Array, XchangeError>>;
/**
 * Extract key + IV from bundle and decrypt ciphertext.
 *
 * @param bundle - Reconstructed bundle [rawKey(32) || IV(12) || ciphertext].
 * @param options - Optional progress callback
 * @returns Decrypted plaintext bytes.
 */
export declare function xchangeDecrypt(bundle: Uint8Array, options?: {
    readonly onProgress?: ProgressCallback;
}): Promise<Result<Uint8Array, XchangeError>>;
