From 408cccf7b2718acef0a1b001540a2e0ad3e7b4bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Andr=C3=A9s=20Dorado=20Su=C3=A1rez?= Date: Mon, 18 Nov 2024 16:45:07 -0500 Subject: [PATCH] feat(verifier): add information logs --- Cargo.lock | 1 + verifier/Cargo.toml | 3 ++- verifier/src/lib.rs | 8 ++++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 7dc0f1c..5fe4874 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3861,6 +3861,7 @@ name = "verifier" version = "0.1.0" dependencies = [ "coset", + "log", "p256", "passkey-authenticator", "rand", diff --git a/verifier/Cargo.toml b/verifier/Cargo.toml index 4840685..dd2a4ca 100644 --- a/verifier/Cargo.toml +++ b/verifier/Cargo.toml @@ -7,6 +7,7 @@ repository.workspace = true version = "0.1.0" [dependencies] +log.workspace = true p256 = { workspace = true, features = ["ecdsa", "pkcs8"] } sha2.workspace = true @@ -17,4 +18,4 @@ rand.workspace = true [features] default = ["std"] -std = ["coset/std", "p256/std", "rand/std", "sha2/std"] +std = ["coset/std", "log/std", "p256/std", "rand/std", "sha2/std"] diff --git a/verifier/src/lib.rs b/verifier/src/lib.rs index 4c486c5..b623778 100644 --- a/verifier/src/lib.rs +++ b/verifier/src/lib.rs @@ -66,6 +66,8 @@ pub enum VerifyError { VerifySignature, } +const LOG_TARGET: &str = "verifier::verify_signature"; + pub fn webauthn_verify( authenticator_data: &[u8], client_data_json: &[u8], @@ -89,6 +91,12 @@ pub fn webauthn_verify( let signature = DerSignature::try_from(signature_der).map_err(|_| VerifyError::ParseSignature)?; + log::trace!( + "Run WebAuthn verify_signature: message={:?}, public_key={:?}, signature={:?}", + &message, + &public_key, + &signature + ); // Step 5: Verify the signature verifying_key .verify(&message, &signature)