Skip to content

Commit

Permalink
[Update] Update to anoncreds-rs 0.2 (#1213)
Browse files Browse the repository at this point in the history
* test move to 0.2 anoncreds

Signed-off-by: George Mulhearn <gmulhearn@anonyome.com>

* fix fmt

Signed-off-by: George Mulhearn <gmulhearn@anonyome.com>

* retrigger pipeline

Signed-off-by: George Mulhearn <gmulhearn@anonyome.com>

---------

Signed-off-by: George Mulhearn <gmulhearn@anonyome.com>
  • Loading branch information
gmulhearn-anonyome authored Jun 5, 2024
1 parent e629db5 commit ca35f08
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 29 deletions.
14 changes: 7 additions & 7 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion aries/aries_vcx_anoncreds/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ askar_wallet = ["aries_vcx_wallet/askar_wallet"]
[dependencies]
indy-credx = { git = "https://github.com/hyperledger/indy-shared-rs", tag = "v1.1.0", optional = true }
aries_vcx_wallet = { path = "../aries_vcx_wallet" }
anoncreds = { git = "https://github.com/mirgee/anoncreds-rs.git", rev = "a85d739", optional = true }
anoncreds = { git = "https://github.com/hyperledger/anoncreds-rs.git", tag = "v0.2.0", optional = true }
anoncreds_types = { path = "../misc/anoncreds_types" }
did_parser_nom = { path = "../../did_core/did_parser_nom" }
async-trait = "0.1.68"
Expand Down
23 changes: 6 additions & 17 deletions aries/aries_vcx_anoncreds/src/anoncreds/anoncreds/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ use anoncreds::{
Presentation as AnoncredsPresentation, PresentationRequest as AnoncredsPresentationRequest,
RegistryType, RevocationRegistry as AnoncredsRevocationRegistry,
RevocationRegistryDefinition as AnoncredsRevocationRegistryDefinition,
RevocationStatusList,
},
};
use anoncreds_types::data_types::{
Expand All @@ -44,6 +43,7 @@ use anoncreds_types::data_types::{
rev_reg::RevocationRegistry,
rev_reg_def::RevocationRegistryDefinition,
rev_reg_delta::{RevocationRegistryDelta, RevocationRegistryDeltaValue},
rev_status_list::RevocationStatusList,
schema::{AttributeNames, Schema},
},
messages::{
Expand Down Expand Up @@ -104,7 +104,7 @@ fn from_revocation_registry_delta_to_revocation_status_list(

RevocationStatusList::new(
Some(&rev_reg_def_id.to_string()),
rev_reg_def.issuer_id.clone(),
rev_reg_def.issuer_id.clone().convert(())?,
revocation_list,
Some(accum),
timestamp,
Expand Down Expand Up @@ -982,28 +982,17 @@ impl BaseAnonCreds for Anoncreds {
});
let registry = CryptoRevocationRegistry { accum };

// let rev_status_list = create_revocation_status_list(
// &cred_def,
// RevocationRegistryDefinitionId::new_unchecked(issuer_id),
// &revoc_reg_def,
// rev_reg_priv, // No way to construct this from revocation registry currently
// true,
// Some(timestamp),
// );

// TODO: Made public, should find a better way
let rev_status_list = RevocationStatusList::new(
Some(&rev_reg_def_id),
issuer_id,
issuer_id.convert(())?,
revocation_list,
Some(registry),
Some(timestamp),
)?;

let rev_state = anoncreds::prover::create_or_update_revocation_state(
tails_path,
&revoc_reg_def,
&rev_status_list,
&rev_status_list.convert(())?,
cred_rev_id,
None,
None,
Expand Down Expand Up @@ -1201,15 +1190,15 @@ impl BaseAnonCreds for Anoncreds {
&cred_def,
&rev_reg_def.convert(())?,
&rev_reg_def_priv,
&rev_status_list,
&rev_status_list.convert(())?,
None,
Some(vec![cred_rev_id].into_iter().collect()),
None,
)?;

let updated_revocation_registry_delta =
from_revocation_status_list_to_revocation_registry_delta(
&updated_rev_status_list,
&updated_rev_status_list.convert(())?,
Some(prev_accum),
)?;
let updated_revocation_registry_delta_str =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ use anoncreds_types::data_types::{
RevocationRegistryDefinition as OurRevocationRegistryDefinition,
RevocationRegistryDefinitionValue as OurRevocationRegistryDefinitionValue,
},
rev_status_list::RevocationStatusList as OurRevocationStatusList,
schema::{AttributeNames as OurAttributeNames, Schema as OurSchema},
},
messages::{
Expand Down Expand Up @@ -503,15 +504,15 @@ impl Convert for HashMap<OurRevocationRegistryDefinitionId, HashMap<u64, OurRevo
let OurRevocationRegistry { value } = entry;
let registry = CryptoRevocationRegistry { accum: value.accum };

let rev_status_list = AnoncredsRevocationStatusList::new(
let rev_status_list = OurRevocationStatusList::new(
Some(&rev_reg_def_id.to_string()),
issuer_id,
issuer_id.convert(())?,
Default::default(),
Some(registry),
Some(timestamp),
)?;

lists.push(rev_status_list);
lists.push(rev_status_list.convert(())?);
}
}
Ok(lists)
Expand Down Expand Up @@ -577,3 +578,27 @@ impl Convert for OurCredentialRevocationState {
serde_convert(self)
}
}

impl Convert for AnoncredsRevocationStatusList {
type Args = ();

type Target = OurRevocationStatusList;

type Error = Box<dyn std::error::Error>;

fn convert(self, _: Self::Args) -> Result<Self::Target, Self::Error> {
serde_convert(self)
}
}

impl Convert for OurRevocationStatusList {
type Args = ();

type Target = AnoncredsRevocationStatusList;

type Error = Box<dyn std::error::Error>;

fn convert(self, _: Self::Args) -> Result<Self::Target, Self::Error> {
serde_convert(self)
}
}
2 changes: 1 addition & 1 deletion aries/misc/anoncreds_types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ ledger = []
default = ["messages", "ledger"]

[dependencies]
anoncreds-clsignatures = "0.3.1"
anoncreds-clsignatures = "0.3.2"
bitvec = "1.0.1"
log = "0.4.20"
once_cell = "1.19.0"
Expand Down

0 comments on commit ca35f08

Please sign in to comment.