/**
 * KeyVault Interface
 *
 * Defines the contract for all crypto operations that touch private keys.
 * Two implementations: IframeKeyVault (cross-origin iframe isolation) and
 * LocalKeyVault (in-process WASM, for dev/testing).
 *
 * The parent page never sees raw keys — only signatures, ciphertexts,
 * commitments, and public key material cross the boundary.
 */
import type { KeySource } from '../core/types';
import type { ShieldRawProgress, UnshieldRawProgress } from '../types/eth';
export type KeyStatus = 'none' | 'locked' | 'ready';
export interface DeriveKeysResult {
    mpk: string;
    privacyAddress: string;
}
export interface PublicKeys {
    mpk: string;
    privacyAddress: string;
    viewingPublicKey: {
        x: string;
        y: string;
    };
    nullifyingPublicKey: {
        x: string;
        y: string;
    };
    accountId: string;
    accountSalt: string;
    authPkX: string;
    authPkY: string;
}
export interface BuildShieldCommitmentParams {
    tokenId: number;
    amount: string;
    recipientMpk?: string;
}
export interface ShieldCommitmentResult {
    commitment: string;
    randomIn: string;
    npk: string;
}
export interface EncryptDepositCiphertextParams {
    teePublicKey: string;
    tokenId: number;
    amount: string;
    randomIn: string;
    outputIndex: number;
}
export interface DepositCiphertextResult {
    viewingKey: string;
    teeWrapKey: string;
    receiverWrapKey: string;
    ct0: string;
    ct1: string;
    ct2: string;
}
export interface NullifierInput {
    treeNumber: number;
    leafIndex: number;
}
export interface DeriveEcdhKeysParams {
    teePublicKey: string;
    recipientViewingPubKey?: string;
}
export interface EcdhKeysResult {
    viewingKey: string;
    teeWrapKey: string;
    receiverWrapKey: string;
    blindingScalar: string;
    ephTxEncKey: string;
}
export interface EncryptTransferCiphertextParams {
    ecdhKeys: EcdhKeysResult;
    recipientViewingPubKey: string;
    outputIndex: number;
    senderMpk: string;
    recipientMpk: string;
    tokenId: number;
    amount: string;
    randomIn: string;
}
export interface TransferCiphertextResult {
    ct0: string;
    ct1: string;
    ct2: string;
    ct3: string;
}
export interface SpendingSignatureResult {
    authPkX: string;
    authPkY: string;
    sigR8X: string;
    sigR8Y: string;
    sigS: string;
}
export interface TransferDigestParams {
    chainId: number;
    poolAddress: string;
    root: string;
    nullifiers: string[];
    outputs: TransferDigestOutput[];
    viewingKey: string;
    teeWrapKey: string;
}
export interface TransferDigestOutput {
    commitment: string;
    receiverWrapKey: string;
    ct0: string;
    ct1: string;
    ct2: string;
    ct3: string;
}
export interface WithdrawalDigestParams {
    chainId: number;
    poolAddress: string;
    root: string;
    nullifiers: string[];
    outputs: TransferDigestOutput[];
    withdrawTo: string;
    withdrawTokenId: number;
    withdrawAmount: string;
    viewingKey: string;
    teeWrapKey: string;
}
export interface DigestResult {
    digestHi: string;
    digestLo: string;
}
export interface ViewAuthSignatureResult {
    signature: string;
    viewingPublicKey: {
        x: string;
        y: string;
    };
}
export interface RegistrationData {
    authPkX: string;
    authPkY: string;
}
export interface StoredSession {
    token: string;
    expirySecs: number;
    walletAddress: string;
    vaultExists: boolean;
    chainRegistrations?: Record<string, string>;
}
export interface AuthenticateResult {
    status: 'authenticated' | 'credentialRequired' | 'mnemonicGenerated' | 'recoveryRequired';
    privacyAddress?: string;
    mpk?: string;
    mnemonic?: string;
    isNewUser?: boolean;
    chainRegistrations?: Record<string, string>;
    action?: 'setup' | 'unlock';
    unlockType?: 'pin' | 'password';
    reason?: string;
}
export interface KeyVaultConfig {
    mode: 'iframe' | 'local';
    iframeUrl?: string;
}
export interface KeyVault {
    initialize(config: {
        serverUrl: string;
        chainId: number;
        shieldContractAddress: string;
        wethContractAddress?: string;
        appId?: string;
        rpcUrl?: string;
        tokenRegistryAddress?: string;
        persistence?: {
            storage: 'localStorage' | 'indexedDB' | 'osKeychain';
            unlock?: 'none' | 'pin' | 'password';
        };
        autoConsolidate?: boolean;
        autoConsolidateThreshold?: number;
        autoConsolidateMaxRounds?: number;
    }): Promise<void>;
    dispose(): void;
    authenticate(keySource: KeySource | null, tokenProviderCallback: ((payload: unknown) => Promise<{
        token: string;
        expiresIn: number;
    }>) | null): Promise<AuthenticateResult>;
    submitCredential(credential: string, tokenProviderCallback: ((payload: unknown) => Promise<{
        token: string;
        expiresIn: number;
    }>) | null): Promise<AuthenticateResult>;
    /**
     * Continue authentication after the mnemonic has been shown to the user.
     *
     * `credential` must be supplied when the SDK is configured with PIN or
     * password unlock — proceed wraps the local vault with the unlock provider,
     * and the PIN/Password providers reject `null` credential at setup with
     * "credential required for setup". For wallet-sig unlock, pass `null`.
     */
    proceedAfterMnemonic(credential: string | null, tokenProviderCallback: ((payload: unknown) => Promise<{
        token: string;
        expiresIn: number;
    }>) | null): Promise<AuthenticateResult>;
    logout(): Promise<void>;
    clearSession(): Promise<void>;
    getStoredSession(): Promise<StoredSession | null>;
    getKeyStatus(): Promise<KeyStatus>;
    getPublicKeys(): Promise<PublicKeys>;
    isAuthenticated(): boolean;
    getPrivacyAddress(): string | null;
    getMpk(): string | null;
    /** Permanently delete the server vault and clear local state. */
    deleteVault(): Promise<void>;
    buildShieldCommitment(params: BuildShieldCommitmentParams): Promise<ShieldCommitmentResult>;
    encryptDepositCiphertext(params: EncryptDepositCiphertextParams): Promise<DepositCiphertextResult>;
    computeNullifiers(notes: NullifierInput[]): Promise<string[]>;
    generateNpk(recipientMpk: string, randomIn: string): Promise<string>;
    computeOutputCommitment(npk: string, tokenId: number, amount: string): Promise<string>;
    deriveEcdhKeys(params: DeriveEcdhKeysParams): Promise<EcdhKeysResult>;
    encryptTransferCiphertext(params: EncryptTransferCiphertextParams): Promise<TransferCiphertextResult>;
    signSpending(digestHi: string, digestLo: string): Promise<SpendingSignatureResult>;
    computeTransferDigest(params: TransferDigestParams): Promise<DigestResult>;
    computeWithdrawalDigest(params: WithdrawalDigestParams): Promise<DigestResult>;
    computeWithdrawalCommitment(recipientAddr: string, tokenId: number, amount: string): Promise<string>;
    signViewAuth(mpk: string, nonce: string): Promise<ViewAuthSignatureResult>;
    getRegistrationData(): Promise<RegistrationData>;
    shield(tokenAddress: string, amount: string, onProgress?: (event: ShieldRawProgress) => void): Promise<unknown>;
    sendTransfer(tokenAddress: string, amount: string, recipientPrivacyAddress: string): Promise<unknown>;
    unshield(tokenAddress: string, amount: string, recipientAddress: string, onProgress?: (event: UnshieldRawProgress) => void): Promise<unknown>;
    unwrapWeth(amount: string, recipientAddress: string): Promise<string>;
    consolidateNotes(tokenAddress: string, maxRounds: number): Promise<unknown>;
    setWalletBridge(bridge: {
        signMessage(message: string): Promise<string>;
        signTypedData(typedData: string): Promise<string>;
        sendTransaction(tx: unknown): Promise<string>;
        getAddress(): Promise<string>;
        getChainId(): Promise<number>;
    }): void;
}
//# sourceMappingURL=types.d.ts.map