import { SignerAgent } from '@icp-sdk/signer/agent'; export { SignerAgent, SignerAgentOptions } from '@icp-sdk/signer/agent'; import { Agent as Agent$1, HttpAgent, Identity, SignIdentity } from '@icp-sdk/core/agent'; import * as _icp_sdk_core_identity from '@icp-sdk/core/identity'; import { Delegation, PartialIdentity } from '@icp-sdk/core/identity'; import { Signer } from '@icp-sdk/signer'; import { AuthClientStorage } from '@icp-sdk/auth/client'; import { SubAccount } from '@icp-sdk/canisters/ledger/icp'; import { Principal } from '@icp-sdk/core/principal'; type AgentOptions = { delegation?: Delegation; signerAgent: SignerAgent; agent: HttpAgent; identity?: Identity | PartialIdentity; }; declare class Agent implements Agent$1 { private signerAgentStrategy; private agentStrategy; private delegation?; private constructor(); static create({ delegation, signerAgent, agent }: AgentOptions): Promise; call(...params: Parameters): ReturnType; query(...params: Parameters): ReturnType; get rootKey(): Uint8Array | null; fetchRootKey(): ReturnType; getPrincipal(): ReturnType; status(): ReturnType; update(...params: Parameters): ReturnType; readState(...params: Parameters): ReturnType; createReadStateRequest?(...params: Parameters>): ReturnType>; } /** @module IdleManager */ type TimeoutCB = () => unknown; type TimeoutManagerOptions = { /** * Callback after the timeout */ onTimeout?: TimeoutCB; /** * timeout in ms */ timeout: number; }; /** * Detects if the `timeout` ms is over, and calls `onTimeout` and registered callbacks. * To override these defaults, you can pass an `onTimeout` callback, or configure a custom `timeout` in milliseconds */ declare class TimeoutManager { callbacks: TimeoutCB[]; timeout?: TimeoutManagerOptions["timeout"]; timeoutID?: number; /** * @param options {@link IdleManagerOptions} */ constructor(options: TimeoutManagerOptions); /** * @param {TimeoutCB} callback function to be called on timeout */ registerCallback(callback: TimeoutCB): void; /** * Cleans up the timeout manager and its listeners */ exit(): void; /** * Resets the timeouts during cleanup */ _resetTimer(): void; } type IdleManagerOptions = { /** * capture scroll events * @default false */ captureScroll?: boolean; /** * scroll debounce time in ms * @default 100 */ scrollDebounce?: number; /** * Callback after the user has gone idle */ onIdle?: () => unknown; /** * timeout in ms */ idleTimeout?: number; }; /** * Detects if the user has been idle for a duration of `idleTimeout` ms, and calls `onIdle` and registered callbacks. * By default, the IdleManager will log a user out after 10 minutes of inactivity. * To override these defaults, you can pass an `onIdle` callback, or configure a custom `idleTimeout` in milliseconds */ declare class IdleManager extends TimeoutManager { constructor(options?: IdleManagerOptions); } interface IdleOptions extends IdleManagerOptions { /** * Disables idle functionality for {@link IdleManager} * @default false */ disableIdle?: boolean; /** * Disables default idle behavior - call logout * @default false */ disableDefaultIdleCallback?: boolean; } interface SignerClientOptions { signer: Signer; /** * Optional, used to generate random bytes * @default uses browser/node Crypto by default */ crypto?: Pick; /** * Optional storage with get, set, and remove. Uses {@link IdbStorage} by default */ storage?: AuthClientStorage; /** * Options to handle idle timeouts * @default after 30 minutes, invalidates the identity */ idleOptions?: IdleOptions; derivationOrigin?: string; onLogout?: () => Promise; } declare abstract class SignerClient { protected options: SignerClientOptions; protected idleManager: IdleManager | undefined; protected storage: AuthClientStorage; connectedUser: { principal: Principal; subAccount?: SubAccount; } | undefined; constructor(options: SignerClientOptions); protected registerDefaultIdleCallback(): void; protected logout(options?: { returnTo?: string; }): Promise; protected setConnectedUser(user: { owner: string; subAccount?: ArrayBuffer | Uint8Array; } | undefined): Promise; protected setConnectedUserToStorage(user: { owner: string; subAccount?: ArrayBuffer | Uint8Array; } | undefined): Promise; static shouldCheckIsUserConnected(): boolean; protected getConnectedUserFromStorage(): Promise<{ owner: string; subAccount?: ArrayBuffer | Uint8Array; } | undefined>; protected get crypto(): Pick; } declare const ED25519_KEY_LABEL = "Ed25519"; type BaseKeyType = "ECDSA" | typeof ED25519_KEY_LABEL; declare enum DelegationType { ACCOUNT = "ACCOUNT", RELYING_PARTY = "RELYING_PARTY" } interface DelegationSignerClientOptions extends SignerClientOptions { /** * An identity to use as the base */ identity?: SignIdentity | PartialIdentity; /** * type to use for the base key * @default 'ECDSA' * If you are using a custom storage provider that does not support CryptoKey storage, * you should use 'Ed25519' as the key type, as it can serialize to a string */ keyType?: BaseKeyType; targets?: string[]; /** * Expiration of the delegation in nanoseconds */ maxTimeToLive?: bigint; } declare class DelegationSignerClient extends SignerClient { private identity; private baseIdentity; private targets?; private maxTimeToLive; private expirationManager?; constructor(options: SignerClientOptions, identity: Identity | PartialIdentity, baseIdentity: SignIdentity | PartialIdentity, targets?: string[] | undefined, maxTimeToLive?: bigint); static create(options: DelegationSignerClientOptions): Promise; private static createIdentity; login(): Promise; private initExpirationManager; logout(options?: { returnTo?: string; }): Promise; getIdentity(): Identity | PartialIdentity; getDelegationType(): Promise; getDelegation(): Promise<_icp_sdk_core_identity.SignedDelegation | undefined>; } interface AccountsSignerClientOptions extends SignerClientOptions { } declare class AccountsSignerClient extends SignerClient { static create(options: AccountsSignerClientOptions): Promise; login(): Promise; logout(options?: { returnTo?: string; }): Promise; private setAccounts; getAccounts(): Promise<{ principal: Principal; subAccount?: SubAccount; }[] | undefined>; } type SignerConfig = { id: string; providerUrl: string; label: string; transportType: TransportType; icon?: string; description?: string; }; declare enum TransportType { NEW_TAB = 0, EXTENSION = 1 } declare const NFIDW: SignerConfig; declare const MockedSigner: SignerConfig; declare const InternetIdentity: SignerConfig; declare const OISY: SignerConfig; declare const IdentityKitCustomSignerAuthType: { [OISY.id]: "ACCOUNTS"; [InternetIdentity.id]: "DELEGATION"; }; type ObjectValuesType = T[keyof T]; declare const IdentityKitAuthType: { readonly DELEGATION: "DELEGATION"; readonly ACCOUNTS: "ACCOUNTS"; }; type IdentityKitAuthType = ObjectValuesType; declare class IdentityKit { signerClient: TSignerClient; constructor(signerClient: TSignerClient); getIcpBalance(): Promise; static create({ signerClientOptions, authType }: { signerClientOptions: TSignerClientOptions; authType: T; }): Promise | IdentityKit<"ACCOUNTS", AccountsSignerClient>>; } export { IdentityKit, AccountsSignerClient as IdentityKitAccountsSignerClient, Agent as IdentityKitAgent, IdentityKitAuthType, IdentityKitCustomSignerAuthType, DelegationSignerClient as IdentityKitDelegationSignerClient, DelegationType as IdentityKitDelegationType, SignerClient as IdentityKitSignerClient, TransportType as IdentityKitTransportType, InternetIdentity, MockedSigner, NFIDW, OISY }; export type { AccountsSignerClientOptions as IdentityKitAccountsSignerClientOptions, AgentOptions as IdentityKitAgentOptions, DelegationSignerClientOptions as IdentityKitDelegationSignerClientOptions, SignerClientOptions as IdentityKitSignerClientOptions, SignerConfig as IdentityKitSignerConfig };