@@ -51,6 +51,11 @@ import com.yubico.webauthn.data.Extensions.Prf.PrfRegistrationInput
51
51
import com .yubico .webauthn .data .Extensions .Prf .PrfRegistrationOutput
52
52
import com .yubico .webauthn .data .Extensions .Prf .PrfValues
53
53
import 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
54
59
import com .yubico .webauthn .data .Extensions .Spc .SpcRegistrationInput
55
60
import com .yubico .webauthn .data .Extensions .Spc .SpcRegistrationOutput
56
61
import com .yubico .webauthn .data .Extensions .Uvm .UvmEntry
@@ -1097,12 +1102,69 @@ object Generators {
1097
1102
1098
1103
def registrationOutput : Gen [SpcRegistrationOutput ] =
1099
1104
for {
1100
- browserBoundSignature <- browserBoundSignature
1101
- } yield new SpcRegistrationOutput (browserBoundSignature)
1105
+ browserBoundSignature <- Gen .option( browserBoundSignature)
1106
+ } yield new SpcRegistrationOutput (browserBoundSignature.orNull )
1102
1107
1103
1108
implicit val arbitrarySpcRegistrationOutput
1104
1109
: Arbitrary [SpcRegistrationOutput ] = Arbitrary (registrationOutput)
1105
1110
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)
1106
1168
}
1107
1169
1108
1170
object Uvm {
0 commit comments