Skip to content

Commit

Permalink
fix: fix for a possible E0401 error in dependent libs (#74)
Browse files Browse the repository at this point in the history
* fix: fix for a possible E0401 error in dependent libs

* fix: cargo lock updated

* fix: E0401 fix

* fix: tests fixed

* fix: tests fixed

* fix: review findings

* fix: doc updated
  • Loading branch information
robert-affinidi authored Dec 17, 2024
1 parent a4c80b5 commit 4b9ed48
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 11 deletions.
8 changes: 4 additions & 4 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 Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ members = [
resolver = "2"

[workspace.package]
version = "0.2.2"
version = "0.2.3"
edition = "2021"
authors = ["Glenn Gore <glenn@affinidi.com>"]
description = "Affinidi DID Resolver"
Expand Down
4 changes: 3 additions & 1 deletion affinidi-did-resolver-cache-sdk/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,9 @@ impl DIDCacheClient {
/// Will return an error if the configuration is invalid.
///
/// Establishes websocket connection and sets up the cache.
pub async fn new(config: ClientConfig) -> Result<Self, DIDCacheError> {
// using Self instead of DIDCacheClient leads to E0401 errors in dependent crates
// this is due to wasm_bindgen generated code (check via `cargo expand`)
pub async fn new(config: ClientConfig) -> Result<DIDCacheClient, DIDCacheError> {
// Create the initial cache
let cache = Cache::builder()
.max_capacity(config.cache_capacity.into())
Expand Down
18 changes: 14 additions & 4 deletions affinidi-did-resolver-cache-sdk/src/resolver/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,13 +200,23 @@ mod tests {
assert_eq!(verification_relationships.key_agreement.len(), 1);

assert_eq!(verification_method.len(), 2);
let first_public_key_jwk = &verification_method.first().unwrap().properties["publicKeyJwk"];
let last_public_key_jwk = &verification_method.last().unwrap().properties["publicKeyJwk"];
assert_eq!(first_public_key_jwk["crv"], "Ed25519");
assert_eq!(first_public_key_jwk["kty"], "OKP");
assert_eq!(
verification_method.first().unwrap().properties["publicKeyMultibase"],
"z6MkiToqovww7vYtxm1xNM15u9JzqzUFZ1k7s7MazYJUyAxv"
first_public_key_jwk["x"],
"O5KzVvRLtJzv8xzpkBjaM3mmUBNF7WE_6e9tGGIM1T8"
);
assert_eq!(last_public_key_jwk["crv"], "secp256k1");
assert_eq!(last_public_key_jwk["kty"], "EC");
assert_eq!(
verification_method.last().unwrap().properties["publicKeyMultibase"],
"zQ3shQLqRUza6AMJFbPuMdvFRFWm1wKviQRnQSC1fScovJN4s"
last_public_key_jwk["x"],
"K4_AlZahXcLOtqnvH45WAMUi97aqQLVs51erkqXP88w"
);
assert_eq!(
last_public_key_jwk["y"],
"QhrSDu7yD1ZKkHBRiuzQkiNppajd1q56Z1s_5Hi8dkA"
);

assert_eq!(service.len(), 1);
Expand Down
2 changes: 1 addition & 1 deletion affinidi-did-resolver-methods/did-peer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -818,7 +818,7 @@ mod test {
let vms_after_expansion = expanded_doc.verification_method;

for vm in vms_after_expansion.clone() {
assert!(vm.id.starts_with("did:key"));
assert!(vm.id.starts_with("did:peer"));
}
assert_eq!(vm_before_expansion.len(), vms_after_expansion.len())
}
Expand Down
21 changes: 21 additions & 0 deletions deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,27 @@ exceptions = [
{ allow = ["MPL-2.0"], crate = "im" },
{ allow = ["MPL-2.0"], crate = "webpki-roots" },
{ allow = ["CC-BY-SA-3.0", "MPL-2.0"], crate = "sized-chunks" },
{ allow = ["Unicode-3.0"], crate = "icu_collections" },
{ allow = ["Unicode-3.0"], crate = "icu_locid" },
{ allow = ["Unicode-3.0"], crate = "icu_locid_transform" },
{ allow = ["Unicode-3.0"], crate = "icu_locid_transform_data" },
{ allow = ["Unicode-3.0"], crate = "icu_normalizer" },
{ allow = ["Unicode-3.0"], crate = "icu_normalizer_data" },
{ allow = ["Unicode-3.0"], crate = "icu_properties" },
{ allow = ["Unicode-3.0"], crate = "icu_properties_data" },
{ allow = ["Unicode-3.0"], crate = "icu_provider" },
{ allow = ["Unicode-3.0"], crate = "icu_provider_macros" },
{ allow = ["Unicode-3.0"], crate = "litemap" },
{ allow = ["Apache-2.0 WITH LLVM-exception", "Unicode-3.0"], crate = "target-lexicon" },
{ allow = ["Unicode-3.0"], crate = "tinystr" },
{ allow = ["Unicode-3.0"], crate = "unicode-ident" },
{ allow = ["Unicode-3.0"], crate = "writeable" },
{ allow = ["Unicode-3.0"], crate = "yoke" },
{ allow = ["Unicode-3.0"], crate = "yoke-derive" },
{ allow = ["Unicode-3.0"], crate = "zerofrom" },
{ allow = ["Unicode-3.0"], crate = "zerofrom-derive" },
{ allow = ["Unicode-3.0"], crate = "zerovec" },
{ allow = ["Unicode-3.0"], crate = "zerovec-derive" },
]

# Sigh
Expand Down

0 comments on commit 4b9ed48

Please sign in to comment.