/**
 * XorIDA split-channel bridge for @private.me/xbind.
 *
 * Bridges @private.me/crypto threshold sharing with the agent-sdk
 * TransportEnvelope format. Splits plaintext into n shares with HMAC
 * integrity, each share wrapped in its own envelope for independent routing.
 *
 * Pipeline:
 *   split:  pad -> HMAC -> XorIDA split -> share Uint8Arrays with metadata
 *   reconstruct: collect k shares -> XorIDA reconstruct -> HMAC verify -> unpad
 */
import type { Result } from '@private.me/shared';
/** Configuration for split-channel delivery. */
export interface SplitChannelConfig {
    /** Total number of shares to produce. Default: 3. */
    readonly totalShares: number;
    /** Minimum shares needed for reconstruction. Default: 2. */
    readonly threshold: number;
}
/** Serialized share with metadata for transport. */
export interface ChannelShare {
    /** Base64-encoded share data. */
    readonly data: string;
    /** Share index (0-based). */
    readonly index: number;
    /** Total shares produced. */
    readonly total: number;
    /** Threshold for reconstruction. */
    readonly threshold: number;
    /** UUID linking all shares of this message. */
    readonly groupId: string;
    /** Base64-encoded HMAC key (needed for verification on reconstruct). */
    readonly hmacKey: string;
    /** Base64-encoded HMAC signature over the padded plaintext. */
    readonly hmacSig: string;
}
/** Error codes for split-channel operations. Sub-codes give context. */
export type SplitChannelError = 'SPLIT_FAILED' | 'SPLIT_FAILED:INVALID_PARAMS' | 'SPLIT_FAILED:RECONSTRUCT' | 'SPLIT_FAILED:CRYPTO_NOT_LOADED' | 'INSUFFICIENT_SHARES' | 'INCONSISTENT_SHARES' | 'HMAC_VERIFICATION_FAILED' | 'UNPAD_FAILED' | 'INVALID_SHARE_DATA' | 'INVALID_SHARE_DATA:BASE64' | 'INVALID_SHARE_DATA:HMAC_DECODE';
/** Default split-channel configuration: 3 shares, threshold 2. */
export declare const DEFAULT_SPLIT_CONFIG: SplitChannelConfig;
/**
 * Split plaintext into n shares via XorIDA with HMAC integrity.
 *
 * Pipeline: pad(PKCS#7) -> HMAC(padded) -> XorIDA split -> ChannelShare[]
 *
 * Information-theoretic security: Any k shares can reconstruct the plaintext,
 * but k-1 shares reveal ZERO information (proven secure).
 *
 * @param plaintext - Raw plaintext bytes to split
 * @param config - Split configuration (totalShares, threshold)
 * @returns Array of n ChannelShare objects ready for envelope wrapping
 *
 * @example
 * ```typescript
 * import { splitForChannel, DEFAULT_SPLIT_CONFIG } from '@private.me/xbind';
 *
 * const plaintext = new TextEncoder().encode('Sensitive data');
 *
 * // Default: 3 shares, need 2 to reconstruct
 * const shares = await splitForChannel(plaintext);
 * if (!shares.ok) throw new Error(shares.error);
 *
 * console.log('Created shares:', shares.value.length);
 * // Send each share through different channels (email, SMS, push)
 * shares.value.forEach((share, i) => {
 *   console.log(`Share ${i}: ${share.groupId}`);
 * });
 *
 * // Custom configuration: 5 shares, need 3
 * const customShares = await splitForChannel(plaintext, {
 *   totalShares: 5,
 *   threshold: 3
 * });
 * ```
 */
export declare function splitForChannel(plaintext: Uint8Array, config?: SplitChannelConfig): Promise<Result<ChannelShare[], SplitChannelError>>;
/**
 * Split plaintext with a specific groupId (for testability).
 *
 * @param plaintext - Raw plaintext bytes
 * @param config - Split configuration
 * @param groupId - UUID to use for the share group
 * @returns Array of ChannelShare objects
 */
export declare function splitForChannelWithGroupId(plaintext: Uint8Array, config: SplitChannelConfig, groupId: string): Promise<Result<ChannelShare[], SplitChannelError>>;
/**
 * Reconstruct plaintext from k-of-n shares.
 *
 * Pipeline: validate -> XorIDA reconstruct -> HMAC verify -> unpad -> plaintext
 * HMAC verification happens BEFORE the data is trusted.
 *
 * @param shares - Array of at least k ChannelShare objects (must have same groupId)
 * @returns Reconstructed plaintext bytes
 *
 * @example
 * ```typescript
 * import { reconstructFromChannel, type ChannelShare } from '@private.me/xbind';
 *
 * // Collect shares from different channels
 * const receivedShares: ChannelShare[] = [
 *   emailShare,   // Received via email
 *   smsShare,     // Received via SMS
 *   // Only need 2 shares (threshold = 2)
 * ];
 *
 * // Reconstruct original message
 * const plaintext = await reconstructFromChannel(receivedShares);
 * if (!plaintext.ok) {
 *   console.error('Reconstruction failed:', plaintext.error);
 *   return;
 * }
 *
 * const message = new TextDecoder().decode(plaintext.value);
 * console.log('Reconstructed message:', message);
 * ```
 */
export declare function reconstructFromChannel(shares: readonly ChannelShare[]): Promise<Result<Uint8Array, SplitChannelError>>;
