diff --git a/jwt/Cargo.toml b/jwt/Cargo.toml index 380bd3e1..e76d2f51 100644 --- a/jwt/Cargo.toml +++ b/jwt/Cargo.toml @@ -14,11 +14,11 @@ crate-type = ["cdylib", "rlib"] [dependencies] thiserror = "1" serde = "1" -base64 = "0.21.0" +base64 = "0.21" uuid = { version = "1.1", features = ["v4"] } -p256 = "0.12" -p384 = "0.12" -sec1 = "0.3" +p256 = "0.13" +p384 = "0.13" +sec1 = "0.7" url = { version = "2.3", features = ["serde"] } serde_json = "1.0" sha2 = "0.10" diff --git a/jwt/src/error.rs b/jwt/src/error.rs index e06b4f45..b3d5b0cc 100644 --- a/jwt/src/error.rs +++ b/jwt/src/error.rs @@ -14,8 +14,8 @@ pub enum RustyJwtError { #[error(transparent)] RandError(#[from] rand::Error), /// Elliptic curve error - #[error("Elliptic curve error because {0}")] - Sec1Error(sec1::Error), + #[error(transparent)] + Sec1Error(#[from] sec1::Error), /// Invalid URL #[error(transparent)] UrlParseError(#[from] url::ParseError), diff --git a/jwt/src/jwk/ecdsa.rs b/jwt/src/jwk/ecdsa.rs index 83c03e49..cf0eab35 100644 --- a/jwt/src/jwk/ecdsa.rs +++ b/jwt/src/jwk/ecdsa.rs @@ -62,13 +62,13 @@ impl TryIntoJwk for AnyEcPublicKey { let Self(alg, bytes) = self; let (x, y) = match alg { JwsEcAlgorithm::P256 => { - let point = p256::EncodedPoint::from_bytes(bytes).map_err(RustyJwtError::Sec1Error)?; + let point = p256::EncodedPoint::from_bytes(bytes)?; let x = RustyJwk::base64_url_encode(point.x().ok_or(RustyJwtError::ImplementationError)?); let y = RustyJwk::base64_url_encode(point.y().ok_or(RustyJwtError::ImplementationError)?); (x, y) } JwsEcAlgorithm::P384 => { - let point = p384::EncodedPoint::from_bytes(bytes).map_err(RustyJwtError::Sec1Error)?; + let point = p384::EncodedPoint::from_bytes(bytes)?; let x = RustyJwk::base64_url_encode(point.x().ok_or(RustyJwtError::ImplementationError)?); let y = RustyJwk::base64_url_encode(point.y().ok_or(RustyJwtError::ImplementationError)?); (x, y)