Skip to content

Commit 7239be2

Browse files
committed
Add test for Ed448 in RelyingPartyRegistrationSpec
1 parent 6ae9923 commit 7239be2

1 file changed

Lines changed: 46 additions & 0 deletions

File tree

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

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4377,6 +4377,52 @@ class RelyingPartyRegistrationSpec
43774377
}
43784378
}
43794379

4380+
it("Ed448, when available.") {
4381+
// The RelyingParty constructor call needs to be here inside the `it` call in order to have the right JCA provider environment
4382+
val rp = RelyingParty
4383+
.builder()
4384+
.identity(
4385+
RelyingPartyIdentity
4386+
.builder()
4387+
.id("localhost")
4388+
.name("Test party")
4389+
.build()
4390+
)
4391+
.credentialRepository(Helpers.CredentialRepository.empty)
4392+
.build()
4393+
4394+
val pkcco = rp.startRegistration(
4395+
StartRegistrationOptions
4396+
.builder()
4397+
.user(
4398+
UserIdentity
4399+
.builder()
4400+
.name("foo")
4401+
.displayName("Foo")
4402+
.id(ByteArray.fromHex("aabbccdd"))
4403+
.build()
4404+
)
4405+
.build()
4406+
)
4407+
val pubKeyCredParams = pkcco.getPubKeyCredParams.asScala
4408+
4409+
if (Try(KeyFactory.getInstance("EdDSA")).isSuccess) {
4410+
pubKeyCredParams should contain(
4411+
PublicKeyCredentialParameters.Ed448
4412+
)
4413+
pubKeyCredParams map (_.getAlg) should contain(
4414+
COSEAlgorithmIdentifier.Ed448
4415+
)
4416+
} else {
4417+
pubKeyCredParams should not contain (
4418+
PublicKeyCredentialParameters.Ed448
4419+
)
4420+
pubKeyCredParams map (_.getAlg) should not contain (
4421+
COSEAlgorithmIdentifier.Ed448
4422+
)
4423+
}
4424+
}
4425+
43804426
it("RS256.") {
43814427
pubKeyCredParams should contain(
43824428
PublicKeyCredentialParameters.RS256

0 commit comments

Comments
 (0)