Skip to content

Commit

Permalink
cargo clippy + fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
UMR1352 committed Aug 28, 2024
1 parent 075461d commit 5a2dd53
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 24 deletions.
2 changes: 1 addition & 1 deletion identity_core/src/common/ordered_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ mod tests {
/// Produces a strategy for generating an ordered set together with two values according to the following algorithm:
/// 1. Call `f` to get a pair of sets (x,y).
/// 2. Toss a coin to decide whether to pick an element from x at random, or from y (if the chosen set is empty
/// Default is called). 3. Repeat step 2 and let the two outcomes be denoted a and b.
/// Default is called). 3. Repeat step 2 and let the two outcomes be denoted a and b.
/// 4. Toss a coin to decide whether to swap the keys of a and b.
/// 5. return (x,a,b)
fn set_with_values<F, T, U>(f: F) -> impl Strategy<Value = (OrderedSet<T>, T, T)>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ impl<V: JwsVerifier> JwtDomainLinkageValidator<V> {
/// Validates the linkage between a domain and a DID.
/// [`DomainLinkageConfiguration`] is validated according to [DID Configuration Resource Verification](https://identity.foundation/.well-known/resources/did-configuration/#did-configuration-resource-verification).
///
/// * `issuer`: DID Document of the linked DID. Issuer of the Domain Linkage Credential included
/// in the Domain Linkage Configuration.
/// * `issuer`: DID Document of the linked DID. Issuer of the Domain Linkage Credential included in the Domain Linkage
/// Configuration.
/// * `configuration`: Domain Linkage Configuration fetched from the domain at "/.well-known/did-configuration.json".
/// * `domain`: domain from which the Domain Linkage Configuration has been fetched.
/// * `validation_options`: Further validation options to be applied on the Domain Linkage Credential.
Expand Down
4 changes: 2 additions & 2 deletions identity_document/src/document/core_document.rs
Original file line number Diff line number Diff line change
Expand Up @@ -938,8 +938,8 @@ impl CoreDocument {
/// Regardless of which options are passed the following conditions must be met in order for a verification attempt to
/// take place.
/// - The JWS must be encoded according to the JWS compact serialization.
/// - The `kid` value in the protected header must be an identifier of a verification method in this DID document,
/// or set explicitly in the `options`.
/// - The `kid` value in the protected header must be an identifier of a verification method in this DID document, or
/// set explicitly in the `options`.
//
// NOTE: This is tested in `identity_storage` and `identity_credential`.
pub fn verify_jws<'jws, T: JwsVerifier>(
Expand Down
3 changes: 1 addition & 2 deletions identity_jose/src/jwu/serde.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ pub(crate) fn validate_jws_headers(protected: Option<&JwsHeader>, unprotected: O
/// Validates that the "crit" parameter satisfies the following requirements:
/// 1. It is integrity protected.
/// 2. It is not encoded as an empty list.
/// 3. It does not contain any header parameters defined by the
/// JOSE JWS/JWA specifications.
/// 3. It does not contain any header parameters defined by the JOSE JWS/JWA specifications.
/// 4. It's values are contained in the given `permitted` array.
/// 5. All values in "crit" are present in at least one of the `protected` or `unprotected` headers.
///
Expand Down
24 changes: 11 additions & 13 deletions identity_jose/src/tests/rfc8037.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,18 @@ fn test_rfc8037_ed25519() {
.and_then(|decoded| decoded.verify(&jws_verifier, &public))
.unwrap();

#[cfg(feature = "eddsa")]
{
let jws_signature_verifier = JwsVerifierFn::from(|input: VerificationInput, key: &Jwk| match input.alg {
JwsAlgorithm::EdDSA => ed25519::verify(input, key),
other => unimplemented!("{other}"),
});
let jws_signature_verifier = JwsVerifierFn::from(|input: VerificationInput, key: &Jwk| match input.alg {
JwsAlgorithm::EdDSA => ed25519::verify(input, key),
other => unimplemented!("{other}"),
});

let decoder = Decoder::new();
let token_with_default = decoder
.decode_compact_serialization(jws.as_bytes(), None)
.and_then(|decoded| decoded.verify(&jws_signature_verifier, &public))
.unwrap();

let decoder = Decoder::new();
let token_with_default = decoder
.decode_compact_serialization(jws.as_bytes(), None)
.and_then(|decoded| decoded.verify(&jws_signature_verifier, &public))
.unwrap();
assert_eq!(token, token_with_default);
}
assert_eq!(token, token_with_default);
assert_eq!(token.protected, header);
assert_eq!(token.claims, tv.payload.as_bytes());
}
Expand Down
8 changes: 4 additions & 4 deletions identity_resolver/src/resolution/resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,10 +301,10 @@ mod iota_handler {
///
/// # Note
///
/// - Using `attach_iota_handler` or `attach_handler` for the IOTA method would override all
/// previously added clients.
/// - This function does not validate the provided configuration. Ensure that the provided
/// network name corresponds with the client, possibly by using `client.network_name()`.
/// - Using `attach_iota_handler` or `attach_handler` for the IOTA method would override all previously added
/// clients.
/// - This function does not validate the provided configuration. Ensure that the provided network name corresponds
/// with the client, possibly by using `client.network_name()`.
pub fn attach_multiple_iota_handlers<CLI, I>(&mut self, clients: I)
where
CLI: IotaIdentityClientExt + Send + Sync + 'static,
Expand Down

0 comments on commit 5a2dd53

Please sign in to comment.