Skip to content

Commit 7468157

Browse files
committed
Add test for Ed448 in RelyingPartyV2RegistrationSpec
1 parent 262f831 commit 7468157

1 file changed

Lines changed: 48 additions & 0 deletions

File tree

webauthn-server-core/src/test/scala/com/yubico/webauthn/RelyingPartyV2RegistrationSpec.scala

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4323,6 +4323,54 @@ class RelyingPartyV2RegistrationSpec
43234323
}
43244324
}
43254325

4326+
it("Ed448, when available.") {
4327+
// The RelyingParty constructor call needs to be here inside the `it` call in order to have the right JCA provider environment
4328+
val rp = RelyingParty
4329+
.builder()
4330+
.identity(
4331+
RelyingPartyIdentity
4332+
.builder()
4333+
.id("localhost")
4334+
.name("Test party")
4335+
.build()
4336+
)
4337+
.credentialRepositoryV2(Helpers.CredentialRepositoryV2.empty)
4338+
.build()
4339+
4340+
val pkcco = rp.startRegistration(
4341+
StartRegistrationOptions
4342+
.builder()
4343+
.user(
4344+
UserIdentity
4345+
.builder()
4346+
.name("foo")
4347+
.displayName("Foo")
4348+
.id(ByteArray.fromHex("aabbccdd"))
4349+
.build()
4350+
)
4351+
.build()
4352+
)
4353+
4354+
val pubKeyCredParams = pkcco.getPubKeyCredParams.asScala
4355+
4356+
if (Try(KeyFactory.getInstance("EdDSA")).isSuccess) {
4357+
pubKeyCredParams should contain(
4358+
PublicKeyCredentialParameters.Ed448
4359+
)
4360+
pubKeyCredParams map (_.getAlg) should contain(
4361+
COSEAlgorithmIdentifier.Ed448
4362+
)
4363+
} else {
4364+
pubKeyCredParams should not contain (
4365+
PublicKeyCredentialParameters.Ed448
4366+
)
4367+
pubKeyCredParams map (_.getAlg) should not contain (
4368+
COSEAlgorithmIdentifier.Ed448
4369+
)
4370+
}
4371+
4372+
}
4373+
43264374
it("RS256.") {
43274375
pubKeyCredParams should contain(
43284376
PublicKeyCredentialParameters.RS256

0 commit comments

Comments
 (0)