From 9809fbf00c3221acc0830ec5461614ed579b71cf Mon Sep 17 00:00:00 2001 From: Orual Date: Sat, 8 Nov 2025 13:21:04 -0500 Subject: [PATCH] fixed a minor oddity in cid deser, slightly more permissive re: shapes in json --- Cargo.lock | 102 ++---------------------- crates/jacquard-common/src/types/cid.rs | 11 +++ crates/jacquard-identity/Cargo.toml | 8 +- 3 files changed, 21 insertions(+), 100 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fb07f65c8..30e4d104b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -533,12 +533,6 @@ version = "3.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" -[[package]] -name = "bytecount" -version = "0.6.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "175812e0be2bccb6abe50bb8d566126198344f707e304f45c648fd8f2cc0365e" - [[package]] name = "bytemuck" version = "1.24.0" @@ -572,37 +566,6 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f5c434ae3cf0089ca203e9019ebe529c47ff45cefe8af7c85ecb734ef541822f" -[[package]] -name = "camino" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "276a59bf2b2c967788139340c9f0c5b12d7fd6630315c15c217e559de85d2609" -dependencies = [ - "serde_core", -] - -[[package]] -name = "cargo-platform" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e35af189006b9c0f00a064685c727031e3ed2d8020f7ba284d78cc2671bd36ea" -dependencies = [ - "serde", -] - -[[package]] -name = "cargo_metadata" -version = "0.14.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4acbb09d9ee8e23699b9634375c72795d095bf268439da88562cf9b501f181fa" -dependencies = [ - "camino", - "cargo-platform", - "semver", - "serde", - "serde_json", -] - [[package]] name = "cbor4ii" version = "0.2.14" @@ -1063,19 +1026,6 @@ dependencies = [ "syn 2.0.108", ] -[[package]] -name = "dashmap" -version = "5.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" -dependencies = [ - "cfg-if", - "hashbrown 0.14.5", - "lock_api", - "once_cell", - "parking_lot_core", -] - [[package]] name = "dashmap" version = "6.1.0" @@ -1357,15 +1307,6 @@ dependencies = [ "windows-sys 0.61.2", ] -[[package]] -name = "error-chain" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d2f06b9cac1506ece98fe3231e3cc9c4410ec3d5b1f24ae1c8946f0742cdefc" -dependencies = [ - "version_check", -] - [[package]] name = "expect-json" version = "1.5.0" @@ -2491,7 +2432,7 @@ version = "0.9.1" dependencies = [ "bytes", "cid", - "dashmap 6.1.0", + "dashmap", "heck 0.5.0", "inventory", "jacquard-common", @@ -2520,7 +2461,7 @@ dependencies = [ "base64 0.22.1", "bytes", "chrono", - "dashmap 6.1.0", + "dashmap", "elliptic-curve", "http", "jacquard-common", @@ -2943,17 +2884,16 @@ dependencies = [ [[package]] name = "mini-moka" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c325dfab65f261f386debee8b0969da215b3fa0037e74c8a1234db7ba986d803" +version = "0.11.0" +source = "git+https://github.com/moka-rs/mini-moka?rev=da864e849f5d034f32e02197fee9bb5d5af36d3d#da864e849f5d034f32e02197fee9bb5d5af36d3d" dependencies = [ "crossbeam-channel", "crossbeam-utils", - "dashmap 5.5.3", - "skeptic", + "dashmap", "smallvec", "tagptr", "triomphe", + "web-time", ] [[package]] @@ -3626,17 +3566,6 @@ dependencies = [ "syn 2.0.108", ] -[[package]] -name = "pulldown-cmark" -version = "0.9.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57206b407293d2bcd3af849ce869d52068623f19e1b5ff8e8778e3309439682b" -dependencies = [ - "bitflags", - "memchr", - "unicase", -] - [[package]] name = "pxfm" version = "0.1.25" @@ -4296,10 +4225,6 @@ name = "semver" version = "1.0.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2" -dependencies = [ - "serde", - "serde_core", -] [[package]] name = "send_wrapper" @@ -4554,21 +4479,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d" -[[package]] -name = "skeptic" -version = "0.13.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16d23b015676c90a0f01c197bfdc786c20342c73a0afdda9025adb0bc42940a8" -dependencies = [ - "bytecount", - "cargo_metadata", - "error-chain", - "glob", - "pulldown-cmark", - "tempfile", - "walkdir", -] - [[package]] name = "slab" version = "0.4.11" diff --git a/crates/jacquard-common/src/types/cid.rs b/crates/jacquard-common/src/types/cid.rs index 5afadcd10..f9bbc7b8b 100644 --- a/crates/jacquard-common/src/types/cid.rs +++ b/crates/jacquard-common/src/types/cid.rs @@ -375,6 +375,17 @@ where formatter.write_str("a CID link object with $link field") } + fn visit_str(self, v: &str) -> Result + where + E: serde::de::Error, + { + if let Ok(cid) = IpldCid::try_from(v.as_bytes()) { + Ok(CidLink(Cid::ipld(cid))) + } else { + Err(E::custom("invalid CID string")) + } + } + fn visit_map(self, mut map: A) -> Result where A: serde::de::MapAccess<'de>, diff --git a/crates/jacquard-identity/Cargo.toml b/crates/jacquard-identity/Cargo.toml index 2535d51b7..a169ab868 100644 --- a/crates/jacquard-identity/Cargo.toml +++ b/crates/jacquard-identity/Cargo.toml @@ -37,16 +37,16 @@ serde_html_form.workspace = true urlencoding.workspace = true tracing = { workspace = true, optional = true } n0-future = { workspace = true, optional = true } -# mini-moka = { version = "0.11.0", git = "https://github.com/moka-rs/mini-moka", rev = "da864e849f5d034f32e02197fee9bb5d5af36d3d", optional = true } -mini-moka = { version = "0.10", optional = true } +mini-moka = { version = "0.11.0", git = "https://github.com/moka-rs/mini-moka", rev = "da864e849f5d034f32e02197fee9bb5d5af36d3d", optional = true } +# mini-moka = { version = "0.10", optional = true } [target.'cfg(not(target_family = "wasm"))'.dependencies] hickory-resolver = { optional = true, version = "0.24", default-features = false, features = ["system-config", "tokio-runtime"]} tokio = { workspace = true, features = ["macros", "rt-multi-thread"] } -# [target.'cfg(target_arch = "wasm32")'.dependencies] -# mini-moka = { version = "0.11.0", git = "https://github.com/moka-rs/mini-moka", rev = "da864e849f5d034f32e02197fee9bb5d5af36d3d", features = ["js"] } +[target.'cfg(target_arch = "wasm32")'.dependencies] +mini-moka = { version = "0.11.0", git = "https://github.com/moka-rs/mini-moka", rev = "da864e849f5d034f32e02197fee9bb5d5af36d3d", features = ["js"], optional = true } [[example]] -- 2.51.2