import type {FetchOptions} from "ofetch" export interface Endpoints extends Record { attestOptions: string, attest: string, assertOptions: string, assert: string, } export interface Config extends Partial> { routes: Endpoints, findCsrfToken: boolean|string, findXsrfToken: boolean|string, useAutofill: boolean|undefined, method: "get" | "post" | string, redirect: RequestRedirect, baseURL: string | undefined, headers: Record, credentials: RequestCredentials, } export interface CeremonyOptions extends Partial { path: string, } export type CeremonyOptionsWithoutPath = Omit & { path?: string } export type CeremonyResultRaw = Record | string | undefined interface CeremonyResult { data: CeremonyResultRaw, success: boolean, error: Error | undefined | unknown, } export interface AttestationResult extends CeremonyResult { credentials: CeremonyResult["data"], id: string | number | undefined, } export interface AssertionResult extends CeremonyResult { user: CeremonyResult["data"], token: string | undefined, } type Ceremony = (options?: string | CeremonyOptionsWithoutPath, response?: string | CeremonyOptionsWithoutPath) => Promise export interface Webpass { attest: Ceremony, assert: Ceremony, attestRaw: Ceremony, assertRaw: Ceremony, } export interface WebpassStatic extends Webpass { create: (config?: Partial) => Webpass, isSupported: () => boolean, isNotSupported: () => boolean, isUnsupported: () => boolean, isAutofillable: () => Promise, isNotAutofillable: () => Promise, isPlatformAuthenticator: () => Promise, isNotPlatformAuthenticator: () => Promise, } export interface ServerPublicKeyCredentialCreationOptions extends Omit { challenge: string, user: { id: string, name: string, displayName: string }, excludeCredentials: { id: string, type: "public-key" }[] } export interface ServerPublicKeyCredentialRequestOptions extends Omit { challenge: string, allowCredentials: { id: string, type: "public-key" }[] }