import { Hex } from 'ox';
import type { Address } from 'viem/accounts';
import * as Adapter from '../Adapter.js';
/**
 * Creates a Turnkey adapter backed by `@turnkey/core` client sessions and Ethereum wallet accounts.
 *
 * The adapter owns silent reconnect, session-expiry cleanup, and provider signing actions.
 * Apps provide the UI-bearing login or sign-up flow through `loadAccounts`. The adapter
 * fetches Ethereum wallet accounts from Turnkey after the flow completes. Provide
 * `createAccount` only when registration needs a distinct Turnkey flow.
 *
 * @example
 * ```ts
 * import { TurnkeyClient, generateWalletAccountsFromAddressFormat } from '@turnkey/core'
 * import { Provider, turnkey } from 'accounts'
 *
 * const provider = Provider.create({
 *   adapter: turnkey({
 *     client: new TurnkeyClient({ organizationId, authProxyConfigId }),
 *     createAccount: async ({ client, parameters }) => {
 *       await client.signUpWithPasskey({
 *         passkeyDisplayName: parameters.name,
 *         createSubOrgParams: {
 *           userName: parameters.name,
 *           customWallet: {
 *             walletName: 'FooBar',
 *             walletAccounts: generateWalletAccountsFromAddressFormat({
 *               addresses: ['ADDRESS_FORMAT_ETHEREUM'],
 *             }),
 *           },
 *         },
 *       })
 *     },
 *     loadAccounts: async ({ client }) => {
 *       await client.loginWithPasskey()
 *     },
 *   }),
 * })
 * ```
 */
export declare function turnkey<const client extends turnkey.Client>(options: turnkey.Options<client>): Adapter.Adapter;
export declare namespace turnkey {
    /** Options for {@link turnkey}. */
    type Options<client extends Client = Client> = {
        /** Existing Turnkey client, such as `TurnkeyClient` from `@turnkey/core`. */
        client: client;
        /**
         * Creates/registers a Turnkey wallet account. UI is allowed. Defaults to `loadAccounts`.
         * May return selected addresses; the first address is treated as active by default.
         */
        createAccount?: ((parameters: {
            /** Initialized Turnkey client. */
            client: client;
            /** Provider create-account parameters. */
            parameters: Adapter.createAccount.Parameters;
        }) => Promise<AccountSelection>) | undefined;
        /** Data URI of the provider icon. @default Black 1×1 SVG. */
        icon?: `data:image/${string}` | undefined;
        /**
         * Loads/logs into existing Turnkey wallet accounts. UI is allowed. May return selected
         * addresses; the first address is treated as active by default.
         */
        loadAccounts: (parameters: {
            /** Initialized Turnkey client. */
            client: client;
            /** Provider load-accounts parameters. */
            parameters?: Adapter.loadAccounts.Parameters | undefined;
        }) => Promise<AccountSelection>;
        /** Display name of the provider. @default "Turnkey" */
        name?: string | undefined;
        /** Reverse DNS identifier. @default "com.turnkey" */
        rdns?: string | undefined;
        /** Milliseconds before Turnkey session expiry to proactively disconnect. @default 10000 */
        sessionSkewMs?: number | undefined;
    };
    /**
     * Optional selected addresses returned from a Turnkey login/sign-up callback.
     * When omitted, all fetched Turnkey Ethereum accounts are used. When provided,
     * fetched accounts are ordered to match this list, and the first address is active by default.
     */
    type AccountSelection = readonly Address[] | void;
    /** Minimal structural Turnkey client surface used by the adapter. */
    type Client = {
        /** Fetches wallets visible to the current Turnkey session. */
        fetchWallets: () => Promise<readonly Wallet[]>;
        /** Returns the current Turnkey session, if any. */
        getSession: () => Promise<Session | null | undefined>;
        /** Low-level Turnkey HTTP client. */
        httpClient: {
            /** Signs a raw payload with Turnkey. */
            signRawPayload: (parameters: SignRawPayloadParameters) => Promise<SignatureResponse>;
        };
        /** Initializes the client. Called once by the adapter. */
        init?: (() => Promise<void> | void) | undefined;
        /** Clears the current Turnkey session. */
        logout: () => Promise<void> | void;
    };
    /** Minimal Turnkey session shape used by the adapter. */
    type Session = {
        /** Session expiry in Unix seconds. */
        expiry: number;
    };
    /** Minimal structural Turnkey wallet shape used by the adapter. */
    type Wallet = {
        /** Wallet accounts. */
        accounts: readonly WalletAccount[];
    };
    /** Minimal structural Turnkey wallet account fetched by the adapter. */
    type WalletAccount = {
        /** EVM address for the Turnkey wallet account. */
        address: string;
        /** Turnkey Ethereum address format. */
        addressFormat?: 'ADDRESS_FORMAT_ETHEREUM' | undefined;
        /** Raw compressed secp256k1 public key for the Turnkey wallet account. */
        publicKey: string;
    };
    /** Signature parts returned by Turnkey raw-payload signing. */
    type SignatureResponse = {
        /** Signature r value. */
        r: string;
        /** Signature s value. */
        s: string;
        /** Signature recovery id/value. */
        v: string;
    };
    /** Parameters for low-level Turnkey raw payload signing. */
    type SignRawPayloadParameters = {
        /** Payload encoding. */
        encoding: 'PAYLOAD_ENCODING_HEXADECIMAL';
        /** Hash function Turnkey should apply. */
        hashFunction: 'HASH_FUNCTION_NO_OP';
        /** Payload digest. */
        payload: Hex.Hex;
        /** Turnkey signer identifier. */
        signWith: string;
    };
}
//# sourceMappingURL=turnkey.d.ts.map