Skip to content
This repository has been archived by the owner on Feb 29, 2024. It is now read-only.

Commit

Permalink
Merge pull request #2257 from Artemkaaas/bugfix/proof-request-restric…
Browse files Browse the repository at this point in the history
…tion

Corrected verification of attr::name::value restriction on the Verifier if the attribute contains spaces or upper case symbols
  • Loading branch information
Artemkaaas authored Jan 19, 2021
2 parents 88bbb96 + 722c553 commit 03f5482
Show file tree
Hide file tree
Showing 5 changed files with 371 additions and 89 deletions.
2 changes: 1 addition & 1 deletion libindy/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 24 additions & 24 deletions libindy/src/commands/anoncreds/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -532,12 +532,12 @@ impl ProverCommandExecutor {
let mut credentials_for_proof_request: CredentialsForProofRequest = CredentialsForProofRequest::default();

for (attr_id, requested_attr) in proof_req.requested_attributes.iter() {
let query = self.anoncreds_service.prover.extend_proof_request_restrictions(&proof_req_version,
&requested_attr.name,
&requested_attr.names,
&attr_id,
&requested_attr.restrictions,
&None)?;
let query = self.anoncreds_service.prover.process_proof_request_restrictions(&proof_req_version,
&requested_attr.name,
&requested_attr.names,
&attr_id,
&requested_attr.restrictions,
&None)?;
let interval = get_non_revoc_interval(&proof_req.non_revoked, &requested_attr.non_revoked);

let credentials_for_attribute = self._query_requested_credentials(wallet_handle, &query, None, &interval)?;
Expand All @@ -546,12 +546,12 @@ impl ProverCommandExecutor {
}

for (predicate_id, requested_predicate) in proof_req.requested_predicates.iter() {
let query = self.anoncreds_service.prover.extend_proof_request_restrictions(&proof_req_version,
&Some(requested_predicate.name.clone()),
&None,
&predicate_id,
&requested_predicate.restrictions,
&None)?;
let query = self.anoncreds_service.prover.process_proof_request_restrictions(&proof_req_version,
&Some(requested_predicate.name.clone()),
&None,
&predicate_id,
&requested_predicate.restrictions,
&None)?;

let interval = get_non_revoc_interval(&proof_req.non_revoked, &requested_predicate.non_revoked);

Expand Down Expand Up @@ -581,12 +581,12 @@ impl ProverCommandExecutor {
let mut credentials_for_proof_request_search = HashMap::<String, SearchForProofRequest>::new();

for (attr_id, requested_attr) in proof_req.requested_attributes.iter() {
let query = self.anoncreds_service.prover.extend_proof_request_restrictions(&version,
&requested_attr.name,
&requested_attr.names,
&attr_id,
&requested_attr.restrictions,
&extra_query)?;
let query = self.anoncreds_service.prover.process_proof_request_restrictions(&version,
&requested_attr.name,
&requested_attr.names,
&attr_id,
&requested_attr.restrictions,
&extra_query)?;

let credentials_search =
self.wallet_service.search_indy_records::<Credential>(wallet_handle, &query.to_string(), &SearchOptions::id_value())?;
Expand All @@ -599,12 +599,12 @@ impl ProverCommandExecutor {
}

for (predicate_id, requested_predicate) in proof_req.requested_predicates.iter() {
let query = self.anoncreds_service.prover.extend_proof_request_restrictions(&version,
&Some(requested_predicate.name.clone()),
&None,
&predicate_id,
&requested_predicate.restrictions,
&extra_query)?;
let query = self.anoncreds_service.prover.process_proof_request_restrictions(&version,
&Some(requested_predicate.name.clone()),
&None,
&predicate_id,
&requested_predicate.restrictions,
&extra_query)?;

let credentials_search =
self.wallet_service.search_indy_records::<Credential>(wallet_handle, &query.to_string(), &SearchOptions::id_value())?;
Expand Down
Loading

0 comments on commit 03f5482

Please sign in to comment.