@adonis-agora/authkit-react
Version:
Frontend ergonomics over AuthKit for AdonisJS + Inertia + React apps: a typed useAuth() hook, role-gating hooks and gating components.
42 lines (41 loc) • 1.7 kB
TypeScript
export type StartAuthenticationFn = (opts: {
optionsJSON: unknown;
useBrowserAutofill?: boolean;
verifyBrowserAutofillInput?: boolean;
}, signal?: AbortSignal) => Promise<unknown>;
export type StartRegistrationFn = (opts: {
optionsJSON: unknown;
}) => Promise<unknown>;
declare function importWebAuthnBrowser(): Promise<{
startAuthentication: StartAuthenticationFn;
startRegistration: StartRegistrationFn;
}>;
export declare function loadStartAuthentication(importModule?: typeof importWebAuthnBrowser): Promise<StartAuthenticationFn>;
export declare function loadStartRegistration(importModule?: typeof importWebAuthnBrowser): Promise<StartRegistrationFn>;
export interface AuthenticatePasskeyOptions {
optionsUrl: string;
csrfToken?: string;
signal?: AbortSignal;
}
export interface PasskeyCeremonyDeps {
fetch?: typeof globalThis.fetch;
loadStartAuthentication?: () => Promise<StartAuthenticationFn>;
}
export declare function authenticatePasskey(options: AuthenticatePasskeyOptions, deps?: PasskeyCeremonyDeps): Promise<string>;
export interface RegisterPasskeyOptions {
optionsUrl: string;
csrfToken?: string;
signal?: AbortSignal;
}
export interface PasskeyRegistrationDeps {
fetch?: typeof globalThis.fetch;
loadStartRegistration?: () => Promise<StartRegistrationFn>;
}
export declare function registerPasskey(options: RegisterPasskeyOptions, deps?: PasskeyRegistrationDeps): Promise<string>;
export interface SubmitPasskeyVerificationOptions {
verifyUrl: string;
assertion: string;
csrfToken?: string;
}
export declare function submitPasskeyVerification(options: SubmitPasskeyVerificationOptions): void;
export {};