Skip to content

Commit

Permalink
Use VM jwk crv instead of alg
Browse files Browse the repository at this point in the history
  • Loading branch information
KendallWeihe committed Sep 21, 2024
1 parent d8504f0 commit 2041c15
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions crates/web5/src/jose.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,17 +160,9 @@ impl Jws {
verification_method_id: Some(kid.clone()),
})?
.public_key_jwk;
let verifier: Arc<dyn Verifier> = match &public_jwk.alg {
None => {
return Err(Web5Error::Parameter(format!(
"verification method jwk alg must be set {}",
kid
)))
}
Some(alg) => match Dsa::from_str(alg)? {
Dsa::Ed25519 => Arc::new(Ed25519Verifier::new(public_jwk)),
Dsa::Secp256k1 => Arc::new(Secp256k1Verifier::new(public_jwk)),
},
let verifier: Arc<dyn Verifier> = match Dsa::from_str(&public_jwk.crv)? {
Dsa::Ed25519 => Arc::new(Ed25519Verifier::new(public_jwk)),
Dsa::Secp256k1 => Arc::new(Secp256k1Verifier::new(public_jwk)),
};

let payload = format!("{}.{}", parts[0], parts[1]);
Expand Down

0 comments on commit 2041c15

Please sign in to comment.