Skip to content

Commit

Permalink
feat(verifier): add information logs
Browse files Browse the repository at this point in the history
  • Loading branch information
pandres95 committed Nov 18, 2024
1 parent b16867d commit 408cccf
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion verifier/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ repository.workspace = true
version = "0.1.0"

[dependencies]
log.workspace = true
p256 = { workspace = true, features = ["ecdsa", "pkcs8"] }
sha2.workspace = true

Expand All @@ -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"]
8 changes: 8 additions & 0 deletions verifier/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ pub enum VerifyError {
VerifySignature,
}

const LOG_TARGET: &str = "verifier::verify_signature";

Check warning on line 69 in verifier/src/lib.rs

View workflow job for this annotation

GitHub Actions / clippy

constant `LOG_TARGET` is never used

warning: constant `LOG_TARGET` is never used --> verifier/src/lib.rs:69:7 | 69 | const LOG_TARGET: &str = "verifier::verify_signature"; | ^^^^^^^^^^ | = note: `#[warn(dead_code)]` on by default

pub fn webauthn_verify(
authenticator_data: &[u8],
client_data_json: &[u8],
Expand All @@ -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)
Expand Down

0 comments on commit 408cccf

Please sign in to comment.