Skip to content

Commit

Permalink
fixup! fixup! fixup! fixup! fixup! chore: apply suggestions from code…
Browse files Browse the repository at this point in the history
… review (#13)
  • Loading branch information
falko17 committed Aug 4, 2024
1 parent 350a3ee commit 0ec9e73
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 21 deletions.
4 changes: 2 additions & 2 deletions src/token/cose/aad.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,8 @@ impl<T: AadProvider> AadProvider for &T {
}
}

/// Use [`AadProvider::lookup_aad`] as a fallback for [`AadProvider::lookup_nested_aad`] if the
/// boolean is `true` and [`AadProvider::lookup_nested_aad`] returns None.
/// Use [`AadProvider::lookup_aad`] as a fallback for [`AadProvider::lookup_nested_aad`] if the
/// boolean is `true` and [`AadProvider::lookup_nested_aad`] returns None.
impl<T: AadProvider> AadProvider for (T, bool) {
fn lookup_aad(
&self,
Expand Down
2 changes: 1 addition & 1 deletion src/token/cose/crypto_impl/openssl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ impl From<openssl::aes::KeyError> for CoseCipherError<CoseOpensslCipherError> {

/// Context for the OpenSSL cryptographic backend.
///
/// Can be used as a [`CryptoBackend`] for COSE operations.
/// Can be used as a [`CryptoBackend`] for COSE operations.
///
/// Generic properties of this backend:
/// - [ ] Can derive EC public key components if only the private component (d) is present.
Expand Down
6 changes: 3 additions & 3 deletions src/token/cose/encrypted/encrypt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,11 @@ impl CoseEncryptBuilderExt for CoseEncryptBuilder {
}
}

/// Extensions to the [`CoseEncrypt`] type that enable usage of cryptographic backends.
/// Extensions to the [`CoseEncrypt`] type that enable usage of cryptographic backends.
///
/// # Examples
///
/// Create a simple [`CoseEncrypt`] instance that uses the provided key directly and encrypts a
/// Create a simple [`CoseEncrypt`] instance that uses the provided key directly and encrypts a
/// payload, then decrypt it:
///
/// ```
Expand Down Expand Up @@ -177,7 +177,7 @@ impl CoseEncryptBuilderExt for CoseEncryptBuilder {
/// # Result::<(), CoseCipherError<<OpensslContext as CryptoBackend>::Error>>::Ok(())
/// ```
///
/// Create a simple [`CoseEncrypt`] instance with recipients that protect a content encryption key
/// Create a simple [`CoseEncrypt`] instance with recipients that protect a content encryption key
/// using AES key wrap. Encrypt a plaintext for it, then verify it:
/// ```
///
Expand Down
6 changes: 3 additions & 3 deletions src/token/cose/encrypted/encrypt0/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use crate::token::cose::key::KeyProvider;
#[cfg(all(test, feature = "std"))]
mod tests;

/// Extensions to the [`CoseEncrypt0Builder`] type that enable usage of cryptographic backends.
/// Extensions to the [`CoseEncrypt0Builder`] type that enable usage of cryptographic backends.
pub trait CoseEncrypt0BuilderExt: Sized {
/// Attempts to encrypt the given `payload` using a cryptographic backend.
///
Expand Down Expand Up @@ -114,11 +114,11 @@ impl CoseEncrypt0BuilderExt for CoseEncrypt0Builder {
}
}

/// Extensions to the [`CoseEncrypt0`] type that enable usage of cryptographic backends.
/// Extensions to the [`CoseEncrypt0`] type that enable usage of cryptographic backends.
///
/// # Examples
///
/// Create a simple [`CoseEncrypt0`] instance that uses the provided key directly and encrypts a
/// Create a simple [`CoseEncrypt0`] instance that uses the provided key directly and encrypts a
/// payload, then decrypt it:
///
/// ```
Expand Down
4 changes: 2 additions & 2 deletions src/token/cose/encrypted/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ pub trait EncryptCryptoBackend: CryptoBackend {
/// Implementations may assume that the provided key has the right length for the
/// provided algorithm, and panic if this is not the case.
/// * `plaintext` - Data that should be encrypted.
/// * `aad` - Additional Authenticated Data that should be included in the calculation of the
/// * `aad` - additional authenticated data that should be included in the calculation of the
/// authentication tag, but not encrypted.
/// * `iv` - Initialization vector that should be used for the encryption process.
///
Expand Down Expand Up @@ -112,7 +112,7 @@ pub trait EncryptCryptoBackend: CryptoBackend {
/// * `ciphertext_with_tag` - The ciphertext that should be decrypted concatenated with the
/// authentication tag that should be verified.
/// Is guaranteed to be at least as long as the authentication tag should be.
/// * `aad` - Additional Authenticated Data that should be included in the calculation of the
/// * `aad` - additional authenticated data that should be included in the calculation of the
/// authentication tag, but not encrypted.
/// * `iv` - Initialization vector that should be used for the encryption process.
///
Expand Down
2 changes: 1 addition & 1 deletion src/token/cose/header_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ pub(crate) fn determine_key_candidates<'a, CKP: KeyProvider, CE: Display>(
})
}

/// Extensions to the [`HeaderBuilder`] type that enable usage of cryptographic backends.
/// Extensions to the [`HeaderBuilder`] type that enable usage of cryptographic backends.
pub trait HeaderBuilderExt: Sized {
/// Generate an initialization vector for the given `algorithm` using the given
/// cryptographic `backend`.
Expand Down
4 changes: 2 additions & 2 deletions src/token/cose/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*
* SPDX-License-Identifier: MIT OR Apache-2.0
*/
//! Extensions to [`coset`] for easier cryptographic operations.
//! Extensions to [`coset`] for easier cryptographic operations.
//!
//! This module is intended to abstract away most of the complexities regarding cryptographic
//! operations for COSE structures, i.e. they allow you to encrypt/sign/compute/decrypt/verify COSE
Expand All @@ -34,7 +34,7 @@
//!
//! In cases where you need to provide multiple sets of AAD at once, e.g. for nested COSE recipient
//! structures where different recipients have different AAD, you may look at either implementing
//! [`AadProvider`] yourself or using the predefined operations defined in the [`aad`] module.
//! [`AadProvider`] yourself or using the predefined operations defined in the [`aad`] module.
//!
//! # COSE Cipher
//! This crate does not implement the basic cryptographic functions used for encrypting/signing or
Expand Down
6 changes: 3 additions & 3 deletions src/token/cose/recipient/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ impl<'a, B: KeyDistributionCryptoBackend, CKP: KeyProvider, AAD: AadProvider> Ke
}
}

/// An iterator that performs a depth-first search through a nested [`CoseRecipient`] structure,
/// An iterator that performs a depth-first search through a nested [`CoseRecipient`] structure,
/// attempts to decrypt those recipients and yields potential CEKs resulting from this search.
struct CoseNestedRecipientIterator<
'a,
Expand Down Expand Up @@ -511,7 +511,7 @@ pub trait CoseRecipientBuilderExt: Sized {
/// are malformed or otherwise unsuitable for encryption, this function will return the
/// most fitting [`CoseCipherError`] for the specific type of error.
///
/// If Additional Authenticated Data is provided even though the chosen algorithm is not an AEAD
/// If additional authenticated data is provided even though the chosen algorithm is not an AEAD
/// algorithm, a [`CoseCipherError::AadUnsupported`] will be returned.
///
/// If the COSE object is not malformed, but an error in the cryptographic backend occurs, a
Expand Down Expand Up @@ -728,7 +728,7 @@ pub trait CoseRecipientExt {
/// or otherwise unsuitable for decryption, this function will return the most fitting
/// [`CoseCipherError`] for the specific type of error.
///
/// If Additional Authenticated Data is provided even though the chosen algorithm is not an AEAD
/// If additional authenticated data is provided even though the chosen algorithm is not an AEAD
/// algorithm, a [`CoseCipherError::AadUnsupported`] will be returned.
///
/// If the COSE object is not malformed, but an error in the cryptographic backend occurs, a
Expand Down
2 changes: 1 addition & 1 deletion src/token/cose/signed/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ pub trait SignCryptoBackend: CryptoBackend {
///
/// # Errors
///
/// If the signature is not malformed, but not valid for the given `alg`, `key`,
/// If the signature is not malformed, but not valid for the given `algorithm`, `key`,
/// and `payload`, a [`CoseCipherError::VerificationFailure`] must be returned.
///
/// In case of other errors, the implementation may return any valid [`CoseCipherError`]
Expand Down
6 changes: 3 additions & 3 deletions src/token/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ mod tests;
/// [`encrypt_access_token_multiple`].
///
/// # Errors
/// Returns an error if the [`ClaimsSet`] could not be encoded or an error during signing
/// occurs (see [`CoseEncryptBuilderExt::try_encrypt`] for possible errors).
/// Returns an error if the [`ClaimsSet`] could not be encoded or an error during signing
/// occurs (see [`CoseEncryptBuilderExt::try_encrypt`] for possible errors).
///
/// # Example
///
Expand Down Expand Up @@ -172,7 +172,7 @@ where
/// they encrypt the Content Encryption Key for each recipient.
///
/// # Errors
/// Returns an error if the [`ClaimsSet`] could not be encoded or an error during signing
/// Returns an error if the [`ClaimsSet`] could not be encoded or an error during signing
/// occurs (see [`CoseEncryptBuilderExt::try_encrypt`] and [`CoseRecipientBuilderExt::try_encrypt`] for
/// possible errors).
///
Expand Down

0 comments on commit 0ec9e73

Please sign in to comment.