Skip to content

Commit

Permalink
Remove empty leading and trailing lines from doc comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ramosbugs committed Feb 29, 2024
1 parent 1131afa commit 38baa1a
Show file tree
Hide file tree
Showing 13 changed files with 0 additions and 911 deletions.
30 changes: 0 additions & 30 deletions src/claims.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,74 +18,52 @@ use std::fmt::{Debug, Formatter, Result as FormatterResult};
use std::marker::PhantomData;
use std::str;

///
/// Additional claims beyond the set of Standard Claims defined by OpenID Connect Core.
///
pub trait AdditionalClaims: Debug + DeserializeOwned + Serialize + 'static {}

///
/// No additional claims.
///
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Eq, Serialize)]
// In order to support serde flatten, this must be an empty struct rather than an empty
// tuple struct.
pub struct EmptyAdditionalClaims {}
impl AdditionalClaims for EmptyAdditionalClaims {}

///
/// Address claims.
///
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Eq, Serialize)]
pub struct AddressClaim {
///
/// Full mailing address, formatted for display or use on a mailing label.
///
/// This field MAY contain multiple lines, separated by newlines. Newlines can be represented
/// either as a carriage return/line feed pair (`\r\n`) or as a single line feed character
/// (`\n`).
///
#[serde(skip_serializing_if = "Option::is_none")]
pub formatted: Option<FormattedAddress>,
///
/// Full street address component, which MAY include house number, street name, Post Office Box,
/// and multi-line extended street address information.
///
/// This field MAY contain multiple lines, separated by newlines. Newlines can be represented
/// either as a carriage return/line feed pair (`\r\n`) or as a single line feed character
/// (`\n`).
///
#[serde(skip_serializing_if = "Option::is_none")]
pub street_address: Option<StreetAddress>,
///
/// City or locality component.
///
#[serde(skip_serializing_if = "Option::is_none")]
pub locality: Option<AddressLocality>,
///
/// State, province, prefecture, or region component.
///
#[serde(skip_serializing_if = "Option::is_none")]
pub region: Option<AddressRegion>,
///
/// Zip code or postal code component.
///
#[serde(skip_serializing_if = "Option::is_none")]
pub postal_code: Option<AddressPostalCode>,
///
/// Country name component.
///
#[serde(skip_serializing_if = "Option::is_none")]
pub country: Option<AddressCountry>,
}

///
/// Gender claim.
///
pub trait GenderClaim: Clone + Debug + DeserializeOwned + Serialize + 'static {}

///
/// Standard Claims defined by OpenID Connect Core.
///
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct StandardClaims<GC>
where
Expand Down Expand Up @@ -117,11 +95,9 @@ impl<GC> StandardClaims<GC>
where
GC: GenderClaim,
{
///
/// Initializes a set of Standard Claims.
///
/// The Subject (`sub`) claim is the only required Standard Claim.
///
pub fn new(subject: SubjectIdentifier) -> Self {
Self {
sub: subject,
Expand All @@ -148,16 +124,12 @@ where
}
}

///
/// Returns the Subject (`sub`) claim.
///
pub fn subject(&self) -> &SubjectIdentifier {
&self.sub
}

///
/// Sets the Subject (`sub`) claim.
///
pub fn set_subject(mut self, subject: SubjectIdentifier) -> Self {
self.sub = subject;
self
Expand Down Expand Up @@ -227,10 +199,8 @@ impl<'de, GC> Deserialize<'de> for StandardClaims<GC>
where
GC: GenderClaim,
{
///
/// Special deserializer that supports [RFC 5646](https://tools.ietf.org/html/rfc5646) language
/// tags associated with human-readable client metadata fields.
///
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: Deserializer<'de>,
Expand Down
42 changes: 0 additions & 42 deletions src/core/jwk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ use sha2::Digest;
// support such key types, we'll need to define a new impl for JsonWebKey. Deserializing the new
// impl would probably need to involve first deserializing the raw values to access the 'kty'
// parameter, and then deserializing the fields and types appropriate for that key type.
///
/// Public or symmetric key expressed as a JSON Web Key.
///
#[derive(Clone, Debug, Deserialize, PartialEq, Eq, Serialize)]
pub struct CoreJsonWebKey {
pub(crate) kty: CoreJsonWebKeyType,
Expand Down Expand Up @@ -386,20 +384,16 @@ impl JsonWebKey<CoreJwsSigningAlgorithm, CoreJsonWebKeyType, CoreJsonWebKeyUse>
}
}

///
/// HMAC secret key.
///
/// This key can be used for signing messages, or converted to a `CoreJsonWebKey` for verifying
/// them.
///
#[derive(Clone)]
pub struct CoreHmacKey {
secret: Vec<u8>,
}
impl CoreHmacKey {
///
/// Instantiate a new key from the specified secret bytes.
///
pub fn new<T>(secret: T) -> Self
where
T: Into<Vec<u8>>,
Expand Down Expand Up @@ -483,20 +477,16 @@ impl EdDsaSigningKey {
}
}

///
/// EdDSA Private Key.
///
/// This key can be used for signing messages, or converted to a `CoreJsonWebKey` for verifying
/// them.
///
pub struct CoreEdDsaPrivateSigningKey {
kid: Option<JsonWebKeyId>,
key_pair: EdDsaSigningKey,
}
impl CoreEdDsaPrivateSigningKey {
///
/// Converts an EdDSA private key (in PEM format) to a JWK representing its public key.
///
pub fn from_ed25519_pem(pem: &str, kid: Option<JsonWebKeyId>) -> Result<Self, String> {
Ok(Self {
kid,
Expand Down Expand Up @@ -558,21 +548,17 @@ pub(crate) trait RngClone: dyn_clone::DynClone + rand::RngCore + rand::CryptoRng
dyn_clone::clone_trait_object!(RngClone);
impl<T> RngClone for T where T: rand::RngCore + rand::CryptoRng + Clone {}

///
/// RSA private key.
///
/// This key can be used for signing messages, or converted to a `CoreJsonWebKey` for verifying
/// them.
///
pub struct CoreRsaPrivateSigningKey {
key_pair: rsa::RsaPrivateKey,
rng: Box<dyn RngClone + Send + Sync>,
kid: Option<JsonWebKeyId>,
}
impl CoreRsaPrivateSigningKey {
///
/// Converts an RSA private key (in PEM format) to a JWK representing its public key.
///
pub fn from_pem(pem: &str, kid: Option<JsonWebKeyId>) -> Result<Self, String> {
Self::from_pem_internal(pem, Box::new(rand::rngs::OsRng), kid)
}
Expand Down Expand Up @@ -710,85 +696,57 @@ impl
}
}

///
/// Type of JSON Web Key.
///
#[derive(Clone, Debug, Deserialize, PartialEq, Eq, Serialize)]
#[non_exhaustive]
pub enum CoreJsonWebKeyType {
///
/// Elliptic Curve Cryptography (ECC) key.
///
/// ECC algorithms such as ECDSA are currently unsupported.
///
#[serde(rename = "EC")]
EllipticCurve,
///
/// RSA key.
///
#[serde(rename = "RSA")]
RSA,
///
/// EdDSA key.
///
#[serde(rename = "OKP")]
OctetKeyPair,
///
/// Symmetric key.
///
#[serde(rename = "oct")]
Symmetric,
}
impl JsonWebKeyType for CoreJsonWebKeyType {}

///
/// Type of EC-Curve
///
#[derive(Clone, Debug, Deserialize, PartialEq, Eq, Serialize)]
#[non_exhaustive]
pub enum CoreJsonCurveType {
///
/// P-256 Curve
///
#[serde(rename = "P-256")]
P256,
///
/// P-384 Curve
///
#[serde(rename = "P-384")]
P384,
///
/// P-521 Curve (currently not supported)
///
#[serde(rename = "P-521")]
P521,
///
/// Ed25519 Curve
///
#[serde(rename = "Ed25519")]
Ed25519,
}
impl JsonCurveType for CoreJsonWebKeyType {}

///
/// Usage restriction for a JSON Web key.
///
#[derive(Clone, Debug, PartialEq, Eq)]
#[non_exhaustive]
pub enum CoreJsonWebKeyUse {
///
/// Key may be used for digital signatures.
///
Signature,

///
/// Key may be used for encryption.
///
Encryption,

///
/// Fallback case for other key uses not understood by this library.
///
Other(String),
}
impl CoreJsonWebKeyUse {
Expand Down
Loading

0 comments on commit 38baa1a

Please sign in to comment.