Skip to content

Commit 89e78ff

Browse files
committed
Generate PublicKeyCredentialRequestOptions using both List<String> and PublicKeyCredentialHint...
1 parent a5c0d1c commit 89e78ff

File tree

1 file changed

+19
-11
lines changed

1 file changed

+19
-11
lines changed

webauthn-server-core/src/test/scala/com/yubico/webauthn/data/Generators.scala

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1145,18 +1145,26 @@ object Generators {
11451145
extensions <- arbitrary[AssertionExtensionInputs]
11461146
rpId <- arbitrary[Optional[String]]
11471147
timeout <- arbitrary[Optional[java.lang.Long]]
1148-
hints <- arbitrary[Option[List[String]]]
1148+
hints <-
1149+
arbitrary[Option[Either[List[String], List[PublicKeyCredentialHint]]]]
11491150
userVerification <- arbitrary[UserVerificationRequirement]
1150-
} yield PublicKeyCredentialRequestOptions
1151-
.builder()
1152-
.challenge(challenge)
1153-
.allowCredentials(allowCredentials)
1154-
.extensions(extensions)
1155-
.rpId(rpId)
1156-
.timeout(timeout)
1157-
.hints(hints.map(_.asJava).orNull)
1158-
.userVerification(userVerification)
1159-
.build()
1151+
} yield {
1152+
val b = PublicKeyCredentialRequestOptions
1153+
.builder()
1154+
.challenge(challenge)
1155+
.allowCredentials(allowCredentials)
1156+
.extensions(extensions)
1157+
.rpId(rpId)
1158+
.timeout(timeout)
1159+
.userVerification(userVerification)
1160+
1161+
hints.foreach {
1162+
case Left(h) => b.hints(h.asJava)
1163+
case Right(h) => b.hints(h: _*)
1164+
}
1165+
1166+
b.build()
1167+
}
11601168
)
11611169
)
11621170

0 commit comments

Comments
 (0)