import { type Identity, type SignIdentity } from "@dfinity/agent"; import { PartialIdentity } from "@dfinity/identity"; import type { Signer } from "@slide-computer/signer"; import { type SignerStorage } from "@slide-computer/signer-storage"; import { type IdleManagerOptions } from "./idleManager"; declare const ECDSA_KEY_LABEL = "ECDSA"; declare const ED25519_KEY_LABEL = "Ed25519"; type BaseKeyType = typeof ECDSA_KEY_LABEL | typeof ED25519_KEY_LABEL; export interface IdleOptions extends IdleManagerOptions { /** * Disables idle functionality for {@link IdleManager} * @default false */ disableIdle?: boolean; /** * Disables default idle behavior - call logout & reload window * @default false */ disableDefaultIdleCallback?: boolean; } export interface SignerClientOptions { signer: Signer; /** * An identity to use as the base */ identity?: SignIdentity; /** * 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?: SignerStorage; /** * 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; /** * Options to handle idle timeouts * @default after 30 minutes, invalidates the identity */ idleOptions?: IdleOptions; } export declare class SignerClient { private options; private storage; private baseIdentity; private identity; private idleManager; constructor(options: SignerClientOptions, storage: SignerStorage, baseIdentity: SignIdentity, identity: Identity | PartialIdentity); private get crypto(); static create(options: SignerClientOptions): Promise; private static createIdentity; getIdentity(): Identity; isAuthenticated(): boolean; login(options?: { /** * Expiration of the authentication in nanoseconds * @default BigInt(8) hours * BigInt(3_600_000_000_000) nanoseconds */ maxTimeToLive?: bigint; /** * Callback once login has completed */ onSuccess?: (() => void) | (() => Promise); /** * Callback in case authentication fails */ onError?: ((error?: Error) => void) | ((error?: Error) => Promise); }): Promise; logout(options?: { returnTo?: string; }): Promise; private registerDefaultIdleCallback; } export {};