Skip to content

Commit

Permalink
Fix rebase issues
Browse files Browse the repository at this point in the history
Signed-off-by: artem.ivanov <artem.ivanov@dsr-corporation.com>
  • Loading branch information
Artemkaaas committed Dec 2, 2023
1 parent 67412eb commit 9b2bffe
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 25 deletions.
7 changes: 4 additions & 3 deletions src/data_types/w3c/credential_proof.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
use crate::data_types::w3c::presentation_proof::CredentialPresentationProof;
use crate::utils::encoded_object::EncodedObject;
use crate::Result;
use anoncreds_clsignatures::{
CredentialSignature as CLCredentialSignature, CredentialSignatureBytesProxy,
RevocationRegistry, RevocationRegistryBytesProxy, SignatureCorrectnessProof,
SignatureCorrectnessProofBytesProxy, Witness, WitnessBytesProxy,
CredentialSignature as CLCredentialSignature, RevocationRegistry, SignatureCorrectnessProof,
Witness,
};
use serde::Serialize;

Expand Down
27 changes: 11 additions & 16 deletions src/data_types/w3c/presentation_proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use crate::utils::encoded_object::EncodedObject;
use crate::Result;
use anoncreds_clsignatures::{AggregatedProof, SubProof};
use std::collections::HashSet;
use crate::data_types::w3c::encoded_object::EncodedObject;

#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
Expand Down Expand Up @@ -40,14 +39,12 @@ impl CredentialPresentationProof {
mapping: CredentialAttributesMapping,
timestamp: Option<u64>,
) -> Result<CredentialPresentationProof> {
Ok(
CredentialPresentationProof {
type_: PresentationProofType::AnonCredsPresentationProof2023,
mapping,
timestamp,
proof_value: proof_value.encode()?,
}
)
Ok(CredentialPresentationProof {
type_: PresentationProofType::AnonCredsPresentationProof2023,
mapping,
timestamp,
proof_value: proof_value.encode()?,
})
}

pub fn get_proof_value(&self) -> Result<CredentialPresentationProofValue> {
Expand Down Expand Up @@ -75,13 +72,11 @@ pub struct PresentationProofValue {

impl PresentationProof {
pub fn new(proof_value: PresentationProofValue, nonce: String) -> Result<PresentationProof> {
Ok(
PresentationProof {
type_: PresentationProofType::AnonCredsPresentationProof2023,
challenge: nonce,
proof_value: proof_value.encode()?,
}
)
Ok(PresentationProof {
type_: PresentationProofType::AnonCredsPresentationProof2023,
challenge: nonce,
proof_value: proof_value.encode()?,
})
}

pub fn get_proof_value(&self) -> Result<PresentationProofValue> {
Expand Down
4 changes: 3 additions & 1 deletion src/services/w3c/credential_conversion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,9 @@ mod tests {
CredentialValuesEncoding::Auto,
));
credential.set_attributes(CredentialAttributes::from(&_cred_values()));
credential.add_anoncreds_signature_proof(CredentialSignatureProof::new(_signature_data()));
credential.add_anoncreds_signature_proof(
CredentialSignatureProof::new(_signature_data()).unwrap(),
);
credential
}

Expand Down
2 changes: 1 addition & 1 deletion src/services/w3c/issuer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ pub fn create_credential(
rev_reg,
witness,
);
let proof = CredentialSignatureProof::new(signature);
let proof = CredentialSignatureProof::new(signature)?;
let credential_schema = CredentialSchema::new(
cred_offer.schema_id.to_owned(),
cred_offer.cred_def_id.to_owned(),
Expand Down
6 changes: 3 additions & 3 deletions src/services/w3c/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ pub fn process_credential(
signature.rev_reg,
signature.witness,
);
*proof = CredentialSignatureProof::new(signature);
*proof = CredentialSignatureProof::new(signature)?;

trace!("process_w3c_credential <<< ");

Expand Down Expand Up @@ -184,7 +184,7 @@ pub fn create_presentation(

let presentation_proof_value = PresentationProofValue::new(cl_proof.aggregated_proof);
let presentation_proof =
PresentationProof::new(presentation_proof_value, pres_req.nonce.to_string());
PresentationProof::new(presentation_proof_value, pres_req.nonce.to_string())?;

let mut presentation = W3CPresentation::new();
presentation.set_proof(presentation_proof);
Expand All @@ -195,7 +195,7 @@ pub fn create_presentation(
let mapping = build_mapping(pres_req, present)?;
let credential_subject = build_credential_subject(pres_req, present)?;
let proof_value = CredentialPresentationProofValue::new(sub_proof);
let proof = CredentialPresentationProof::new(proof_value, mapping, present.timestamp);
let proof = CredentialPresentationProof::new(proof_value, mapping, present.timestamp)?;

let mut credential = present.cred.to_owned();
credential.set_anoncreds_presentation_proof(proof);
Expand Down
1 change: 0 additions & 1 deletion tests/anoncreds_demos.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use anoncreds::data_types::pres_request::PredicateTypes;
use anoncreds::data_types::w3c::credential::CredentialAttributeValue;
use anoncreds::data_types::w3c::credential_proof::CredentialProof;
use anoncreds::data_types::w3c::presentation_proof::{PredicateAttribute, PredicateAttributeType};
use anoncreds::data_types::w3c::uri::URI;
use anoncreds::verifier;
Expand Down

0 comments on commit 9b2bffe

Please sign in to comment.