From 0ec9e73746673f78ae69242b1f945e50c57ebfc6 Mon Sep 17 00:00:00 2001 From: Falko Galperin Date: Sun, 4 Aug 2024 22:42:08 +0200 Subject: [PATCH] fixup! fixup! fixup! fixup! fixup! chore: apply suggestions from code review (#13) --- src/token/cose/aad.rs | 4 ++-- src/token/cose/crypto_impl/openssl.rs | 2 +- src/token/cose/encrypted/encrypt/mod.rs | 6 +++--- src/token/cose/encrypted/encrypt0/mod.rs | 6 +++--- src/token/cose/encrypted/mod.rs | 4 ++-- src/token/cose/header_util.rs | 2 +- src/token/cose/mod.rs | 4 ++-- src/token/cose/recipient/mod.rs | 6 +++--- src/token/cose/signed/mod.rs | 2 +- src/token/mod.rs | 6 +++--- 10 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/token/cose/aad.rs b/src/token/cose/aad.rs index 6842f62..ec55647 100644 --- a/src/token/cose/aad.rs +++ b/src/token/cose/aad.rs @@ -229,8 +229,8 @@ impl 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 AadProvider for (T, bool) { fn lookup_aad( &self, diff --git a/src/token/cose/crypto_impl/openssl.rs b/src/token/cose/crypto_impl/openssl.rs index 743bba6..d4df0e9 100644 --- a/src/token/cose/crypto_impl/openssl.rs +++ b/src/token/cose/crypto_impl/openssl.rs @@ -72,7 +72,7 @@ impl From for CoseCipherError { /// 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. diff --git a/src/token/cose/encrypted/encrypt/mod.rs b/src/token/cose/encrypted/encrypt/mod.rs index 2bebeab..2f5e3a1 100644 --- a/src/token/cose/encrypted/encrypt/mod.rs +++ b/src/token/cose/encrypted/encrypt/mod.rs @@ -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: /// /// ``` @@ -177,7 +177,7 @@ impl CoseEncryptBuilderExt for CoseEncryptBuilder { /// # Result::<(), CoseCipherError<::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: /// ``` /// diff --git a/src/token/cose/encrypted/encrypt0/mod.rs b/src/token/cose/encrypted/encrypt0/mod.rs index 043e06e..63dc761 100644 --- a/src/token/cose/encrypted/encrypt0/mod.rs +++ b/src/token/cose/encrypted/encrypt0/mod.rs @@ -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. /// @@ -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: /// /// ``` diff --git a/src/token/cose/encrypted/mod.rs b/src/token/cose/encrypted/mod.rs index e2604ef..17ae51e 100644 --- a/src/token/cose/encrypted/mod.rs +++ b/src/token/cose/encrypted/mod.rs @@ -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. /// @@ -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. /// diff --git a/src/token/cose/header_util.rs b/src/token/cose/header_util.rs index 9b3e0f7..66f7833 100644 --- a/src/token/cose/header_util.rs +++ b/src/token/cose/header_util.rs @@ -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`. diff --git a/src/token/cose/mod.rs b/src/token/cose/mod.rs index 37b1072..8fd7a79 100644 --- a/src/token/cose/mod.rs +++ b/src/token/cose/mod.rs @@ -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 @@ -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 diff --git a/src/token/cose/recipient/mod.rs b/src/token/cose/recipient/mod.rs index c9365e9..2466dc3 100644 --- a/src/token/cose/recipient/mod.rs +++ b/src/token/cose/recipient/mod.rs @@ -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, @@ -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 @@ -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 diff --git a/src/token/cose/signed/mod.rs b/src/token/cose/signed/mod.rs index b0287e2..7449ff1 100644 --- a/src/token/cose/signed/mod.rs +++ b/src/token/cose/signed/mod.rs @@ -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`] diff --git a/src/token/mod.rs b/src/token/mod.rs index 9c3145a..956fbeb 100644 --- a/src/token/mod.rs +++ b/src/token/mod.rs @@ -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 /// @@ -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). ///