in packages/better-auth/src/plugins/passkey/index.ts [325:428]
generatePasskeyAuthenticationOptions: createAuthEndpoint(
"/passkey/generate-authenticate-options",
{
method: "POST",
body: z
.object({
email: z
.string({
description: "The email address of the user",
})
.optional(),
})
.optional(),
metadata: {
openapi: {
description: "Generate authentication options for a passkey",
responses: {
200: {
description: "Success",
content: {
"application/json": {
schema: {
type: "object",
properties: {
challenge: {
type: "string",
},
rp: {
type: "object",
properties: {
name: {
type: "string",
},
id: {
type: "string",
},
},
},
user: {
type: "object",
properties: {
id: {
type: "string",
},
name: {
type: "string",
},
displayName: {
type: "string",
},
},
},
timeout: {
type: "number",
},
allowCredentials: {
type: "array",
items: {
type: "object",
properties: {
id: {
type: "string",
},
type: {
type: "string",
},
transports: {
type: "array",
items: {
type: "string",
},
},
},
},
},
userVerification: {
type: "string",
},
authenticatorSelection: {
type: "object",
properties: {
authenticatorAttachment: {
type: "string",
},
requireResidentKey: {
type: "boolean",
},
userVerification: {
type: "string",
},
},
},
extensions: {
type: "object",
},
},
},
},
},
},
},
},
},
},