Skip to content

Commit

Permalink
+=clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
przydatek committed Sep 26, 2023
1 parent 8095c70 commit c4938d1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 45 deletions.
56 changes: 14 additions & 42 deletions src/internet_identity/tests/integration/vc_mvp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,8 @@ fn should_get_valid_id_alias() -> Result<(), CallError> {
&id_alias_credentials.rp_id_alias_credential,
&env.root_key(),
);
verify_credential_jws(
&id_alias_credentials.rp_id_alias_credential.credential_jws,
canister_id,
)
.expect("external verification failed");
verify_credential_jws(&id_alias_credentials.rp_id_alias_credential.credential_jws)
.expect("external verification failed");
verify_id_alias_credential(
&env,
prepared_id_alias.canister_sig_pk.clone(),
Expand All @@ -113,7 +110,6 @@ fn should_get_valid_id_alias() -> Result<(), CallError> {
&id_alias_credentials
.issuer_id_alias_credential
.credential_jws,
canister_id,
)
.expect("external verification failed");
Ok(())
Expand Down Expand Up @@ -225,28 +221,20 @@ fn should_get_different_id_alias_for_different_users() -> Result<(), CallError>
);

set_ic_root_public_key_for_testing(env.root_key());
verify_credential_jws(
&id_alias_credentials_1.rp_id_alias_credential.credential_jws,
canister_id,
)
.expect("external verification failed");
verify_credential_jws(&id_alias_credentials_1.rp_id_alias_credential.credential_jws)
.expect("external verification failed");
verify_credential_jws(
&id_alias_credentials_1
.issuer_id_alias_credential
.credential_jws,
canister_id,
)
.expect("external verification failed");
verify_credential_jws(
&id_alias_credentials_2.rp_id_alias_credential.credential_jws,
canister_id,
)
.expect("external verification failed");
verify_credential_jws(&id_alias_credentials_2.rp_id_alias_credential.credential_jws)
.expect("external verification failed");
verify_credential_jws(
&id_alias_credentials_2
.issuer_id_alias_credential
.credential_jws,
canister_id,
)
.expect("external verification failed");
Ok(())
Expand Down Expand Up @@ -361,28 +349,20 @@ fn should_get_different_id_alias_for_different_relying_parties() -> Result<(), C
);

set_ic_root_public_key_for_testing(env.root_key());
verify_credential_jws(
&id_alias_credentials_1.rp_id_alias_credential.credential_jws,
canister_id,
)
.expect("external verification failed");
verify_credential_jws(&id_alias_credentials_1.rp_id_alias_credential.credential_jws)
.expect("external verification failed");
verify_credential_jws(
&id_alias_credentials_1
.issuer_id_alias_credential
.credential_jws,
canister_id,
)
.expect("external verification failed");
verify_credential_jws(
&id_alias_credentials_2.rp_id_alias_credential.credential_jws,
canister_id,
)
.expect("external verification failed");
verify_credential_jws(&id_alias_credentials_2.rp_id_alias_credential.credential_jws)
.expect("external verification failed");
verify_credential_jws(
&id_alias_credentials_2
.issuer_id_alias_credential
.credential_jws,
canister_id,
)
.expect("external verification failed");

Expand Down Expand Up @@ -498,28 +478,20 @@ fn should_get_different_id_alias_for_different_issuers() -> Result<(), CallError
);

set_ic_root_public_key_for_testing(env.root_key());
verify_credential_jws(
&id_alias_credentials_1.rp_id_alias_credential.credential_jws,
canister_id,
)
.expect("external verification failed");
verify_credential_jws(&id_alias_credentials_1.rp_id_alias_credential.credential_jws)
.expect("external verification failed");
verify_credential_jws(
&id_alias_credentials_1
.issuer_id_alias_credential
.credential_jws,
canister_id,
)
.expect("external verification failed");
verify_credential_jws(
&id_alias_credentials_2.rp_id_alias_credential.credential_jws,
canister_id,
)
.expect("external verification failed");
verify_credential_jws(&id_alias_credentials_2.rp_id_alias_credential.credential_jws)
.expect("external verification failed");
verify_credential_jws(
&id_alias_credentials_2
.issuer_id_alias_credential
.credential_jws,
canister_id,
)
.expect("external verification failed");

Expand Down
6 changes: 3 additions & 3 deletions src/vc_util/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ pub fn verify_id_alias_credential_jws(
credential_jws: &str,
alias_tuple: &AliasTuple,
) -> Result<(), CredentialVerificationError> {
let claims = verify_credential_jws(credential_jws)
.map_err(|e| CredentialVerificationError::InvalidJws(e))?;
let claims =
verify_credential_jws(credential_jws).map_err(CredentialVerificationError::InvalidJws)?;
validate_id_alias_claims(claims, alias_tuple)
.map_err(|e| CredentialVerificationError::InvalidClaims(e))
.map_err(CredentialVerificationError::InvalidClaims)
}

/// Validates that the given claims are consistent with id_alias-credential
Expand Down

0 comments on commit c4938d1

Please sign in to comment.