@@ -180,7 +180,7 @@ async function updateFIDO2CredentialNickname(username, body) {
180180 const payload = JSON . stringify ( {
181181 "type" : "updateCredentialNickname" ,
182182 "username" : username ,
183- "credentialId" : data . credential . credentialId . base64 ,
183+ "credentialId" : data . credential . credentialId . base64url ,
184184 "nickname" : data . credentialNickname . value ,
185185 } ) ;
186186 console . log ( "updateCredentialNickname request payload: " + payload ) ;
@@ -264,15 +264,15 @@ async function startUsernamelessAuthentication() {
264264 let startAuthPayload = JSON . parse ( JSON . parse ( response . Payload ) ) ;
265265 console . log ( "startAuthPayload: " , startAuthPayload ) ;
266266
267- startAuthPayload . requestId = startAuthPayload . requestId . base64 ;
267+ startAuthPayload . requestId = startAuthPayload . requestId . base64url ;
268268 console . log ( "requestId: " , startAuthPayload . requestId ) ;
269269 startAuthPayload . publicKeyCredentialRequestOptions . userVerification = startAuthPayload . publicKeyCredentialRequestOptions . userVerification . toLowerCase ( ) ;
270- startAuthPayload . publicKeyCredentialRequestOptions . challenge = startAuthPayload . publicKeyCredentialRequestOptions . challenge . base64 ;
270+ startAuthPayload . publicKeyCredentialRequestOptions . challenge = startAuthPayload . publicKeyCredentialRequestOptions . challenge . base64url ;
271271 console . log ( "challenge: " , startAuthPayload . publicKeyCredentialRequestOptions . challenge ) ;
272272 if ( startAuthPayload . publicKeyCredentialRequestOptions . allowCredentials ) {
273273 startAuthPayload . publicKeyCredentialRequestOptions . allowCredentials = startAuthPayload . publicKeyCredentialRequestOptions . allowCredentials . map ( ( cred ) => {
274274 cred . type = cred . type . toLowerCase ( ) . replace ( '_' , '-' ) ;
275- cred . id = cred . id . base64 ;
275+ cred . id = cred . id . url ;
276276 return cred
277277 } ) ;
278278 }
@@ -289,18 +289,11 @@ async function startUsernamelessAuthentication() {
289289async function startRegisterFIDO2Credential ( profile , body , uid ) {
290290 console . log ( "startRegisterFIDO2Credential userId: " + profile . id + " body:" , body ) ;
291291 const jsonBody = JSON . parse ( body ) ;
292-
293- let invalidResult = validate ( { nickname : jsonBody . nickname } , constraints ) ;
294- console . log ( "nickname invalidResult: " , invalidResult ) ;
295- if ( invalidResult && invalidResult . nickname ) {
296- return error ( invalidResult . nickname . join ( ". " ) ) ;
297- }
298292
299293 const payload = JSON . stringify ( {
300294 "type" : "startRegistration" ,
301295 "username" : profile . username ,
302296 "displayName" : profile . username ,
303- "credentialNickname" : jsonBody . nickname ,
304297 "requireResidentKey" : jsonBody . requireResidentKey ,
305298 "requireAuthenticatorAttachment" : jsonBody . requireAuthenticatorAttachment ,
306299 "uid" : uid
@@ -322,14 +315,13 @@ async function startRegisterFIDO2Credential(profile, body, uid) {
322315
323316 const coseLookup = { "ES256" : - 7 , "EdDSA" : - 8 , "RS256" : - 257 } ;
324317
325- startRegisterPayload . requestId = startRegisterPayload . requestId . base64 ;
326- startRegisterPayload . publicKeyCredentialCreationOptions . user . id = startRegisterPayload . publicKeyCredentialCreationOptions . user . id . base64 ;
327- startRegisterPayload . publicKeyCredentialCreationOptions . challenge = startRegisterPayload . publicKeyCredentialCreationOptions . challenge . base64 ;
318+ startRegisterPayload . requestId = startRegisterPayload . requestId . base64url ;
319+ startRegisterPayload . publicKeyCredentialCreationOptions . user . id = startRegisterPayload . publicKeyCredentialCreationOptions . user . id . base64url ;
320+ startRegisterPayload . publicKeyCredentialCreationOptions . challenge = startRegisterPayload . publicKeyCredentialCreationOptions . challenge . base64url ;
328321 startRegisterPayload . publicKeyCredentialCreationOptions . attestation = startRegisterPayload . publicKeyCredentialCreationOptions . attestation . toLowerCase ( ) ;
329322 startRegisterPayload . publicKeyCredentialCreationOptions . authenticatorSelection . userVerification = startRegisterPayload . publicKeyCredentialCreationOptions . authenticatorSelection . userVerification . toLowerCase ( ) ;
330323 startRegisterPayload . publicKeyCredentialCreationOptions . authenticatorSelection . residentKey = startRegisterPayload . publicKeyCredentialCreationOptions . authenticatorSelection . residentKey . toLowerCase ( ) ;
331- startRegisterPayload . publicKeyCredentialCreationOptions . authenticatorSelection . requireResidentKey = false ;
332- if ( startRegisterPayload . publicKeyCredentialCreationOptions . authenticatorSelection . residentKey === "required" ) {
324+ if ( startRegisterPayload . requireResidentKey ) {
333325 startRegisterPayload . publicKeyCredentialCreationOptions . authenticatorSelection . requireResidentKey = true ;
334326 }
335327 startRegisterPayload . publicKeyCredentialCreationOptions . authenticatorSelection . authenticatorAttachment = authSelectorResolve [ startRegisterPayload . publicKeyCredentialCreationOptions . authenticatorSelection . authenticatorAttachment ] ;
@@ -341,7 +333,7 @@ async function startRegisterFIDO2Credential(profile, body, uid) {
341333 } ) ;
342334 startRegisterPayload . publicKeyCredentialCreationOptions . excludeCredentials = startRegisterPayload . publicKeyCredentialCreationOptions . excludeCredentials . map ( ( cred ) => {
343335 cred . type = cred . type . toLowerCase ( ) . replace ( '_' , '-' ) ;
344- cred . id = cred . id . base64 ;
336+ cred . id = cred . id . base64url ;
345337 console . log ( "cred: " + JSON . stringify ( cred ) ) ;
346338 return cred ;
347339 } ) ;
0 commit comments