A better Rust ATProto crate

fixed a minor oddity in cid deser, slightly more permissive re: shapes in json

Orual 9809fbf0 2a41f800

Changed files
+21 -100
crates
jacquard-common
src
types
jacquard-identity
+6 -96
Cargo.lock
··· 534 534 checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" 535 535 536 536 [[package]] 537 - name = "bytecount" 538 - version = "0.6.9" 539 - source = "registry+https://github.com/rust-lang/crates.io-index" 540 - checksum = "175812e0be2bccb6abe50bb8d566126198344f707e304f45c648fd8f2cc0365e" 541 - 542 - [[package]] 543 537 name = "bytemuck" 544 538 version = "1.24.0" 545 539 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 571 565 version = "2.1.0" 572 566 source = "registry+https://github.com/rust-lang/crates.io-index" 573 567 checksum = "f5c434ae3cf0089ca203e9019ebe529c47ff45cefe8af7c85ecb734ef541822f" 574 - 575 - [[package]] 576 - name = "camino" 577 - version = "1.2.1" 578 - source = "registry+https://github.com/rust-lang/crates.io-index" 579 - checksum = "276a59bf2b2c967788139340c9f0c5b12d7fd6630315c15c217e559de85d2609" 580 - dependencies = [ 581 - "serde_core", 582 - ] 583 - 584 - [[package]] 585 - name = "cargo-platform" 586 - version = "0.1.9" 587 - source = "registry+https://github.com/rust-lang/crates.io-index" 588 - checksum = "e35af189006b9c0f00a064685c727031e3ed2d8020f7ba284d78cc2671bd36ea" 589 - dependencies = [ 590 - "serde", 591 - ] 592 - 593 - [[package]] 594 - name = "cargo_metadata" 595 - version = "0.14.2" 596 - source = "registry+https://github.com/rust-lang/crates.io-index" 597 - checksum = "4acbb09d9ee8e23699b9634375c72795d095bf268439da88562cf9b501f181fa" 598 - dependencies = [ 599 - "camino", 600 - "cargo-platform", 601 - "semver", 602 - "serde", 603 - "serde_json", 604 - ] 605 568 606 569 [[package]] 607 570 name = "cbor4ii" ··· 1065 1028 1066 1029 [[package]] 1067 1030 name = "dashmap" 1068 - version = "5.5.3" 1069 - source = "registry+https://github.com/rust-lang/crates.io-index" 1070 - checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" 1071 - dependencies = [ 1072 - "cfg-if", 1073 - "hashbrown 0.14.5", 1074 - "lock_api", 1075 - "once_cell", 1076 - "parking_lot_core", 1077 - ] 1078 - 1079 - [[package]] 1080 - name = "dashmap" 1081 1031 version = "6.1.0" 1082 1032 source = "registry+https://github.com/rust-lang/crates.io-index" 1083 1033 checksum = "5041cc499144891f3790297212f32a74fb938e5136a14943f338ef9e0ae276cf" ··· 1358 1308 ] 1359 1309 1360 1310 [[package]] 1361 - name = "error-chain" 1362 - version = "0.12.4" 1363 - source = "registry+https://github.com/rust-lang/crates.io-index" 1364 - checksum = "2d2f06b9cac1506ece98fe3231e3cc9c4410ec3d5b1f24ae1c8946f0742cdefc" 1365 - dependencies = [ 1366 - "version_check", 1367 - ] 1368 - 1369 - [[package]] 1370 1311 name = "expect-json" 1371 1312 version = "1.5.0" 1372 1313 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 2491 2432 dependencies = [ 2492 2433 "bytes", 2493 2434 "cid", 2494 - "dashmap 6.1.0", 2435 + "dashmap", 2495 2436 "heck 0.5.0", 2496 2437 "inventory", 2497 2438 "jacquard-common", ··· 2520 2461 "base64 0.22.1", 2521 2462 "bytes", 2522 2463 "chrono", 2523 - "dashmap 6.1.0", 2464 + "dashmap", 2524 2465 "elliptic-curve", 2525 2466 "http", 2526 2467 "jacquard-common", ··· 2943 2884 2944 2885 [[package]] 2945 2886 name = "mini-moka" 2946 - version = "0.10.3" 2947 - source = "registry+https://github.com/rust-lang/crates.io-index" 2948 - checksum = "c325dfab65f261f386debee8b0969da215b3fa0037e74c8a1234db7ba986d803" 2887 + version = "0.11.0" 2888 + source = "git+https://github.com/moka-rs/mini-moka?rev=da864e849f5d034f32e02197fee9bb5d5af36d3d#da864e849f5d034f32e02197fee9bb5d5af36d3d" 2949 2889 dependencies = [ 2950 2890 "crossbeam-channel", 2951 2891 "crossbeam-utils", 2952 - "dashmap 5.5.3", 2953 - "skeptic", 2892 + "dashmap", 2954 2893 "smallvec", 2955 2894 "tagptr", 2956 2895 "triomphe", 2896 + "web-time", 2957 2897 ] 2958 2898 2959 2899 [[package]] ··· 3627 3567 ] 3628 3568 3629 3569 [[package]] 3630 - name = "pulldown-cmark" 3631 - version = "0.9.6" 3632 - source = "registry+https://github.com/rust-lang/crates.io-index" 3633 - checksum = "57206b407293d2bcd3af849ce869d52068623f19e1b5ff8e8778e3309439682b" 3634 - dependencies = [ 3635 - "bitflags", 3636 - "memchr", 3637 - "unicase", 3638 - ] 3639 - 3640 - [[package]] 3641 3570 name = "pxfm" 3642 3571 version = "0.1.25" 3643 3572 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 4296 4225 version = "1.0.27" 4297 4226 source = "registry+https://github.com/rust-lang/crates.io-index" 4298 4227 checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2" 4299 - dependencies = [ 4300 - "serde", 4301 - "serde_core", 4302 - ] 4303 4228 4304 4229 [[package]] 4305 4230 name = "send_wrapper" ··· 4553 4478 version = "1.0.1" 4554 4479 source = "registry+https://github.com/rust-lang/crates.io-index" 4555 4480 checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d" 4556 - 4557 - [[package]] 4558 - name = "skeptic" 4559 - version = "0.13.7" 4560 - source = "registry+https://github.com/rust-lang/crates.io-index" 4561 - checksum = "16d23b015676c90a0f01c197bfdc786c20342c73a0afdda9025adb0bc42940a8" 4562 - dependencies = [ 4563 - "bytecount", 4564 - "cargo_metadata", 4565 - "error-chain", 4566 - "glob", 4567 - "pulldown-cmark", 4568 - "tempfile", 4569 - "walkdir", 4570 - ] 4571 4481 4572 4482 [[package]] 4573 4483 name = "slab"
+11
crates/jacquard-common/src/types/cid.rs
··· 375 375 formatter.write_str("a CID link object with $link field") 376 376 } 377 377 378 + fn visit_str<E>(self, v: &str) -> Result<Self::Value, E> 379 + where 380 + E: serde::de::Error, 381 + { 382 + if let Ok(cid) = IpldCid::try_from(v.as_bytes()) { 383 + Ok(CidLink(Cid::ipld(cid))) 384 + } else { 385 + Err(E::custom("invalid CID string")) 386 + } 387 + } 388 + 378 389 fn visit_map<A>(self, mut map: A) -> Result<Self::Value, A::Error> 379 390 where 380 391 A: serde::de::MapAccess<'de>,
+4 -4
crates/jacquard-identity/Cargo.toml
··· 37 37 urlencoding.workspace = true 38 38 tracing = { workspace = true, optional = true } 39 39 n0-future = { workspace = true, optional = true } 40 - # mini-moka = { version = "0.11.0", git = "https://github.com/moka-rs/mini-moka", rev = "da864e849f5d034f32e02197fee9bb5d5af36d3d", optional = true } 41 - mini-moka = { version = "0.10", optional = true } 40 + mini-moka = { version = "0.11.0", git = "https://github.com/moka-rs/mini-moka", rev = "da864e849f5d034f32e02197fee9bb5d5af36d3d", optional = true } 41 + # mini-moka = { version = "0.10", optional = true } 42 42 43 43 [target.'cfg(not(target_family = "wasm"))'.dependencies] 44 44 hickory-resolver = { optional = true, version = "0.24", default-features = false, features = ["system-config", "tokio-runtime"]} 45 45 tokio = { workspace = true, features = ["macros", "rt-multi-thread"] } 46 46 47 47 48 - # [target.'cfg(target_arch = "wasm32")'.dependencies] 49 - # mini-moka = { version = "0.11.0", git = "https://github.com/moka-rs/mini-moka", rev = "da864e849f5d034f32e02197fee9bb5d5af36d3d", features = ["js"] } 48 + [target.'cfg(target_arch = "wasm32")'.dependencies] 49 + mini-moka = { version = "0.11.0", git = "https://github.com/moka-rs/mini-moka", rev = "da864e849f5d034f32e02197fee9bb5d5af36d3d", features = ["js"], optional = true } 50 50 51 51 52 52 [[example]]