Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename Signing::Null to Signing::None #50

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions jose-jwa/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,8 @@ pub enum Signing {
Rs512,

/// No digital signature or MAC performed (Optional)
///
/// This variant is renamed as `Null` to avoid colliding with `Option::None`.
#[serde(rename = "none")]
Null,
None,
}

impl fmt::Display for Signing {
Expand Down
6 changes: 3 additions & 3 deletions jose-jwk/src/crypto/p256.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use p256::elliptic_curve::sec1::{FromEncodedPoint, ToEncodedPoint};
use p256::{EncodedPoint, FieldBytes, PublicKey, SecretKey};

use jose_jwa::{Algorithm, Algorithm::Signing, Signing::*};
use jose_jwa::{Algorithm, Algorithm::Signing, Signing as S};

use super::Error;
use super::KeyInfo;
Expand All @@ -18,7 +18,7 @@ impl KeyInfo for PublicKey {
}

fn is_supported(&self, algo: &Algorithm) -> bool {
matches!(algo, Signing(Es256))
matches!(algo, Signing(S::Es256))
}
}

Expand All @@ -28,7 +28,7 @@ impl KeyInfo for SecretKey {
}

fn is_supported(&self, algo: &Algorithm) -> bool {
matches!(algo, Signing(Es256))
matches!(algo, Signing(S::Es256))
}
}

Expand Down
6 changes: 3 additions & 3 deletions jose-jwk/src/crypto/p384.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use p384::elliptic_curve::sec1::{FromEncodedPoint, ToEncodedPoint};
use p384::{EncodedPoint, FieldBytes, PublicKey, SecretKey};

use jose_jwa::{Algorithm, Algorithm::Signing, Signing::*};
use jose_jwa::{Algorithm, Algorithm::Signing, Signing as S};

use super::Error;
use super::KeyInfo;
Expand All @@ -18,7 +18,7 @@ impl KeyInfo for PublicKey {
}

fn is_supported(&self, algo: &Algorithm) -> bool {
matches!(algo, Signing(Es384))
matches!(algo, Signing(S::Es384))
}
}

Expand All @@ -28,7 +28,7 @@ impl KeyInfo for SecretKey {
}

fn is_supported(&self, algo: &Algorithm) -> bool {
matches!(algo, Signing(Es384))
matches!(algo, Signing(S::Es384))
}
}

Expand Down
26 changes: 13 additions & 13 deletions jose-jwk/src/crypto/rsa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use rsa::{
BigUint, RsaPrivateKey, RsaPublicKey,
};

use jose_jwa::{Algorithm, Algorithm::Signing, Signing::*};
use jose_jwa::{Algorithm, Algorithm::Signing, Signing as S};

use super::Error;
use super::KeyInfo;
Expand All @@ -31,12 +31,12 @@ impl KeyInfo for RsaPublicKey {

#[allow(clippy::match_like_matches_macro)]
match algo {
Signing(Rs256) => true,
Signing(Rs384) => true,
Signing(Rs512) => true,
Signing(Ps256) => true,
Signing(Ps384) => true,
Signing(Ps512) => true,
Signing(S::Rs256) => true,
Signing(S::Rs384) => true,
Signing(S::Rs512) => true,
Signing(S::Ps256) => true,
Signing(S::Ps384) => true,
Signing(S::Ps512) => true,
_ => false,
}
}
Expand All @@ -50,12 +50,12 @@ impl KeyInfo for RsaPrivateKey {
fn is_supported(&self, algo: &Algorithm) -> bool {
#[allow(clippy::match_like_matches_macro)]
match (algo, self.strength()) {
(Signing(Rs256), 16..) => true,
(Signing(Rs384), 24..) => true,
(Signing(Rs512), 32..) => true,
(Signing(Ps256), 16..) => true,
(Signing(Ps384), 24..) => true,
(Signing(Ps512), 32..) => true,
(Signing(S::Rs256), 16..) => true,
(Signing(S::Rs384), 24..) => true,
(Signing(S::Rs512), 32..) => true,
(Signing(S::Ps256), 16..) => true,
(Signing(S::Ps384), 24..) => true,
(Signing(S::Ps512), 32..) => true,
_ => false,
}
}
Expand Down