1
1
package com .yubico .fido .metadata
2
2
3
+ import com .yubico .scalacheck .gen .GenUtil .maxSized
3
4
import com .yubico .scalacheck .gen .JavaGenerators .arbitraryUrl
4
5
import com .yubico .webauthn .TestAuthenticator
5
6
import com .yubico .webauthn .data .AuthenticatorTransport
@@ -29,15 +30,11 @@ object Generators {
29
30
alg <- arbitrary[String ]
30
31
typ <- Gen .option(Gen .const(" JWT" ))
31
32
x5u <- arbitrary[Option [URL ]]
32
- x5c <- Gen .option(
33
- Gen
34
- .chooseNum(0 , 4 )
35
- .flatMap(n =>
36
- Gen .listOfN(
37
- n,
38
- TestAuthenticator .generateAttestationCertificate()._1,
39
- )
40
- )
33
+ x5c <- maxSized(
34
+ 4 ,
35
+ Gen .option(
36
+ Gen .listOf(TestAuthenticator .generateAttestationCertificate()._1)
37
+ ),
41
38
)
42
39
} yield MetadataBLOBHeader
43
40
.builder()
@@ -54,15 +51,7 @@ object Generators {
54
51
legalHeader <- arbitrary[Option [String ]]
55
52
no <- arbitrary[Int ]
56
53
nextUpdate <- arbitrary[LocalDate ]
57
- entries <-
58
- Gen
59
- .chooseNum(0 , 4 )
60
- .flatMap(n =>
61
- Gen .containerOfN[Set , MetadataBLOBPayloadEntry ](
62
- n,
63
- arbitrary[MetadataBLOBPayloadEntry ],
64
- )
65
- )
54
+ entries <- maxSized(4 , arbitrary[Set [MetadataBLOBPayloadEntry ]])
66
55
} yield new MetadataBLOBPayload (
67
56
legalHeader.orNull,
68
57
no,
@@ -161,15 +150,12 @@ object Generators {
161
150
tcDisplayContentType <- arbitrary[Option [String ]]
162
151
tcDisplayPNGCharacteristics <-
163
152
arbitrary[Option [List [DisplayPNGCharacteristicsDescriptor ]]]
164
- attestationRootCertificates <-
165
- Gen
166
- .chooseNum(0 , 4 )
167
- .flatMap(n =>
168
- Gen .containerOfN[Set , X509Certificate ](
169
- n,
170
- TestAuthenticator .generateAttestationCaCertificate()._1,
171
- )
172
- )
153
+ attestationRootCertificates <- maxSized(
154
+ 4 ,
155
+ Gen .containerOf[Set , X509Certificate ](
156
+ TestAuthenticator .generateAttestationCaCertificate()._1
157
+ ),
158
+ )
173
159
icon <- arbitrary[Option [String ]]
174
160
supportedExtensions <- arbitrary[Option [Set [ExtensionDescriptor ]]]
175
161
authenticatorGetInfo <- arbitrary[Option [AuthenticatorGetInfo ]]
0 commit comments