expo-passkey
Version:
Passkey authentication for Expo apps with Better Auth integration
254 lines • 9.95 kB
TypeScript
/**
* @file Authenticate passkey endpoint
* @description WebAuthn-based implementation for passkey authentication
*/
import type { Logger } from "../utils/logger";
import type { ResolvedSchemaConfig } from "../../types";
/**
* Create WebAuthn passkey authentication endpoint
*/
export declare const createAuthenticateEndpoint: (options: {
logger: Logger;
rpId: string;
origin?: string | string[];
schemaConfig: ResolvedSchemaConfig;
}) => {
<AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
body: {
credential: {
id: string;
type: "public-key";
rawId: string;
response: {
clientDataJSON: string;
authenticatorData: string;
signature: string;
userHandle?: string | undefined;
};
clientExtensionResults?: {} | undefined;
};
metadata?: {
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: {
token: string;
user: {
id: string;
name: string;
emailVerified: boolean;
email: string;
createdAt: Date;
updatedAt: Date;
image?: string | null | undefined;
};
};
} : {
token: string;
user: {
id: string;
name: string;
emailVerified: boolean;
email: string;
createdAt: Date;
updatedAt: Date;
image?: string | null | undefined;
};
}>;
options: {
method: "POST";
body: import("zod").ZodObject<{
credential: import("zod").ZodObject<{
id: import("zod").ZodString;
rawId: import("zod").ZodString;
response: import("zod").ZodObject<{
clientDataJSON: import("zod").ZodString;
authenticatorData: import("zod").ZodString;
signature: import("zod").ZodString;
userHandle: import("zod").ZodOptional<import("zod").ZodString>;
}, "strip", import("zod").ZodTypeAny, {
clientDataJSON: string;
authenticatorData: string;
signature: string;
userHandle?: string | undefined;
}, {
clientDataJSON: string;
authenticatorData: string;
signature: string;
userHandle?: string | undefined;
}>;
type: import("zod").ZodLiteral<"public-key">;
clientExtensionResults: import("zod").ZodOptional<import("zod").ZodObject<{}, "strip", import("zod").ZodTypeAny, {}, {}>>;
}, "strip", import("zod").ZodTypeAny, {
id: string;
type: "public-key";
rawId: string;
response: {
clientDataJSON: string;
authenticatorData: string;
signature: string;
userHandle?: string | undefined;
};
clientExtensionResults?: {} | undefined;
}, {
id: string;
type: "public-key";
rawId: string;
response: {
clientDataJSON: string;
authenticatorData: string;
signature: string;
userHandle?: string | undefined;
};
clientExtensionResults?: {} | undefined;
}>;
metadata: import("zod").ZodOptional<import("zod").ZodObject<{
lastLocation: import("zod").ZodOptional<import("zod").ZodString>;
appVersion: import("zod").ZodOptional<import("zod").ZodString>;
deviceModel: import("zod").ZodOptional<import("zod").ZodString>;
manufacturer: import("zod").ZodOptional<import("zod").ZodString>;
biometricType: import("zod").ZodOptional<import("zod").ZodString>;
}, "strip", import("zod").ZodTypeAny, {
deviceModel?: string | undefined;
appVersion?: string | undefined;
lastLocation?: string | undefined;
manufacturer?: string | undefined;
biometricType?: string | undefined;
}, {
deviceModel?: string | undefined;
appVersion?: string | undefined;
lastLocation?: string | undefined;
manufacturer?: string | undefined;
biometricType?: string | undefined;
}>>;
}, "strip", import("zod").ZodTypeAny, {
credential: {
id: string;
type: "public-key";
rawId: string;
response: {
clientDataJSON: string;
authenticatorData: string;
signature: string;
userHandle?: string | undefined;
};
clientExtensionResults?: {} | undefined;
};
metadata?: {
deviceModel?: string | undefined;
appVersion?: string | undefined;
lastLocation?: string | undefined;
manufacturer?: string | undefined;
biometricType?: string | undefined;
} | undefined;
}, {
credential: {
id: string;
type: "public-key";
rawId: string;
response: {
clientDataJSON: string;
authenticatorData: string;
signature: string;
userHandle?: string | undefined;
};
clientExtensionResults?: {} | undefined;
};
metadata?: {
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: {
token: {
type: string;
};
user: {
type: string;
properties: {
id: {
type: string;
};
email: {
type: string;
};
emailVerified: {
type: string;
};
};
};
};
};
};
};
};
401: {
description: string;
content: {
"application/json": {
schema: {
type: "object";
properties: {
error: {
type: string;
properties: {
code: {
type: string;
};
message: {
type: string;
};
};
};
};
};
};
};
};
};
};
};
} & {
use: any[];
};
path: "/expo-passkey/authenticate";
};
//# sourceMappingURL=authenticate.d.ts.map