11import { StatusCodes } from 'http-status-codes' ;
22import { z } from 'zod' ;
33import { generateRegistrationOptions } from '@simplewebauthn/server' ;
4- import { RegistrationOptionsResponseSchema } from '#models/passkey.js' ;
54
65const rpName = process . env . WEB_AUTHN_RP_NAME ;
76const rpID = process . env . WEB_AUTHN_RP_ID ;
@@ -17,7 +16,7 @@ export default async function (fastify, _opts) {
1716 id : z . string ( ) . uuid ( ) ,
1817 } ) ,
1918 response : {
20- [ StatusCodes . OK ] : RegistrationOptionsResponseSchema ,
19+ [ StatusCodes . OK ] : z . any ( ) ,
2120 [ StatusCodes . NOT_FOUND ] : z . object ( {
2221 message : z . string ( ) ,
2322 } ) ,
@@ -46,10 +45,10 @@ export default async function (fastify, _opts) {
4645 id : passkey . id ,
4746 transports : passkey . transports ? [ passkey . transports ] : undefined ,
4847 } ) ) ,
48+ preferredAuthenticatorType : 'localDevice' ,
4949 authenticatorSelection : {
50- residentKey : 'preferred' ,
5150 userVerification : 'required' ,
52- authenticatorAttachment : 'platform '
51+ residentKey : 'required '
5352 } ,
5453 } ) ;
5554
@@ -67,7 +66,6 @@ export default async function (fastify, _opts) {
6766 expiresAt,
6867 } ,
6968 } ) ;
70- console . log ( 'options' , options ) ;
7169 return reply . send ( options ) ;
7270 }
7371 ) ;
0 commit comments