diff --git a/crates/matrix-sdk-crypto/src/identities/device.rs b/crates/matrix-sdk-crypto/src/identities/device.rs index 27461d0f0..adf01429e 100644 --- a/crates/matrix-sdk-crypto/src/identities/device.rs +++ b/crates/matrix-sdk-crypto/src/identities/device.rs @@ -564,9 +564,9 @@ impl ReadOnlyDevice { /// Check if the given JSON is signed by this device key. /// - /// This method should only be used if a signature of an object should be - /// checked multiple times and the canonicalization step wants to be done - /// only a single time. + /// This method should only be used if an object's signature needs to be + /// checked multiple times, and you'd like to avoid performing the + /// canonicalization step each time. /// /// **Note**: Use this method with caution, the `canonical_json` needs to be /// correctly canonicalized and make sure that the object you are checking diff --git a/crates/matrix-sdk-crypto/src/identities/user.rs b/crates/matrix-sdk-crypto/src/identities/user.rs index 33d19b66b..2400f7829 100644 --- a/crates/matrix-sdk-crypto/src/identities/user.rs +++ b/crates/matrix-sdk-crypto/src/identities/user.rs @@ -425,9 +425,9 @@ impl MasterPubkey { /// Check if the given JSON is signed by this master key. /// - /// This method should only be used if a signature of an object should be - /// checked multiple times and the canonicalization step wants to be done - /// only a single time. + /// This method should only be used if an object's signature needs to be + /// checked multiple times, and you'd like to avoid performing the + /// canonicalization step each time. /// /// **Note**: Use this method with caution, the `canonical_json` needs to be /// correctly canonicalized and make sure that the object you are checking diff --git a/crates/matrix-sdk-crypto/src/olm/account.rs b/crates/matrix-sdk-crypto/src/olm/account.rs index 96392d30d..002c6c6e3 100644 --- a/crates/matrix-sdk-crypto/src/olm/account.rs +++ b/crates/matrix-sdk-crypto/src/olm/account.rs @@ -677,9 +677,9 @@ impl ReadOnlyAccount { /// Check if the given JSON is signed by this Account key. /// - /// This method should only be used if a signature of an object should be - /// checked multiple times and the canonicalization step wants to be done - /// only a single time. + /// This method should only be used if an object's signature needs to be + /// checked multiple times, and you'd like to avoid performing the + /// canonicalization step each time. /// /// **Note**: Use this method with caution, the `canonical_json` needs to be /// correctly canonicalized and make sure that the object you are checking diff --git a/crates/matrix-sdk-crypto/src/olm/utility.rs b/crates/matrix-sdk-crypto/src/olm/utility.rs index 7bd6737ff..89328843c 100644 --- a/crates/matrix-sdk-crypto/src/olm/utility.rs +++ b/crates/matrix-sdk-crypto/src/olm/utility.rs @@ -63,9 +63,10 @@ pub trait VerifyJson { /// * `user_id` - The user that claims to have signed this object. /// /// * `key_id` - The ID of the key that was used to sign this object. - /// **Note**: The key ID must match the ID of the public key that is - /// verifying the signature. This is only used to find the correct - /// signature. + /// + /// **Note**: The key ID must match the ID of the public key that is + /// verifying the signature. This is only used to find the correct + /// signature. /// /// * `signed_object` - The signed object that we should check for a valid /// signature. @@ -87,17 +88,18 @@ pub trait VerifyJson { /// * `user_id` - The user that claims to have signed this object. /// /// * `key_id` - The ID of the key that was used to sign this object. - /// **Note**: The key ID must match the ID of the public key that is - /// verifying the signature. This is only used to find the correct - /// signature. + /// + /// **Note**: The key ID must match the ID of the public key that is + /// verifying the signature. This is only used to find the correct + /// signature. /// /// * `canonicalized_json` - The canonicalized version of a signed JSON /// object. /// - /// This method should only be used if a signature of an object should be - /// checked multiple times and the canonicalization step wants to be done - /// only a single time. Prefer the [`VerifyJson::verify_json`] method - /// otherwise. + /// This method should only be used if an object's signature needs to be + /// checked multiple times, and you'd like to avoid performing the + /// canonicalization step each time. Otherwise, prefer the + /// [`VerifyJson::verify_json`] method /// /// Returns Ok if the signature was successfully verified, otherwise an /// SignatureError. @@ -159,14 +161,14 @@ fn verify_signature( } /// A trait for Matrix objects that we can canonicalize, sign and verify -/// signatures for as described by the [spec]. +/// signatures for, as described by the [spec]. /// /// [spec]: https://spec.matrix.org/unstable/appendices/#signing-json pub trait SignedJsonObject: Serialize { - /// Get the collection of signatures this SignedJsonObject has. + /// Get the collection of signatures present on this signed JSON object. fn signatures(&self) -> &Signatures; - /// Convert the SignedJsonObject to a canonicalized signed JSON string. + /// Convert this signed JSON object to a canonicalized signed JSON string. fn to_canonical_json(&self) -> Result { let value = serde_json::to_value(self)?; to_signable_json(value)