File tree Expand file tree Collapse file tree 3 files changed +30
-3
lines changed Expand file tree Collapse file tree 3 files changed +30
-3
lines changed Original file line number Diff line number Diff line change @@ -371,7 +371,7 @@ async function parseAuthnrAssertionResponse(msg) {
371
371
}
372
372
373
373
let userHandle ;
374
- if ( msg . response . userHandle !== undefined ) {
374
+ if ( msg . response . userHandle !== undefined && msg . response . userHandle !== null ) {
375
375
userHandle = coerceToArrayBuffer ( msg . response . userHandle , "response.userHandle" ) ;
376
376
if ( userHandle . byteLength === 0 ) {
377
377
userHandle = undefined ;
Original file line number Diff line number Diff line change @@ -220,7 +220,7 @@ function validateAssertionResponse() {
220
220
221
221
if ( typeof req . response . userHandle !== "string" &&
222
222
! ( req . response . userHandle instanceof ArrayBuffer ) &&
223
- req . response . userHandle !== undefined ) {
223
+ req . response . userHandle !== undefined && req . response . userHandle !== null ) {
224
224
throw new TypeError ( "expected 'response.userHandle' to be base64 String, ArrayBuffer, or undefined" ) ;
225
225
}
226
226
Original file line number Diff line number Diff line change @@ -687,7 +687,34 @@ describe("Fido2Lib", function() {
687
687
clientDataJSON : h . lib . assertionResponse . response . clientDataJSON ,
688
688
authenticatorData : h . lib . assertionResponse . response . authenticatorData ,
689
689
signature : h . lib . assertionResponse . response . signature ,
690
- // userHandle: h.lib.assertionResponse.response.userHandle
690
+ } ,
691
+ } ;
692
+
693
+ return serv . assertionResult ( assertionResponse , expectations ) . then (
694
+ ( res ) => {
695
+ assert . instanceOf ( res , Fido2AssertionResult ) ;
696
+ return res ;
697
+ } ,
698
+ ) ;
699
+ } ) ;
700
+
701
+ it ( "valid assertion with null userHandle" , function ( ) {
702
+ const expectations = {
703
+ challenge : "eaTyUNnyPDDdK8SNEgTEUvz1Q8dylkjjTimYd5X7QAo-F8_Z1lsJi3BilUpFZHkICNDWY8r9ivnTgW7-XZC3qQ" ,
704
+ origin : "https://localhost:8443" ,
705
+ factor : "either" ,
706
+ publicKey : h . lib . assnPublicKey ,
707
+ prevCounter : 362 ,
708
+ userHandle : null ,
709
+ } ;
710
+
711
+ const assertionResponse = {
712
+ rawId : h . lib . assertionResponse . rawId ,
713
+ response : {
714
+ clientDataJSON : h . lib . assertionResponse . response . clientDataJSON ,
715
+ authenticatorData : h . lib . assertionResponse . response . authenticatorData ,
716
+ signature : h . lib . assertionResponse . response . signature ,
717
+ userHandle : null ,
691
718
} ,
692
719
} ;
693
720
You can’t perform that action at this time.
0 commit comments