@@ -47,29 +47,26 @@ const schema = {
4747export type PasskeyFinalizeRegistrationApi = GetApiTypes < typeof schema > ;
4848
4949const route : FastifyPluginAsyncTypebox = async fastify => {
50- fastify . post (
51- '/finalize-registration' ,
52- {
53- schema,
54- preValidation : ( req , reply ) => fastify . authorize ( req , reply ) ,
55- } ,
56- async request => {
57- // const {appUser} = request;
58- return fastify . passkeysApi . registration . finalize ( {
59- rawId : request . body . rawId ,
60- type : request . body . type ,
61- transports : request . body . transports ,
62- authenticatorAttachment : request . body . authenticatorAttachment ,
63- id : request . body . id ,
64- clientExtensionResults : request . body . clientExtensionResults ,
65- response : {
66- transports : request . body . response . transports ,
67- clientDataJSON : request . body . response . clientDataJSON ,
68- attestationObject : request . body . response . attestationObject ,
69- } ,
70- } ) ;
71- } ,
50+ fastify . addHook (
51+ 'preValidation' ,
52+ fastify . authorize ( { mustBeAuthenticated : true } ) ,
7253 ) ;
54+ fastify . post ( '/finalize-registration' , { schema} , async request => {
55+ // const {appUser} = request;
56+ return fastify . passkeysApi . registration . finalize ( {
57+ rawId : request . body . rawId ,
58+ type : request . body . type ,
59+ transports : request . body . transports ,
60+ authenticatorAttachment : request . body . authenticatorAttachment ,
61+ id : request . body . id ,
62+ clientExtensionResults : request . body . clientExtensionResults ,
63+ response : {
64+ transports : request . body . response . transports ,
65+ clientDataJSON : request . body . response . clientDataJSON ,
66+ attestationObject : request . body . response . attestationObject ,
67+ } ,
68+ } ) ;
69+ } ) ;
7370} ;
7471
7572export default route ;
0 commit comments