import { type ReactNode } from "react"; import { AuthClient, type AuthClientCreateOptions } from "@icp-sdk/auth/client"; import type { LoginOptions } from "./login-options.type"; import { type Identity } from "@icp-sdk/core/agent"; import { type InternetIdentityContext, type Status } from "./context.type"; export interface StoreContext { providerComponentPresent: boolean; authClient?: AuthClient; createOptions?: AuthClientCreateOptions; loginOptions?: LoginOptions; status: Status; error?: Error; identity?: Identity; clearIdentityOnExpiry: boolean; } /** * Ensure the Internet Identity library has been initialized. * Resolves with the restored `Identity` if one was found (and authenticated), * otherwise resolves with `undefined`. Rejects if initialization failed. * * @returns A promise that resolves when initialization is complete * and yields the identity (or `undefined`). */ export declare function ensureInitialized(): Promise; /** * Check if the user is currently authenticated. * This can be used outside of React components, for example in route guards. * * @returns true if the user has a valid identity, false otherwise */ export declare function isAuthenticated(): boolean; /** * Get the current identity if authenticated. * This can be used outside of React components. * * @returns The current identity or undefined */ export declare function getIdentity(): Identity | undefined; /** * Hook to access the internet identity as well as login status along with * login and clear functions. */ export declare const useInternetIdentity: () => InternetIdentityContext; /** * The InternetIdentityProvider component makes the saved identity available * after page reloads. It also allows you to configure default options * for AuthClient and login. * * By default, the component uses the main Internet Identity service at * https://identity.ic0.app. For local development, you can override this * by setting the identityProvider in loginOptions: * * @example * ```tsx * * * * ``` */ export declare function InternetIdentityProvider({ children, createOptions, loginOptions, clearIdentityOnExpiry, }: { /** The child components that the InternetIdentityProvider will wrap. This allows any child * component to access the authentication context provided by the InternetIdentityProvider. */ children: ReactNode; /** Options for creating the {@link AuthClient}. See AuthClient documentation for list of options * *`ic-use-internet-identity` defaults to disabling the AuthClient idle handling (clearing identities * from store and reloading the window on identity expiry). If that behaviour is preferred, set these settings: * * ``` * const options = { * idleOptions: { * disableDefaultIdleCallback: false, * disableIdle: false, * }, * } * ``` */ createOptions?: AuthClientCreateOptions; /** Options that determine the behaviour of the {@link AuthClient} login call. These options are a subset of * the {@link AuthClientLoginOptions}. */ loginOptions?: LoginOptions; /** Clear the identity automatically on expiration. Default value is `true`. */ clearIdentityOnExpiry?: boolean; }): ReactNode; export type { Status, InternetIdentityContext, LoginOptions };