Skip to content

Commit

Permalink
Updated credx in migrator
Browse files Browse the repository at this point in the history
Signed-off-by: Bogdan Mircea <[email protected]>
  • Loading branch information
bobozaur committed Aug 10, 2023
1 parent 603c3a9 commit b73683e
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 82 deletions.
69 changes: 4 additions & 65 deletions Cargo.lock

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

12 changes: 0 additions & 12 deletions aries_vcx_core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,6 @@ vdr_proxy_ledger = ["modular_libs", "dep:indy-vdr-proxy-client"]
[dependencies]
agency_client = { path = "../agency_client" }
indy-vdr = { version = "0.3.4", default-features = false, features = ["ffi", "log"], optional = true }
# PATCH (TO MONITOR IN FUTURE): The following patch changes the `indy-data-types` (within indy-shared-rs) to depend on
# `ursa "0.3.6"` rather than `ursa "=0.3.6"`. Currently, `libvdrtools` depends on `ursa "0.3.7"`, which causes a mismatch of
# `indy-utils` versions, which causes some types within credx to fail. Details about the issue can be found here: https://github.com/hyperledger/indy-shared-rs/issues/20
# `indy-data-types` depends on `ursa =0.3.6` due to a 'broken cl feature', see commmit: https://github.com/hyperledger/indy-shared-rs/commit/2403eed6449a3b5e347697b215a732fc33c014c0
# however using ursa 0.3.7 does not seem to affect our usage of indy-credx currently. More testing would be ideal.
# various combinations of indy-vdr and indy-credx have been tried to resolve the dependency mismatches, however this patch appears
# to be the only quick solution.
# Potential resolutions:
# - wait for ursa 0.3.8+ to resolve the CL issue and update indy-shared-rs,
# - monitor anoncred-rs (which will replace indy-credx) as the fix will likely go in here,
# - monitor the issue for other fixes from the maintainers: https://github.com/hyperledger/indy-shared-rs/issues/20
# - update libvdrtools to use =0.3.6 ursa
indy-credx = { git = "https://github.com/hyperledger/indy-shared-rs", tag = "v1.0.1", optional = true }
libvdrtools = { path = "../libvdrtools", optional = true }
indy-api-types = { path = "../libvdrtools/indy-api-types" }
Expand Down
2 changes: 1 addition & 1 deletion wallet_migrator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ edition = "2021"

[dependencies]
aries_vcx_core = { path = "../aries_vcx_core", features = ["modular_libs"] }
credx = { package = "indy-credx", git = "https://github.com/anonyome/indy-shared-rs.git", rev = "7342bc624d23ece8845d1a701cd2cdc9cd401bb0" }
credx = { package = "indy-credx", git = "https://github.com/hyperledger/indy-shared-rs", tag = "v1.0.1" }
vdrtools = { package = "libvdrtools", path = "../libvdrtools" }
serde_json = "1.0.96"
thiserror = "1.0.40"
Expand Down
4 changes: 3 additions & 1 deletion wallet_migrator/src/vdrtools2credx/conv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ pub fn convert_cred_def_priv_key(mut record: Record) -> MigrationResult<Record>
pub fn convert_cred_def_correctness_proof(mut record: Record) -> MigrationResult<Record> {
record.type_ = CATEGORY_CRED_KEY_CORRECTNESS_PROOF.to_owned();
let old: vdrtools::CredentialDefinitionCorrectnessProof = serde_json::from_str(&record.value)?;
let new = credx::types::CredentialKeyCorrectnessProof { value: old.value };
let old_value = serde_json::to_string(&old.value)?;
let new_value = serde_json::from_str(&old_value)?;
let new = credx::types::CredentialKeyCorrectnessProof { value: new_value };
record.value = serde_json::to_string(&new)?;
Ok(record)
}
Expand Down
9 changes: 6 additions & 3 deletions wallet_migrator/src/vdrtools2credx/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ mod tests {
CATEGORY_REV_REG, CATEGORY_REV_REG_DEF, CATEGORY_REV_REG_DEF_PRIV, CATEGORY_REV_REG_DELTA,
CATEGORY_REV_REG_INFO,
};
use credx::ursa::bn::BigNumber;
use credx::{
anoncreds_clsignatures::{bn::BigNumber, LinkSecret as ClLinkSecret},
types::LinkSecret,
};
use serde_json::json;
use vdrtools::{
types::domain::wallet::{Config, Credentials, KeyDerivationMethod},
Expand Down Expand Up @@ -345,8 +348,8 @@ mod tests {
let ms_decimal = get_wallet_item_raw(wallet_handle, CATEGORY_LINK_SECRET).await;
let ms_bn = BigNumber::from_dec(&ms_decimal).unwrap();

let ursa_ms: credx::ursa::cl::MasterSecret = serde_json::from_value(json!({ "ms": ms_bn })).unwrap();
let _ = credx::types::MasterSecret { value: ursa_ms };
let ursa_ms: ClLinkSecret = serde_json::from_value(json!({ "ms": ms_bn })).unwrap();
let _ = LinkSecret { value: ursa_ms };
}

fn make_dummy_master_secret() -> vdrtools::MasterSecret {
Expand Down

0 comments on commit b73683e

Please sign in to comment.