/**
 * React Native Runtime Support for xBind
 *
 * Provides compatibility layer for React Native environments:
 * - Polyfills for missing Node.js APIs
 * - AsyncStorage adapter for persistence
 * - Native crypto module integration
 * - Cross-platform crypto primitives
 *
 * @module runtime/react-native
 */
import type { Result } from '@private.me/shared';
/**
 * React Native AsyncStorage interface
 */
export interface AsyncStorage {
    getItem(key: string): Promise<string | null>;
    setItem(key: string, value: string): Promise<void>;
    removeItem(key: string): Promise<void>;
    getAllKeys(): Promise<string[]>;
    multiGet(keys: string[]): Promise<Array<[string, string | null]>>;
    multiSet(keyValuePairs: Array<[string, string]>): Promise<void>;
    multiRemove(keys: string[]): Promise<void>;
}
/**
 * React Native crypto capabilities
 */
export interface ReactNativeCrypto {
    getRandomValues(array: Uint8Array): void;
    subtle?: {
        digest(algorithm: string, data: BufferSource): Promise<ArrayBuffer>;
        encrypt(algorithm: AlgorithmIdentifier, key: CryptoKey, data: BufferSource): Promise<ArrayBuffer>;
        decrypt(algorithm: AlgorithmIdentifier, key: CryptoKey, data: BufferSource): Promise<ArrayBuffer>;
        sign(algorithm: AlgorithmIdentifier, key: CryptoKey, data: BufferSource): Promise<ArrayBuffer>;
        verify(algorithm: AlgorithmIdentifier, key: CryptoKey, signature: BufferSource, data: BufferSource): Promise<boolean>;
        generateKey(algorithm: AlgorithmIdentifier, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKey | CryptoKeyPair>;
        importKey(format: KeyFormat, keyData: BufferSource | JsonWebKey, algorithm: AlgorithmIdentifier, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKey>;
        exportKey(format: KeyFormat, key: CryptoKey): Promise<ArrayBuffer | JsonWebKey>;
    };
}
/**
 * React Native runtime configuration
 */
export interface ReactNativeConfig {
    /**
     * AsyncStorage instance (required for persistence)
     */
    storage: AsyncStorage;
    /**
     * Crypto implementation (defaults to global.crypto or react-native-quick-crypto)
     */
    crypto?: ReactNativeCrypto;
    /**
     * Storage key prefix (prevents collisions)
     */
    storagePrefix?: string;
    /**
     * Enable debug logging
     */
    debug?: boolean;
}
/**
 * AsyncStorage adapter for xBind persistence
 *
 * Provides cross-platform storage for:
 * - Agent identities (Ed25519/X25519 keys)
 * - Nonce store (replay protection)
 * - Trust registry cache
 * - Connection metadata
 */
export declare class AsyncStorageAdapter {
    private readonly storage;
    private readonly prefix;
    private readonly debug;
    constructor(config: ReactNativeConfig);
    /**
     * Get value by key
     */
    get(key: string): Promise<Result<string | null, Error>>;
    /**
     * Set key-value pair
     */
    set(key: string, value: string): Promise<Result<void, Error>>;
    /**
     * Remove key
     */
    remove(key: string): Promise<Result<void, Error>>;
    /**
     * Get all keys with prefix
     */
    keys(): Promise<Result<string[], Error>>;
    /**
     * Get multiple keys (batch operation)
     */
    multiGet(keys: string[]): Promise<Result<Array<[string, string | null]>, Error>>;
    /**
     * Set multiple key-value pairs (batch operation)
     */
    multiSet(pairs: Array<[string, string]>): Promise<Result<void, Error>>;
    /**
     * Clear all xBind data
     */
    clear(): Promise<Result<void, Error>>;
}
/**
 * Detect available crypto implementation
 */
export declare function detectCrypto(): ReactNativeCrypto | null;
/**
 * Get random bytes (cross-platform)
 */
export declare function getRandomBytes(length: number, crypto?: ReactNativeCrypto): Uint8Array;
/**
 * SHA-256 hash (cross-platform)
 */
export declare function sha256(data: Uint8Array, crypto?: ReactNativeCrypto): Promise<Uint8Array>;
/**
 * Buffer polyfill for React Native
 *
 * Uses global Buffer if available, otherwise provides minimal implementation
 */
export declare class BufferPolyfill {
    static isBuffer(obj: unknown): boolean;
    static from(data: string | Uint8Array | number[], encoding?: string): Uint8Array;
    static toString(buffer: Uint8Array, encoding?: string): string;
    static concat(buffers: Uint8Array[]): Uint8Array;
    static alloc(size: number, fill?: number): Uint8Array;
    private static fromBase64;
    private static toBase64;
    private static fromHex;
    private static toHex;
}
/**
 * Detect React Native runtime
 */
export declare function isReactNative(): boolean;
/**
 * Detect platform (iOS/Android)
 */
export declare function detectPlatform(): 'ios' | 'android' | 'unknown';
/**
 * Initialize React Native runtime environment
 *
 * Sets up polyfills and validates required dependencies
 */
export declare function initializeReactNative(config: ReactNativeConfig): Result<void, Error>;
declare const _default: {
    AsyncStorageAdapter: typeof AsyncStorageAdapter;
    detectCrypto: typeof detectCrypto;
    getRandomBytes: typeof getRandomBytes;
    sha256: typeof sha256;
    BufferPolyfill: typeof BufferPolyfill;
    isReactNative: typeof isReactNative;
    detectPlatform: typeof detectPlatform;
    initializeReactNative: typeof initializeReactNative;
};
export default _default;
