@@ -164,6 +164,7 @@ class RelyingPartyRegistrationSpec
164164 pubkeyCredParams : Option [List [PublicKeyCredentialParameters ]] = None ,
165165 testData : RegistrationTestData ,
166166 clock : Clock = Clock .systemUTC(),
167+ isConditionalCreate : Boolean = false ,
167168 ): FinishRegistrationSteps = {
168169 var builder = RelyingParty
169170 .builder()
@@ -191,6 +192,7 @@ class RelyingPartyRegistrationSpec
191192 )
192193 .response(testData.response)
193194 .callerTokenBindingId(callerTokenBindingId.toJava)
195+ .isConditionalCreate(isConditionalCreate)
194196 .build()
195197
196198 builder
@@ -873,6 +875,7 @@ class RelyingPartyRegistrationSpec
873875 )(chk : Step => B )(
874876 uvr : UserVerificationRequirement ,
875877 authDataEdit : ByteArray => ByteArray ,
878+ isConditionalCreate : Boolean ,
876879 ): B = {
877880 val steps = finishRegistration(
878881 testData = testData
@@ -884,14 +887,19 @@ class RelyingPartyRegistrationSpec
884887 .build()
885888 )
886889 )
887- .editAuthenticatorData(authDataEdit)
890+ .editAuthenticatorData(authDataEdit),
891+ isConditionalCreate = isConditionalCreate,
888892 )
889893 chk(stepsToStep(steps))
890894 }
891895
892896 def checkFailsWith (
893897 stepsToStep : FinishRegistrationSteps => Step
894- ): (UserVerificationRequirement , ByteArray => ByteArray ) => Unit =
898+ ): (
899+ UserVerificationRequirement ,
900+ ByteArray => ByteArray ,
901+ Boolean ,
902+ ) => Unit =
895903 check(stepsToStep) { step =>
896904 step.validations shouldBe a[Failure [_]]
897905 step.validations.failed.get shouldBe an[
@@ -902,7 +910,11 @@ class RelyingPartyRegistrationSpec
902910
903911 def checkSucceedsWith (
904912 stepsToStep : FinishRegistrationSteps => Step
905- ): (UserVerificationRequirement , ByteArray => ByteArray ) => Unit =
913+ ): (
914+ UserVerificationRequirement ,
915+ ByteArray => ByteArray ,
916+ Boolean ,
917+ ) => Unit =
906918 check(stepsToStep) { step =>
907919 step.validations shouldBe a[Success [_]]
908920 step.tryNext shouldBe a[Success [_]]
@@ -912,15 +924,41 @@ class RelyingPartyRegistrationSpec
912924 }
913925
914926 describe(" 14. Verify that the User Present bit of the flags in authData is set." ) {
915- val (checkFails, checkSucceeds ) = checks[
927+ val (chkf, chks ) = checks[
916928 FinishRegistrationSteps # Step15 ,
917929 FinishRegistrationSteps # Step14 ,
918930 ](_.begin.next.next.next.next.next.next.next.next)
931+ def checkFails (
932+ uvr : UserVerificationRequirement ,
933+ authDataEdit : ByteArray => ByteArray ,
934+ isConditionalCreate : Boolean = false ,
935+ ): Unit = chkf(uvr, authDataEdit, isConditionalCreate)
936+ def checkSucceeds (
937+ uvr : UserVerificationRequirement ,
938+ authDataEdit : ByteArray => ByteArray ,
939+ isConditionalCreate : Boolean = false ,
940+ ): Unit = chks(uvr, authDataEdit, isConditionalCreate)
919941
920942 it(" Fails if UV is discouraged and flag is not set." ) {
921943 checkFails(UserVerificationRequirement .DISCOURAGED , upOff)
922944 }
923945
946+ it(" Fails if UV is discouraged, isConditionalCreate is false and flag is not set." ) {
947+ checkFails(
948+ UserVerificationRequirement .DISCOURAGED ,
949+ upOff,
950+ isConditionalCreate = false ,
951+ )
952+ }
953+
954+ it(" Succeeds if UV is discouraged, isConditionalCreate is true and flag is not set." ) {
955+ checkSucceeds(
956+ UserVerificationRequirement .DISCOURAGED ,
957+ upOff,
958+ isConditionalCreate = true ,
959+ )
960+ }
961+
924962 it(" Succeeds if UV is discouraged and flag is set." ) {
925963 checkSucceeds(UserVerificationRequirement .DISCOURAGED , upOn)
926964 }
@@ -949,10 +987,20 @@ class RelyingPartyRegistrationSpec
949987 }
950988
951989 describe(" 15. If user verification is required for this registration, verify that the User Verified bit of the flags in authData is set." ) {
952- val (checkFails, checkSucceeds ) = checks[
990+ val (chkf, chks ) = checks[
953991 FinishRegistrationSteps # Step16 ,
954992 FinishRegistrationSteps # Step15 ,
955993 ](_.begin.next.next.next.next.next.next.next.next.next)
994+ def checkFails (
995+ uvr : UserVerificationRequirement ,
996+ authDataEdit : ByteArray => ByteArray ,
997+ isConditionalCreate : Boolean = false ,
998+ ): Unit = chkf(uvr, authDataEdit, isConditionalCreate)
999+ def checkSucceeds (
1000+ uvr : UserVerificationRequirement ,
1001+ authDataEdit : ByteArray => ByteArray ,
1002+ isConditionalCreate : Boolean = false ,
1003+ ): Unit = chks(uvr, authDataEdit, isConditionalCreate)
9561004
9571005 it(" Succeeds if UV is discouraged and flag is not set." ) {
9581006 checkSucceeds(UserVerificationRequirement .DISCOURAGED , uvOff)
0 commit comments