···322322 return Response.json({ error: "Account is suspended" }, { status: 403 });
323323 }
324324325325- // Get user's credentials (just to verify they exist)
325325+ // Get user's credentials
326326 const credentials = db
327327 .query("SELECT credential_id FROM credentials WHERE user_id = ?")
328328 .all(user.id) as { credential_id: Buffer }[];
···335335 }
336336337337 // Generate authentication options
338338- // For discoverable credentials, omit allowCredentials to let password managers
339339- // show all available passkeys for this RP ID
338338+ // Include allowCredentials to filter to only this user's passkeys
340339 const options: PublicKeyCredentialRequestOptionsJSON =
341340 await generateAuthenticationOptions({
342341 rpID: process.env.RP_ID!,
343342 userVerification: "required",
343343+ allowCredentials: credentials.map(c => ({
344344+ id: c.credential_id.toString('base64url'),
345345+ type: 'public-key' as const,
346346+ transports: ['hybrid', 'internal', 'usb', 'ble', 'nfc'] as AuthenticatorTransportFuture[],
347347+ })),
344348 });
345349346350 // Store challenge