@@ -51,6 +51,11 @@ import com.yubico.webauthn.data.Extensions.Prf.PrfRegistrationInput
5151import com .yubico .webauthn .data .Extensions .Prf .PrfRegistrationOutput
5252import com .yubico .webauthn .data .Extensions .Prf .PrfValues
5353import com .yubico .webauthn .data .Extensions .Spc .BrowserBoundSignature
54+ import com .yubico .webauthn .data .Extensions .Spc .SpcAuthenticationInput
55+ import com .yubico .webauthn .data .Extensions .Spc .SpcAuthenticationInput .PaymentCredentialInstrument
56+ import com .yubico .webauthn .data .Extensions .Spc .SpcAuthenticationInput .PaymentCurrencyAmount
57+ import com .yubico .webauthn .data .Extensions .Spc .SpcAuthenticationInput .PaymentEntityLogo
58+ import com .yubico .webauthn .data .Extensions .Spc .SpcAuthenticationOutput
5459import com .yubico .webauthn .data .Extensions .Spc .SpcRegistrationInput
5560import com .yubico .webauthn .data .Extensions .Spc .SpcRegistrationOutput
5661import com .yubico .webauthn .data .Extensions .Uvm .UvmEntry
@@ -1097,12 +1102,69 @@ object Generators {
10971102
10981103 def registrationOutput : Gen [SpcRegistrationOutput ] =
10991104 for {
1100- browserBoundSignature <- browserBoundSignature
1101- } yield new SpcRegistrationOutput (browserBoundSignature)
1105+ browserBoundSignature <- Gen .option( browserBoundSignature)
1106+ } yield new SpcRegistrationOutput (browserBoundSignature.orNull )
11021107
11031108 implicit val arbitrarySpcRegistrationOutput
11041109 : Arbitrary [SpcRegistrationOutput ] = Arbitrary (registrationOutput)
11051110
1111+ def paymentEntityLogo : Gen [PaymentEntityLogo ] =
1112+ for {
1113+ url <- arbitrary[String ]
1114+ label <- arbitrary[String ]
1115+ } yield new PaymentEntityLogo (url, label)
1116+
1117+ def paymentCurrencyAmount : Gen [PaymentCurrencyAmount ] =
1118+ for {
1119+ currency <- arbitrary[String ]
1120+ value <- arbitrary[String ]
1121+ } yield new PaymentCurrencyAmount (currency, value)
1122+
1123+ def paymentCredentialInstrument : Gen [PaymentCredentialInstrument ] =
1124+ for {
1125+ displayName <- arbitrary[String ]
1126+ icon <- arbitrary[String ]
1127+ details <- arbitrary[Option [String ]]
1128+ } yield new PaymentCredentialInstrument (
1129+ displayName,
1130+ icon,
1131+ details.orNull,
1132+ )
1133+
1134+ def authenticationInput : Gen [SpcAuthenticationInput ] =
1135+ for {
1136+ isPayment <- arbitrary[Option [java.lang.Boolean ]]
1137+ browserBoundPubKeyCredParams <- browserBoundPubKeyCredParams
1138+ rpId <- arbitrary[Option [String ]]
1139+ topOrigin <- arbitrary[Option [String ]]
1140+ payeeName <- arbitrary[Option [String ]]
1141+ payeeOrigin <- arbitrary[Option [String ]]
1142+ paymentEntitiesLogos <- Gen .listOf(paymentEntityLogo).map(_.asJava)
1143+ total <- Gen .option(paymentCurrencyAmount)
1144+ instrument <- Gen .option(paymentCredentialInstrument)
1145+ } yield SpcAuthenticationInput
1146+ .builder()
1147+ .isPayment(isPayment.orNull)
1148+ .browserBoundPubKeyCredParams(browserBoundPubKeyCredParams)
1149+ .rpId(rpId.orNull)
1150+ .topOrigin(topOrigin.orNull)
1151+ .payeeName(payeeName.orNull)
1152+ .payeeOrigin(payeeOrigin.orNull)
1153+ .paymentEntitiesLogos(paymentEntitiesLogos)
1154+ .total(total.orNull)
1155+ .instrument(instrument.orNull)
1156+ .build()
1157+
1158+ implicit val arbitrarySpcAuthenticationInput
1159+ : Arbitrary [SpcAuthenticationInput ] = Arbitrary (authenticationInput)
1160+
1161+ def authenticationOutput : Gen [SpcAuthenticationOutput ] =
1162+ for {
1163+ browserBoundSignature <- Gen .option(browserBoundSignature)
1164+ } yield new SpcAuthenticationOutput (browserBoundSignature.orNull)
1165+
1166+ implicit val arbitrarySpcAuthenticationOutput
1167+ : Arbitrary [SpcAuthenticationOutput ] = Arbitrary (authenticationOutput)
11061168 }
11071169
11081170 object Uvm {
0 commit comments