Skip to content

A platform for community discussion. Free, open, simple.

FIX: passkey authentication fails for EdDSA-based authenticators (#38328)

Keegan Georgeeee6341054eb
diff --git a/lib/discourse_webauthn/authentication_service.rb b/lib/discourse_webauthn/authentication_service.rb
index 0cb0c33ff0a..1fc5b42e236 100644
--- a/lib/discourse_webauthn/authentication_service.rb
+++ b/lib/discourse_webauthn/authentication_service.rb
@@ -95,11 +95,9 @@ module DiscourseWebauthn
raise(UnknownCOSEAlgorithmError, I18n.t("webauthn.validation.unknown_cose_algorithm_error"))
end
- if !cose_key.to_pkey.verify(
- cose_algorithm.hash_function,
- signature,
- auth_data + client_data_hash,
- )
+ begin
+ cose_algorithm.verify(cose_key, signature, auth_data + client_data_hash)
+ rescue COSE::Error
raise(PublicKeyError, I18n.t("webauthn.validation.public_key_error"))
end