import type { FasedAgentConfig } from "../config/config.js";
import type { WalletChain } from "../config/types.wallet.js";
import { type ResolvedWalletRuntimeConfig } from "./wallet-runtime-config.js";
export type WalletCustodyRole = "mining" | "agent" | "vault";
export type WalletCustodyScope = {
    walletId: string;
    role: WalletCustodyRole;
    chains: WalletChain[];
    allowPrograms: string[];
    solana: {
        maxPerTx: string;
        maxDaily: string;
    };
};
type WalletCustodyUnlockSession = {
    id: string;
    host: string;
    walletId: string;
    role: WalletCustodyRole;
    chains: WalletChain[];
    allowPrograms: string[];
    solanaMaxPerTx: string;
    solanaMaxDaily: string;
    createdAt: string;
    expiresAt: string;
    lastUsedAt?: string;
};
export type WalletCustodyStatus = {
    mode: "single-key" | "split-key-scaffold" | "split-key-active";
    target: {
        walletId: string;
        role: WalletCustodyRole;
    };
    scope: {
        chains: WalletChain[];
        allowPrograms: string[];
        solana: {
            maxPerTx: string;
            maxDaily: string;
        };
    };
    unlock: {
        active: boolean;
        sessionId?: string;
        host?: string;
        expiresAt?: string;
    };
    phase2: {
        complete: boolean;
        splitKeyEnabled: boolean;
        passkeyCeremonyEnabled: boolean;
        ephemeralReconstructionEnabled: boolean;
        notes: string[];
    };
    ceremony?: {
        initialized: boolean;
        scheme?: string;
        secretBytes?: number;
        devices?: Array<{
            id: string;
            label?: string;
            createdAt: string;
            revokedAt?: string;
        }>;
        path: string;
        updatedAt?: string;
    };
};
export declare function withWalletCustodySigningMaterial<T>(params: {
    sessionId: string;
    host: string;
    handler: (material: {
        sessionId: string;
        host: string;
    }) => Promise<T> | T;
}): Promise<{
    ok: true;
    value: T;
} | {
    ok: false;
    code: "custody_unlock_required";
    message: string;
}>;
export declare function deleteWalletCustodyCeremony(params?: {
    env?: NodeJS.ProcessEnv;
    walletId?: string;
    wallet?: ResolvedWalletRuntimeConfig;
    cfg?: FasedAgentConfig;
}): {
    ok: true;
    walletId: string;
    removed: boolean;
    statePath: string;
};
export declare function initializeWalletCustodyCeremony(params?: {
    env?: NodeJS.ProcessEnv;
    force?: boolean;
    deviceShare?: string;
    deviceLabel?: string;
    walletId?: string;
    wallet?: ResolvedWalletRuntimeConfig;
    cfg?: FasedAgentConfig;
}): {
    ok: false;
    code: string;
    message: string;
    statePath: string;
    scheme?: undefined;
    walletId?: undefined;
    role?: undefined;
    deviceShare?: undefined;
    recoveryShare?: undefined;
    secretBytes?: undefined;
    updatedAt?: undefined;
} | {
    ok: false;
    code: string;
    message: string;
    statePath?: undefined;
    scheme?: undefined;
    walletId?: undefined;
    role?: undefined;
    deviceShare?: undefined;
    recoveryShare?: undefined;
    secretBytes?: undefined;
    updatedAt?: undefined;
} | {
    ok: true;
    statePath: string;
    scheme: "shamir-2ofn-v1";
    walletId: string;
    role: WalletCustodyRole;
    deviceShare: string;
    recoveryShare: string;
    secretBytes: number;
    updatedAt: string;
    code?: undefined;
    message?: undefined;
};
export declare function recoverWalletCustodyCeremony(params?: {
    env?: NodeJS.ProcessEnv;
    recoveryShare?: string;
    deviceShare?: string;
    deviceLabel?: string;
    walletId?: string;
    wallet?: ResolvedWalletRuntimeConfig;
    cfg?: FasedAgentConfig;
}): {
    ok: false;
    code: string;
    message: string;
} | {
    ok: false;
    code: string;
    message: string;
    statePath: string;
    scheme?: undefined;
    walletId?: undefined;
    role?: undefined;
    deviceShare?: undefined;
    recoveryShare?: undefined;
    secretBytes?: undefined;
    updatedAt?: undefined;
} | {
    ok: true;
    statePath: string;
    scheme: "shamir-2ofn-v1";
    walletId: string;
    role: WalletCustodyRole;
    deviceShare: string;
    recoveryShare: string;
    secretBytes: number;
    updatedAt: string;
    code?: undefined;
    message?: undefined;
};
export declare function enrollWalletCustodyDevice(params?: {
    env?: NodeJS.ProcessEnv;
    walletId?: string;
    wallet?: ResolvedWalletRuntimeConfig;
    cfg?: FasedAgentConfig;
    deviceShare?: string;
    recoveryShare?: string;
    label?: string;
}): {
    ok: false;
    code: string;
    message: string;
} | {
    ok: true;
    walletId: string;
    role: WalletCustodyRole;
    deviceId: string;
    label: string | undefined;
    deviceShare: string;
    statePath: string;
    updatedAt: string;
};
export declare function revokeWalletCustodyDevice(params?: {
    env?: NodeJS.ProcessEnv;
    walletId?: string;
    wallet?: ResolvedWalletRuntimeConfig;
    cfg?: FasedAgentConfig;
    deviceShare?: string;
    recoveryShare?: string;
    deviceId?: string;
}): {
    ok: false;
    code: string;
    message: string;
} | {
    ok: true;
    walletId: string;
    role: WalletCustodyRole;
    removedDeviceId: string;
    removedDeviceLabel: string | undefined;
    updatedAt: string;
};
export declare function recoverWalletCustodyPassphrase(params?: {
    env?: NodeJS.ProcessEnv;
    deviceShare?: string;
    recoveryShare?: string;
    walletId?: string;
}): {
    ok: true;
    passphrase: string;
} | {
    ok: false;
    code: string;
    message: string;
};
export declare function lockWalletCustodyUnlockSessions(params?: {
    host?: string;
    walletId?: string;
    env?: NodeJS.ProcessEnv;
}): Promise<{
    ok: true;
    host?: string;
    walletId?: string;
    removed: number;
    remaining: number;
} | {
    ok: false;
    code: string;
    message: string;
    removed?: number;
    remaining?: number;
    host?: string;
    walletId?: string;
}>;
export declare function activateWalletCustodyUnlockSession(params: {
    host: string;
    approvalToken: string;
    env?: NodeJS.ProcessEnv;
    cfg?: FasedAgentConfig;
    wallet?: ResolvedWalletRuntimeConfig;
    walletId?: string;
    deviceShare?: string;
    ttlSeconds?: number;
}): Promise<{
    ok: true;
    session: WalletCustodyUnlockSession;
} | {
    ok: false;
    code: string;
    message: string;
}>;
export declare function refreshWalletCustodyUnlockSession(params: {
    host: string;
    env?: NodeJS.ProcessEnv;
    cfg?: FasedAgentConfig;
    wallet?: ResolvedWalletRuntimeConfig;
    walletId?: string;
    deviceShare?: string;
    ttlSeconds?: number;
}): Promise<{
    ok: true;
    session: WalletCustodyUnlockSession;
} | {
    ok: false;
    code: string;
    message: string;
}>;
export declare function enforceWalletCustodyForAutonomousSend(params: {
    wallet: ResolvedWalletRuntimeConfig;
    env?: NodeJS.ProcessEnv;
    cfg?: FasedAgentConfig;
    walletId?: string;
    approvalToken?: string;
    approvalHost?: string;
    deviceShare?: string;
}): Promise<{
    ok: true;
    custodyMode: WalletCustodyStatus["mode"];
    session?: WalletCustodyUnlockSession;
} | {
    ok: false;
    code: string;
    message: string;
}>;
export declare function readWalletCustodyStatus(params: {
    wallet: ResolvedWalletRuntimeConfig;
    cfg?: FasedAgentConfig;
    walletId?: string;
    approvalHost?: string;
    env?: NodeJS.ProcessEnv;
}): WalletCustodyStatus;
export declare function listSplitKeyWalletCustodyStatuses(params: {
    wallet: ResolvedWalletRuntimeConfig;
    cfg?: FasedAgentConfig;
    env?: NodeJS.ProcessEnv;
}): WalletCustodyStatus[];
export {};
