UNPKG

expo-passkey

Version:

Passkey authentication for Expo apps with Better Auth integration

245 lines 10 kB
/** * @file Register passkey endpoint * @description WebAuthn-based implementation for passkey registration with client preferences support */ import type { Logger } from "../utils/logger"; import type { ResolvedSchemaConfig } from "../../types/server"; /** * Create WebAuthn passkey registration endpoint */ export declare const createRegisterEndpoint: (options: { rpName: string; rpId: string; origin?: string | string[]; logger: Logger; schemaConfig: ResolvedSchemaConfig; }) => { <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: { body: { userId: string; platform: string; credential: { id: string; type: "public-key"; rawId: string; response: { clientDataJSON: string; attestationObject: string; transports?: string[] | undefined; }; authenticatorAttachment?: "platform" | "cross-platform" | undefined; clientExtensionResults?: {} | undefined; }; metadata?: { deviceName?: string | undefined; deviceModel?: string | undefined; appVersion?: string | undefined; lastLocation?: string | undefined; manufacturer?: string | undefined; biometricType?: string | undefined; } | undefined; }; } & { method?: "POST" | undefined; } & { query?: Record<string, any> | undefined; } & { params?: Record<string, any>; } & { request?: Request; } & { headers?: HeadersInit; } & { asResponse?: boolean; returnHeaders?: boolean; use?: import("better-call").Middleware[]; path?: string; } & { asResponse?: AsResponse | undefined; returnHeaders?: ReturnHeaders | undefined; }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { headers: Headers; response: { success: boolean; rpName: string; rpId: string; }; } : { success: boolean; rpName: string; rpId: string; }>; options: { method: "POST"; body: import("zod").ZodObject<{ userId: import("zod").ZodString; credential: import("zod").ZodObject<{ id: import("zod").ZodString; rawId: import("zod").ZodString; response: import("zod").ZodObject<{ clientDataJSON: import("zod").ZodString; attestationObject: import("zod").ZodString; transports: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>; }, "strip", import("zod").ZodTypeAny, { clientDataJSON: string; attestationObject: string; transports?: string[] | undefined; }, { clientDataJSON: string; attestationObject: string; transports?: string[] | undefined; }>; type: import("zod").ZodLiteral<"public-key">; clientExtensionResults: import("zod").ZodOptional<import("zod").ZodObject<{}, "strip", import("zod").ZodTypeAny, {}, {}>>; authenticatorAttachment: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodLiteral<"platform">, import("zod").ZodLiteral<"cross-platform">]>>; }, "strip", import("zod").ZodTypeAny, { id: string; type: "public-key"; rawId: string; response: { clientDataJSON: string; attestationObject: string; transports?: string[] | undefined; }; authenticatorAttachment?: "platform" | "cross-platform" | undefined; clientExtensionResults?: {} | undefined; }, { id: string; type: "public-key"; rawId: string; response: { clientDataJSON: string; attestationObject: string; transports?: string[] | undefined; }; authenticatorAttachment?: "platform" | "cross-platform" | undefined; clientExtensionResults?: {} | undefined; }>; platform: import("zod").ZodString; metadata: import("zod").ZodOptional<import("zod").ZodObject<{ deviceName: import("zod").ZodOptional<import("zod").ZodString>; deviceModel: import("zod").ZodOptional<import("zod").ZodString>; appVersion: import("zod").ZodOptional<import("zod").ZodString>; manufacturer: import("zod").ZodOptional<import("zod").ZodString>; biometricType: import("zod").ZodOptional<import("zod").ZodString>; lastLocation: import("zod").ZodOptional<import("zod").ZodString>; }, "strip", import("zod").ZodTypeAny, { deviceName?: string | undefined; deviceModel?: string | undefined; appVersion?: string | undefined; lastLocation?: string | undefined; manufacturer?: string | undefined; biometricType?: string | undefined; }, { deviceName?: string | undefined; deviceModel?: string | undefined; appVersion?: string | undefined; lastLocation?: string | undefined; manufacturer?: string | undefined; biometricType?: string | undefined; }>>; }, "strip", import("zod").ZodTypeAny, { userId: string; platform: string; credential: { id: string; type: "public-key"; rawId: string; response: { clientDataJSON: string; attestationObject: string; transports?: string[] | undefined; }; authenticatorAttachment?: "platform" | "cross-platform" | undefined; clientExtensionResults?: {} | undefined; }; metadata?: { deviceName?: string | undefined; deviceModel?: string | undefined; appVersion?: string | undefined; lastLocation?: string | undefined; manufacturer?: string | undefined; biometricType?: string | undefined; } | undefined; }, { userId: string; platform: string; credential: { id: string; type: "public-key"; rawId: string; response: { clientDataJSON: string; attestationObject: string; transports?: string[] | undefined; }; authenticatorAttachment?: "platform" | "cross-platform" | undefined; clientExtensionResults?: {} | undefined; }; metadata?: { deviceName?: string | undefined; deviceModel?: string | undefined; appVersion?: string | undefined; lastLocation?: string | undefined; manufacturer?: string | undefined; biometricType?: string | undefined; } | undefined; }>; metadata: { openapi: { description: string; tags: string[]; responses: { 200: { description: string; content: { "application/json": { schema: { type: "object"; properties: { success: { type: string; }; rpName: { type: string; }; rpId: { type: string; }; }; }; }; }; }; 400: { description: string; content: { "application/json": { schema: { type: "object"; properties: { error: { type: string; properties: { code: { type: string; }; message: { type: string; }; }; }; }; }; }; }; }; }; }; }; } & { use: any[]; }; path: "/expo-passkey/register"; }; //# sourceMappingURL=register.d.ts.map