import { type ModuleInput } from '@unchainedshop/mongodb'; import type { RegistrationJSON, AuthenticationJSON, CredentialInfo, NamedAlgo, ExtendedAuthenticatorTransport } from '@passwordless-id/webauthn/dist/esm/types.js'; export type { RegistrationJSON, AuthenticationJSON, CredentialInfo, NamedAlgo, ExtendedAuthenticatorTransport, }; export declare function toArrayBuffer(buffer: Buffer): ArrayBuffer; export declare function buf2hex(buffer: ArrayBuffer): string; export interface WebAuthnCredentialCreationOptions { challenge: string; requestId: string; rp: { id: string; name: string; }; user: { id: string; name: string; displayName: string; }; pubKeyCredParams: { type: 'public-key'; alg: number; }[]; timeout: number; attestation: 'none' | 'indirect' | 'direct'; authenticatorSelection?: { authenticatorAttachment?: 'platform' | 'cross-platform'; requireResidentKey?: boolean; userVerification?: 'required' | 'preferred' | 'discouraged'; }; } export interface WebAuthnCredentialRequestOptions { challenge: string; requestId: string; rpId: string; timeout: number; userVerification?: 'required' | 'preferred' | 'discouraged'; allowCredentials?: { id: string; type: 'public-key'; transports?: ('usb' | 'nfc' | 'ble' | 'internal')[]; }[]; } export interface WebAuthnCredential { id: string; publicKey: string; algorithm: NamedAlgo; aaguid: string; counter: number; created: Date; } export declare const configureUsersWebAuthnModule: ({ db }: ModuleInput>) => Promise<{ findMDSMetadataForAAGUID: (aaguid: string) => Promise<{ [key: string]: unknown; description?: string; icon?: string; authenticatorGetInfo?: { versions?: string[]; extensions?: string[]; options?: Record; }; } | null>; createCredentialCreationOptions: (origin: string, username: string, extensionOptions?: { timeout?: number; authenticatorSelection?: WebAuthnCredentialCreationOptions["authenticatorSelection"]; }) => Promise; createCredentialRequestOptions: (origin: string, username: string, extensionOptions?: { timeout?: number; userVerification?: "required" | "preferred" | "discouraged"; allowCredentials?: WebAuthnCredentialRequestOptions["allowCredentials"]; }) => Promise; verifyCredentialCreation: (username: string, credentials: RegistrationJSON) => Promise; verifyCredentialRequest: (userPublicKeys: { id: string; publicKey: string; algorithm?: NamedAlgo; counter?: number; transports?: ExtendedAuthenticatorTransport[]; }[], username: string, credentials: AuthenticationJSON & { requestId: string; }) => Promise<{ userHandle: string; counter: number; } | null>; deleteUserWebAuthnCredentials: (username: string) => Promise; }>; export type UsersWebAuthnModule = Awaited>;