From 0e5d64ddfdea442753b851c70f9f94d0d05c5335 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Wed, 4 Dec 2024 11:39:04 -0800 Subject: [PATCH] Test Ed25519 alg in reg options --- .../homepage/tests/test_registration_service.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/_app/homepage/tests/test_registration_service.py b/_app/homepage/tests/test_registration_service.py index 48d2835..b3d85de 100644 --- a/_app/homepage/tests/test_registration_service.py +++ b/_app/homepage/tests/test_registration_service.py @@ -55,3 +55,20 @@ def test_generate_options(self): UserVerificationRequirement.DISCOURAGED, ) + def test_options_pub_key_alg_ed25519_is_first(self): + options = self.service.generate_registration_options( + username="mmiller", + algorithms=["ed25519", "es256"], + attachment="", + attestation="", + discoverable_credential="", + existing_credentials=[], + hints=[], + user_verification="", + ) + + self.assertEqual(len(options.pub_key_cred_params), 2) + self.assertEqual( + options.pub_key_cred_params[0], + PublicKeyCredentialParameters(alg=COSEAlgorithmIdentifier.EDDSA, type="public-key"), + )