Skip to content

Commit

Permalink
build: bump p256, p384 & sec1 crates
Browse files Browse the repository at this point in the history
  • Loading branch information
beltram committed Mar 10, 2023
1 parent 081f0e4 commit 28b0cee
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions jwt/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions jwt/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
4 changes: 2 additions & 2 deletions jwt/src/jwk/ecdsa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 28b0cee

Please sign in to comment.