Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[wall] rust core

Neeraj Gupta360e661c431d
diff --git a/rust/wall/Cargo.lock b/rust/wall/Cargo.lock
new file mode 100644
index 0000000000..e2c44a9305
--- /dev/null
+++ b/rust/wall/Cargo.lock
@@ -0,0 +1,2158 @@
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
+version = 4
+
+[[package]]
+name = "aead"
+version = "0.5.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0"
+dependencies = [
+ "crypto-common",
+ "generic-array",
+]
+
+[[package]]
+name = "aho-corasick"
+version = "1.1.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301"
+dependencies = [
+ "memchr",
+]
+
+[[package]]
+name = "argon2"
+version = "0.5.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3c3610892ee6e0cbce8ae2700349fcf8f98adb0dbfbee85aec3c9179d29cc072"
+dependencies = [
+ "base64ct",
+ "blake2",
+ "cpufeatures",
+ "password-hash",
+]
+
+[[package]]
+name = "arrayref"
+version = "0.3.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "76a2e8124351fda1ef8aaaa3bbd7ebbcb486bbcd4225aca0aa0d84bb2db8fecb"
+
+[[package]]
+name = "arrayvec"
+version = "0.7.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50"
+
+[[package]]
+name = "assert-json-diff"
+version = "2.0.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "47e4f2b81832e72834d7518d8487a0396a28cc408186a2e8854c0f98011faf12"
+dependencies = [
+ "serde",
+ "serde_json",
+]
+
+[[package]]
+name = "atomic-waker"
+version = "1.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
+
+[[package]]
+name = "base64"
+version = "0.22.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
+
+[[package]]
+name = "base64ct"
+version = "1.8.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2af50177e190e07a26ab74f8b1efbfe2ef87da2116221318cb1c2e82baf7de06"
+
+[[package]]
+name = "bip39"
+version = "2.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "90dbd31c98227229239363921e60fcf5e558e43ec69094d46fc4996f08d1d5bc"
+dependencies = [
+ "bitcoin_hashes",
+ "serde",
+ "unicode-normalization",
+]
+
+[[package]]
+name = "bitcoin_hashes"
+version = "0.14.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "26ec84b80c482df901772e931a9a681e26a1b9ee2302edeff23cb30328745c8b"
+dependencies = [
+ "hex-conservative",
+]
+
+[[package]]
+name = "bitflags"
+version = "2.11.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c4512299f36f043ab09a583e57bceb5a5aab7a73db1805848e8fef3c9e8c78b3"
+
+[[package]]
+name = "blake2"
+version = "0.10.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe"
+dependencies = [
+ "digest",
+]
+
+[[package]]
+name = "blake2b_simd"
+version = "1.0.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b79834656f71332577234b50bfc009996f7449e0c056884e6a02492ded0ca2f3"
+dependencies = [
+ "arrayref",
+ "arrayvec",
+ "constant_time_eq",
+]
+
+[[package]]
+name = "block-buffer"
+version = "0.10.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71"
+dependencies = [
+ "generic-array",
+]
+
+[[package]]
+name = "block-padding"
+version = "0.3.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a8894febbff9f758034a5b8e12d87918f56dfc64a8e1fe757d65e29041538d93"
+dependencies = [
+ "generic-array",
+]
+
+[[package]]
+name = "bumpalo"
+version = "3.20.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5d20789868f4b01b2f2caec9f5c4e0213b41e3e5702a50157d699ae31ced2fcb"
+
+[[package]]
+name = "bytes"
+version = "1.11.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33"
+
+[[package]]
+name = "cc"
+version = "1.2.60"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "43c5703da9466b66a946814e1adf53ea2c90f10063b86290cc9eb67ce3478a20"
+dependencies = [
+ "find-msvc-tools",
+ "shlex",
+]
+
+[[package]]
+name = "cfg-if"
+version = "1.0.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
+
+[[package]]
+name = "cfg_aliases"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"
+
+[[package]]
+name = "chacha20"
+version = "0.9.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818"
+dependencies = [
+ "cfg-if",
+ "cipher",
+ "cpufeatures",
+]
+
+[[package]]
+name = "cipher"
+version = "0.4.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad"
+dependencies = [
+ "crypto-common",
+ "inout",
+ "zeroize",
+]
+
+[[package]]
+name = "colored"
+version = "3.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "faf9468729b8cbcea668e36183cb69d317348c2e08e994829fb56ebfdfbaac34"
+dependencies = [
+ "windows-sys 0.61.2",
+]
+
+[[package]]
+name = "constant_time_eq"
+version = "0.4.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3d52eff69cd5e647efe296129160853a42795992097e8af39800e1060caeea9b"
+
+[[package]]
+name = "core-foundation"
+version = "0.9.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f"
+dependencies = [
+ "core-foundation-sys",
+ "libc",
+]
+
+[[package]]
+name = "core-foundation"
+version = "0.10.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6"
+dependencies = [
+ "core-foundation-sys",
+ "libc",
+]
+
+[[package]]
+name = "core-foundation-sys"
+version = "0.8.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b"
+
+[[package]]
+name = "cpufeatures"
+version = "0.2.17"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280"
+dependencies = [
+ "libc",
+]
+
+[[package]]
+name = "crypto-common"
+version = "0.1.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a"
+dependencies = [
+ "generic-array",
+ "rand_core 0.6.4",
+ "typenum",
+]
+
+[[package]]
+name = "crypto_secretstream"
+version = "0.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9a6419214057ad50a13efccb3ad7714b86b848e3a5aa7b6cf5a3ff07edf387eb"
+dependencies = [
+ "aead",
+ "chacha20",
+ "getrandom 0.2.17",
+ "poly1305",
+ "rand_core 0.6.4",
+ "subtle",
+]
+
+[[package]]
+name = "curve25519-dalek"
+version = "4.1.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be"
+dependencies = [
+ "cfg-if",
+ "cpufeatures",
+ "curve25519-dalek-derive",
+ "fiat-crypto",
+ "rustc_version",
+ "subtle",
+ "zeroize",
+]
+
+[[package]]
+name = "curve25519-dalek-derive"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "digest"
+version = "0.10.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
+dependencies = [
+ "block-buffer",
+ "crypto-common",
+ "subtle",
+]
+
+[[package]]
+name = "displaydoc"
+version = "0.2.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "encoding_rs"
+version = "0.8.35"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3"
+dependencies = [
+ "cfg-if",
+]
+
+[[package]]
+name = "ente-core"
+version = "0.0.1"
+dependencies = [
+ "argon2",
+ "base64",
+ "bip39",
+ "blake2b_simd",
+ "crypto_secretstream",
+ "getrandom 0.2.17",
+ "hex",
+ "md-5",
+ "rand_core 0.6.4",
+ "reqwest",
+ "salsa20",
+ "serde",
+ "serde_json",
+ "subtle",
+ "thiserror",
+ "x25519-dalek",
+ "xsalsa20poly1305",
+ "zeroize",
+]
+
+[[package]]
+name = "ente-wall"
+version = "0.0.1"
+dependencies = [
+ "base64",
+ "ente-core",
+ "mockito",
+ "serde",
+ "serde_json",
+ "sha2",
+ "thiserror",
+ "tokio",
+ "url",
+ "urlencoding",
+]
+
+[[package]]
+name = "equivalent"
+version = "1.0.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
+
+[[package]]
+name = "fiat-crypto"
+version = "0.2.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d"
+
+[[package]]
+name = "find-msvc-tools"
+version = "0.1.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582"
+
+[[package]]
+name = "fnv"
+version = "1.0.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
+
+[[package]]
+name = "form_urlencoded"
+version = "1.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf"
+dependencies = [
+ "percent-encoding",
+]
+
+[[package]]
+name = "futures-channel"
+version = "0.3.32"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "07bbe89c50d7a535e539b8c17bc0b49bdb77747034daa8087407d655f3f7cc1d"
+dependencies = [
+ "futures-core",
+]
+
+[[package]]
+name = "futures-core"
+version = "0.3.32"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d"
+
+[[package]]
+name = "futures-sink"
+version = "0.3.32"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c39754e157331b013978ec91992bde1ac089843443c49cbc7f46150b0fad0893"
+
+[[package]]
+name = "futures-task"
+version = "0.3.32"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "037711b3d59c33004d3856fbdc83b99d4ff37a24768fa1be9ce3538a1cde4393"
+
+[[package]]
+name = "futures-util"
+version = "0.3.32"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "389ca41296e6190b48053de0321d02a77f32f8a5d2461dd38762c0593805c6d6"
+dependencies = [
+ "futures-core",
+ "futures-task",
+ "pin-project-lite",
+ "slab",
+]
+
+[[package]]
+name = "generic-array"
+version = "0.14.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a"
+dependencies = [
+ "typenum",
+ "version_check",
+]
+
+[[package]]
+name = "getrandom"
+version = "0.2.17"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0"
+dependencies = [
+ "cfg-if",
+ "js-sys",
+ "libc",
+ "wasi",
+ "wasm-bindgen",
+]
+
+[[package]]
+name = "getrandom"
+version = "0.3.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd"
+dependencies = [
+ "cfg-if",
+ "js-sys",
+ "libc",
+ "r-efi",
+ "wasip2",
+ "wasm-bindgen",
+]
+
+[[package]]
+name = "h2"
+version = "0.4.13"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2f44da3a8150a6703ed5d34e164b875fd14c2cdab9af1252a9a1020bde2bdc54"
+dependencies = [
+ "atomic-waker",
+ "bytes",
+ "fnv",
+ "futures-core",
+ "futures-sink",
+ "http",
+ "indexmap",
+ "slab",
+ "tokio",
+ "tokio-util",
+ "tracing",
+]
+
+[[package]]
+name = "hashbrown"
+version = "0.17.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4f467dd6dccf739c208452f8014c75c18bb8301b050ad1cfb27153803edb0f51"
+
+[[package]]
+name = "hex"
+version = "0.4.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
+
+[[package]]
+name = "hex-conservative"
+version = "0.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fda06d18ac606267c40c04e41b9947729bf8b9efe74bd4e82b61a5f26a510b9f"
+dependencies = [
+ "arrayvec",
+]
+
+[[package]]
+name = "http"
+version = "1.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e3ba2a386d7f85a81f119ad7498ebe444d2e22c2af0b86b069416ace48b3311a"
+dependencies = [
+ "bytes",
+ "itoa",
+]
+
+[[package]]
+name = "http-body"
+version = "1.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184"
+dependencies = [
+ "bytes",
+ "http",
+]
+
+[[package]]
+name = "http-body-util"
+version = "0.1.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b021d93e26becf5dc7e1b75b1bed1fd93124b374ceb73f43d4d4eafec896a64a"
+dependencies = [
+ "bytes",
+ "futures-core",
+ "http",
+ "http-body",
+ "pin-project-lite",
+]
+
+[[package]]
+name = "httparse"
+version = "1.10.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87"
+
+[[package]]
+name = "httpdate"
+version = "1.0.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9"
+
+[[package]]
+name = "hyper"
+version = "1.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6299f016b246a94207e63da54dbe807655bf9e00044f73ded42c3ac5305fbcca"
+dependencies = [
+ "atomic-waker",
+ "bytes",
+ "futures-channel",
+ "futures-core",
+ "h2",
+ "http",
+ "http-body",
+ "httparse",
+ "httpdate",
+ "itoa",
+ "pin-project-lite",
+ "smallvec",
+ "tokio",
+ "want",
+]
+
+[[package]]
+name = "hyper-rustls"
+version = "0.27.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "33ca68d021ef39cf6463ab54c1d0f5daf03377b70561305bb89a8f83aab66e0f"
+dependencies = [
+ "http",
+ "hyper",
+ "hyper-util",
+ "rustls",
+ "rustls-native-certs",
+ "tokio",
+ "tokio-rustls",
+ "tower-service",
+ "webpki-roots",
+]
+
+[[package]]
+name = "hyper-util"
+version = "0.1.20"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "96547c2556ec9d12fb1578c4eaf448b04993e7fb79cbaad930a656880a6bdfa0"
+dependencies = [
+ "base64",
+ "bytes",
+ "futures-channel",
+ "futures-util",
+ "http",
+ "http-body",
+ "hyper",
+ "ipnet",
+ "libc",
+ "percent-encoding",
+ "pin-project-lite",
+ "socket2",
+ "system-configuration",
+ "tokio",
+ "tower-service",
+ "tracing",
+ "windows-registry",
+]
+
+[[package]]
+name = "icu_collections"
+version = "2.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2984d1cd16c883d7935b9e07e44071dca8d917fd52ecc02c04d5fa0b5a3f191c"
+dependencies = [
+ "displaydoc",
+ "potential_utf",
+ "utf8_iter",
+ "yoke",
+ "zerofrom",
+ "zerovec",
+]
+
+[[package]]
+name = "icu_locale_core"
+version = "2.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "92219b62b3e2b4d88ac5119f8904c10f8f61bf7e95b640d25ba3075e6cac2c29"
+dependencies = [
+ "displaydoc",
+ "litemap",
+ "tinystr",
+ "writeable",
+ "zerovec",
+]
+
+[[package]]
+name = "icu_normalizer"
+version = "2.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c56e5ee99d6e3d33bd91c5d85458b6005a22140021cc324cea84dd0e72cff3b4"
+dependencies = [
+ "icu_collections",
+ "icu_normalizer_data",
+ "icu_properties",
+ "icu_provider",
+ "smallvec",
+ "zerovec",
+]
+
+[[package]]
+name = "icu_normalizer_data"
+version = "2.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "da3be0ae77ea334f4da67c12f149704f19f81d1adf7c51cf482943e84a2bad38"
+
+[[package]]
+name = "icu_properties"
+version = "2.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bee3b67d0ea5c2cca5003417989af8996f8604e34fb9ddf96208a033901e70de"
+dependencies = [
+ "icu_collections",
+ "icu_locale_core",
+ "icu_properties_data",
+ "icu_provider",
+ "zerotrie",
+ "zerovec",
+]
+
+[[package]]
+name = "icu_properties_data"
+version = "2.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8e2bbb201e0c04f7b4b3e14382af113e17ba4f63e2c9d2ee626b720cbce54a14"
+
+[[package]]
+name = "icu_provider"
+version = "2.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "139c4cf31c8b5f33d7e199446eff9c1e02decfc2f0eec2c8d71f65befa45b421"
+dependencies = [
+ "displaydoc",
+ "icu_locale_core",
+ "writeable",
+ "yoke",
+ "zerofrom",
+ "zerotrie",
+ "zerovec",
+]
+
+[[package]]
+name = "idna"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de"
+dependencies = [
+ "idna_adapter",
+ "smallvec",
+ "utf8_iter",
+]
+
+[[package]]
+name = "idna_adapter"
+version = "1.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344"
+dependencies = [
+ "icu_normalizer",
+ "icu_properties",
+]
+
+[[package]]
+name = "indexmap"
+version = "2.14.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9"
+dependencies = [
+ "equivalent",
+ "hashbrown",
+]
+
+[[package]]
+name = "inout"
+version = "0.1.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01"
+dependencies = [
+ "block-padding",
+ "generic-array",
+]
+
+[[package]]
+name = "ipnet"
+version = "2.12.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d98f6fed1fde3f8c21bc40a1abb88dd75e67924f9cffc3ef95607bad8017f8e2"
+
+[[package]]
+name = "iri-string"
+version = "0.7.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "25e659a4bb38e810ebc252e53b5814ff908a8c58c2a9ce2fae1bbec24cbf4e20"
+dependencies = [
+ "memchr",
+ "serde",
+]
+
+[[package]]
+name = "itoa"
+version = "1.0.18"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682"
+
+[[package]]
+name = "js-sys"
+version = "0.3.95"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2964e92d1d9dc3364cae4d718d93f227e3abb088e747d92e0395bfdedf1c12ca"
+dependencies = [
+ "cfg-if",
+ "futures-util",
+ "once_cell",
+ "wasm-bindgen",
+]
+
+[[package]]
+name = "libc"
+version = "0.2.185"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "52ff2c0fe9bc6cb6b14a0592c2ff4fa9ceb83eea9db979b0487cd054946a2b8f"
+
+[[package]]
+name = "litemap"
+version = "0.8.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "92daf443525c4cce67b150400bc2316076100ce0b3686209eb8cf3c31612e6f0"
+
+[[package]]
+name = "lock_api"
+version = "0.4.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965"
+dependencies = [
+ "scopeguard",
+]
+
+[[package]]
+name = "log"
+version = "0.4.29"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897"
+
+[[package]]
+name = "lru-slab"
+version = "0.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154"
+
+[[package]]
+name = "md-5"
+version = "0.10.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf"
+dependencies = [
+ "cfg-if",
+ "digest",
+]
+
+[[package]]
+name = "memchr"
+version = "2.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79"
+
+[[package]]
+name = "mime"
+version = "0.3.17"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a"
+
+[[package]]
+name = "mio"
+version = "1.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "50b7e5b27aa02a74bac8c3f23f448f8d87ff11f92d3aac1a6ed369ee08cc56c1"
+dependencies = [
+ "libc",
+ "wasi",
+ "windows-sys 0.61.2",
+]
+
+[[package]]
+name = "mockito"
+version = "1.7.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "90820618712cab19cfc46b274c6c22546a82affcb3c3bdf0f29e3db8e1bb92c0"
+dependencies = [
+ "assert-json-diff",
+ "bytes",
+ "colored",
+ "futures-core",
+ "http",
+ "http-body",
+ "http-body-util",
+ "hyper",
+ "hyper-util",
+ "log",
+ "pin-project-lite",
+ "rand",
+ "regex",
+ "serde_json",
+ "serde_urlencoded",
+ "similar",
+ "tokio",
+]
+
+[[package]]
+name = "once_cell"
+version = "1.21.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
+
+[[package]]
+name = "opaque-debug"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381"
+
+[[package]]
+name = "openssl-probe"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7c87def4c32ab89d880effc9e097653c8da5d6ef28e6b539d313baaacfbafcbe"
+
+[[package]]
+name = "parking_lot"
+version = "0.12.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a"
+dependencies = [
+ "lock_api",
+ "parking_lot_core",
+]
+
+[[package]]
+name = "parking_lot_core"
+version = "0.9.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1"
+dependencies = [
+ "cfg-if",
+ "libc",
+ "redox_syscall",
+ "smallvec",
+ "windows-link",
+]
+
+[[package]]
+name = "password-hash"
+version = "0.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "346f04948ba92c43e8469c1ee6736c7563d71012b17d40745260fe106aac2166"
+dependencies = [
+ "base64ct",
+ "rand_core 0.6.4",
+ "subtle",
+]
+
+[[package]]
+name = "percent-encoding"
+version = "2.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220"
+
+[[package]]
+name = "pin-project-lite"
+version = "0.2.17"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd"
+
+[[package]]
+name = "poly1305"
+version = "0.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8159bd90725d2df49889a078b54f4f79e87f1f8a8444194cdca81d38f5393abf"
+dependencies = [
+ "cpufeatures",
+ "opaque-debug",
+ "universal-hash",
+]
+
+[[package]]
+name = "potential_utf"
+version = "0.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0103b1cef7ec0cf76490e969665504990193874ea05c85ff9bab8b911d0a0564"
+dependencies = [
+ "zerovec",
+]
+
+[[package]]
+name = "ppv-lite86"
+version = "0.2.21"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9"
+dependencies = [
+ "zerocopy",
+]
+
+[[package]]
+name = "proc-macro2"
+version = "1.0.106"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934"
+dependencies = [
+ "unicode-ident",
+]
+
+[[package]]
+name = "quinn"
+version = "0.11.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b9e20a958963c291dc322d98411f541009df2ced7b5a4f2bd52337638cfccf20"
+dependencies = [
+ "bytes",
+ "cfg_aliases",
+ "pin-project-lite",
+ "quinn-proto",
+ "quinn-udp",
+ "rustc-hash",
+ "rustls",
+ "socket2",
+ "thiserror",
+ "tokio",
+ "tracing",
+ "web-time",
+]
+
+[[package]]
+name = "quinn-proto"
+version = "0.11.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "434b42fec591c96ef50e21e886936e66d3cc3f737104fdb9b737c40ffb94c098"
+dependencies = [
+ "bytes",
+ "getrandom 0.3.4",
+ "lru-slab",
+ "rand",
+ "ring",
+ "rustc-hash",
+ "rustls",
+ "rustls-pki-types",
+ "slab",
+ "thiserror",
+ "tinyvec",
+ "tracing",
+ "web-time",
+]
+
+[[package]]
+name = "quinn-udp"
+version = "0.5.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "addec6a0dcad8a8d96a771f815f0eaf55f9d1805756410b39f5fa81332574cbd"
+dependencies = [
+ "cfg_aliases",
+ "libc",
+ "once_cell",
+ "socket2",
+ "tracing",
+ "windows-sys 0.60.2",
+]
+
+[[package]]
+name = "quote"
+version = "1.0.45"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924"
+dependencies = [
+ "proc-macro2",
+]
+
+[[package]]
+name = "r-efi"
+version = "5.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f"
+
+[[package]]
+name = "rand"
+version = "0.9.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "44c5af06bb1b7d3216d91932aed5265164bf384dc89cd6ba05cf59a35f5f76ea"
+dependencies = [
+ "rand_chacha",
+ "rand_core 0.9.5",
+]
+
+[[package]]
+name = "rand_chacha"
+version = "0.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb"
+dependencies = [
+ "ppv-lite86",
+ "rand_core 0.9.5",
+]
+
+[[package]]
+name = "rand_core"
+version = "0.6.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
+dependencies = [
+ "getrandom 0.2.17",
+]
+
+[[package]]
+name = "rand_core"
+version = "0.9.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c"
+dependencies = [
+ "getrandom 0.3.4",
+]
+
+[[package]]
+name = "redox_syscall"
+version = "0.5.18"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d"
+dependencies = [
+ "bitflags",
+]
+
+[[package]]
+name = "regex"
+version = "1.12.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e10754a14b9137dd7b1e3e5b0493cc9171fdd105e0ab477f51b72e7f3ac0e276"
+dependencies = [
+ "aho-corasick",
+ "memchr",
+ "regex-automata",
+ "regex-syntax",
+]
+
+[[package]]
+name = "regex-automata"
+version = "0.4.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f"
+dependencies = [
+ "aho-corasick",
+ "memchr",
+ "regex-syntax",
+]
+
+[[package]]
+name = "regex-syntax"
+version = "0.8.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dc897dd8d9e8bd1ed8cdad82b5966c3e0ecae09fb1907d58efaa013543185d0a"
+
+[[package]]
+name = "reqwest"
+version = "0.12.28"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "eddd3ca559203180a307f12d114c268abf583f59b03cb906fd0b3ff8646c1147"
+dependencies = [
+ "base64",
+ "bytes",
+ "encoding_rs",
+ "futures-core",
+ "h2",
+ "http",
+ "http-body",
+ "http-body-util",
+ "hyper",
+ "hyper-rustls",
+ "hyper-util",
+ "js-sys",
+ "log",
+ "mime",
+ "percent-encoding",
+ "pin-project-lite",
+ "quinn",
+ "rustls",
+ "rustls-native-certs",
+ "rustls-pki-types",
+ "serde",
+ "serde_json",
+ "serde_urlencoded",
+ "sync_wrapper",
+ "tokio",
+ "tokio-rustls",
+ "tower",
+ "tower-http",
+ "tower-service",
+ "url",
+ "wasm-bindgen",
+ "wasm-bindgen-futures",
+ "web-sys",
+ "webpki-roots",
+]
+
+[[package]]
+name = "ring"
+version = "0.17.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7"
+dependencies = [
+ "cc",
+ "cfg-if",
+ "getrandom 0.2.17",
+ "libc",
+ "untrusted",
+ "windows-sys 0.52.0",
+]
+
+[[package]]
+name = "rustc-hash"
+version = "2.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "94300abf3f1ae2e2b8ffb7b58043de3d399c73fa6f4b73826402a5c457614dbe"
+
+[[package]]
+name = "rustc_version"
+version = "0.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92"
+dependencies = [
+ "semver",
+]
+
+[[package]]
+name = "rustls"
+version = "0.23.38"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "69f9466fb2c14ea04357e91413efb882e2a6d4a406e625449bc0a5d360d53a21"
+dependencies = [
+ "once_cell",
+ "ring",
+ "rustls-pki-types",
+ "rustls-webpki",
+ "subtle",
+ "zeroize",
+]
+
+[[package]]
+name = "rustls-native-certs"
+version = "0.8.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "612460d5f7bea540c490b2b6395d8e34a953e52b491accd6c86c8164c5932a63"
+dependencies = [
+ "openssl-probe",
+ "rustls-pki-types",
+ "schannel",
+ "security-framework",
+]
+
+[[package]]
+name = "rustls-pki-types"
+version = "1.14.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "be040f8b0a225e40375822a563fa9524378b9d63112f53e19ffff34df5d33fdd"
+dependencies = [
+ "web-time",
+ "zeroize",
+]
+
+[[package]]
+name = "rustls-webpki"
+version = "0.103.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8279bb85272c9f10811ae6a6c547ff594d6a7f3c6c6b02ee9726d1d0dcfcdd06"
+dependencies = [
+ "ring",
+ "rustls-pki-types",
+ "untrusted",
+]
+
+[[package]]
+name = "rustversion"
+version = "1.0.22"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d"
+
+[[package]]
+name = "ryu"
+version = "1.0.23"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f"
+
+[[package]]
+name = "salsa20"
+version = "0.10.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "97a22f5af31f73a954c10289c93e8a50cc23d971e80ee446f1f6f7137a088213"
+dependencies = [
+ "cipher",
+]
+
+[[package]]
+name = "schannel"
+version = "0.1.29"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "91c1b7e4904c873ef0710c1f407dde2e6287de2bebc1bbbf7d430bb7cbffd939"
+dependencies = [
+ "windows-sys 0.61.2",
+]
+
+[[package]]
+name = "scopeguard"
+version = "1.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
+
+[[package]]
+name = "security-framework"
+version = "3.7.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b7f4bc775c73d9a02cde8bf7b2ec4c9d12743edf609006c7facc23998404cd1d"
+dependencies = [
+ "bitflags",
+ "core-foundation 0.10.1",
+ "core-foundation-sys",
+ "libc",
+ "security-framework-sys",
+]
+
+[[package]]
+name = "security-framework-sys"
+version = "2.17.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6ce2691df843ecc5d231c0b14ece2acc3efb62c0a398c7e1d875f3983ce020e3"
+dependencies = [
+ "core-foundation-sys",
+ "libc",
+]
+
+[[package]]
+name = "semver"
+version = "1.0.28"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd"
+
+[[package]]
+name = "serde"
+version = "1.0.228"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e"
+dependencies = [
+ "serde_core",
+ "serde_derive",
+]
+
+[[package]]
+name = "serde_core"
+version = "1.0.228"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad"
+dependencies = [
+ "serde_derive",
+]
+
+[[package]]
+name = "serde_derive"
+version = "1.0.228"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "serde_json"
+version = "1.0.149"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86"
+dependencies = [
+ "itoa",
+ "memchr",
+ "serde",
+ "serde_core",
+ "zmij",
+]
+
+[[package]]
+name = "serde_urlencoded"
+version = "0.7.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd"
+dependencies = [
+ "form_urlencoded",
+ "itoa",
+ "ryu",
+ "serde",
+]
+
+[[package]]
+name = "sha2"
+version = "0.10.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283"
+dependencies = [
+ "cfg-if",
+ "cpufeatures",
+ "digest",
+]
+
+[[package]]
+name = "shlex"
+version = "1.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
+
+[[package]]
+name = "similar"
+version = "2.7.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bbbb5d9659141646ae647b42fe094daf6c6192d1620870b449d9557f748b2daa"
+
+[[package]]
+name = "slab"
+version = "0.4.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5"
+
+[[package]]
+name = "smallvec"
+version = "1.15.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03"
+
+[[package]]
+name = "socket2"
+version = "0.6.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3a766e1110788c36f4fa1c2b71b387a7815aa65f88ce0229841826633d93723e"
+dependencies = [
+ "libc",
+ "windows-sys 0.61.2",
+]
+
+[[package]]
+name = "stable_deref_trait"
+version = "1.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596"
+
+[[package]]
+name = "subtle"
+version = "2.6.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
+
+[[package]]
+name = "syn"
+version = "2.0.117"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "unicode-ident",
+]
+
+[[package]]
+name = "sync_wrapper"
+version = "1.0.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263"
+dependencies = [
+ "futures-core",
+]
+
+[[package]]
+name = "synstructure"
+version = "0.13.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "system-configuration"
+version = "0.7.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a13f3d0daba03132c0aa9767f98351b3488edc2c100cda2d2ec2b04f3d8d3c8b"
+dependencies = [
+ "bitflags",
+ "core-foundation 0.9.4",
+ "system-configuration-sys",
+]
+
+[[package]]
+name = "system-configuration-sys"
+version = "0.6.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4"
+dependencies = [
+ "core-foundation-sys",
+ "libc",
+]
+
+[[package]]
+name = "thiserror"
+version = "2.0.18"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4"
+dependencies = [
+ "thiserror-impl",
+]
+
+[[package]]
+name = "thiserror-impl"
+version = "2.0.18"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "tinystr"
+version = "0.8.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c8323304221c2a851516f22236c5722a72eaa19749016521d6dff0824447d96d"
+dependencies = [
+ "displaydoc",
+ "zerovec",
+]
+
+[[package]]
+name = "tinyvec"
+version = "1.11.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3e61e67053d25a4e82c844e8424039d9745781b3fc4f32b8d55ed50f5f667ef3"
+dependencies = [
+ "tinyvec_macros",
+]
+
+[[package]]
+name = "tinyvec_macros"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
+
+[[package]]
+name = "tokio"
+version = "1.52.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b67dee974fe86fd92cc45b7a95fdd2f99a36a6d7b0d431a231178d3d670bbcc6"
+dependencies = [
+ "bytes",
+ "libc",
+ "mio",
+ "parking_lot",
+ "pin-project-lite",
+ "socket2",
+ "tokio-macros",
+ "windows-sys 0.61.2",
+]
+
+[[package]]
+name = "tokio-macros"
+version = "2.7.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "385a6cb71ab9ab790c5fe8d67f1645e6c450a7ce006a33de03daa956cf70a496"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "tokio-rustls"
+version = "0.26.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1729aa945f29d91ba541258c8df89027d5792d85a8841fb65e8bf0f4ede4ef61"
+dependencies = [
+ "rustls",
+ "tokio",
+]
+
+[[package]]
+name = "tokio-util"
+version = "0.7.18"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9ae9cec805b01e8fc3fd2fe289f89149a9b66dd16786abd8b19cfa7b48cb0098"
+dependencies = [
+ "bytes",
+ "futures-core",
+ "futures-sink",
+ "pin-project-lite",
+ "tokio",
+]
+
+[[package]]
+name = "tower"
+version = "0.5.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4"
+dependencies = [
+ "futures-core",
+ "futures-util",
+ "pin-project-lite",
+ "sync_wrapper",
+ "tokio",
+ "tower-layer",
+ "tower-service",
+]
+
+[[package]]
+name = "tower-http"
+version = "0.6.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d4e6559d53cc268e5031cd8429d05415bc4cb4aefc4aa5d6cc35fbf5b924a1f8"
+dependencies = [
+ "bitflags",
+ "bytes",
+ "futures-util",
+ "http",
+ "http-body",
+ "iri-string",
+ "pin-project-lite",
+ "tower",
+ "tower-layer",
+ "tower-service",
+]
+
+[[package]]
+name = "tower-layer"
+version = "0.3.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e"
+
+[[package]]
+name = "tower-service"
+version = "0.3.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3"
+
+[[package]]
+name = "tracing"
+version = "0.1.44"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100"
+dependencies = [
+ "pin-project-lite",
+ "tracing-core",
+]
+
+[[package]]
+name = "tracing-core"
+version = "0.1.36"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a"
+dependencies = [
+ "once_cell",
+]
+
+[[package]]
+name = "try-lock"
+version = "0.2.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b"
+
+[[package]]
+name = "typenum"
+version = "1.19.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb"
+
+[[package]]
+name = "unicode-ident"
+version = "1.0.24"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
+
+[[package]]
+name = "unicode-normalization"
+version = "0.1.25"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5fd4f6878c9cb28d874b009da9e8d183b5abc80117c40bbd187a1fde336be6e8"
+dependencies = [
+ "tinyvec",
+]
+
+[[package]]
+name = "universal-hash"
+version = "0.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea"
+dependencies = [
+ "crypto-common",
+ "subtle",
+]
+
+[[package]]
+name = "untrusted"
+version = "0.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"
+
+[[package]]
+name = "url"
+version = "2.5.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed"
+dependencies = [
+ "form_urlencoded",
+ "idna",
+ "percent-encoding",
+ "serde",
+]
+
+[[package]]
+name = "urlencoding"
+version = "2.1.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da"
+
+[[package]]
+name = "utf8_iter"
+version = "1.0.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be"
+
+[[package]]
+name = "version_check"
+version = "0.9.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
+
+[[package]]
+name = "want"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e"
+dependencies = [
+ "try-lock",
+]
+
+[[package]]
+name = "wasi"
+version = "0.11.1+wasi-snapshot-preview1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"
+
+[[package]]
+name = "wasip2"
+version = "1.0.3+wasi-0.2.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "20064672db26d7cdc89c7798c48a0fdfac8213434a1186e5ef29fd560ae223d6"
+dependencies = [
+ "wit-bindgen",
+]
+
+[[package]]
+name = "wasm-bindgen"
+version = "0.2.118"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0bf938a0bacb0469e83c1e148908bd7d5a6010354cf4fb73279b7447422e3a89"
+dependencies = [
+ "cfg-if",
+ "once_cell",
+ "rustversion",
+ "wasm-bindgen-macro",
+ "wasm-bindgen-shared",
+]
+
+[[package]]
+name = "wasm-bindgen-futures"
+version = "0.4.68"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f371d383f2fb139252e0bfac3b81b265689bf45b6874af544ffa4c975ac1ebf8"
+dependencies = [
+ "js-sys",
+ "wasm-bindgen",
+]
+
+[[package]]
+name = "wasm-bindgen-macro"
+version = "0.2.118"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "eeff24f84126c0ec2db7a449f0c2ec963c6a49efe0698c4242929da037ca28ed"
+dependencies = [
+ "quote",
+ "wasm-bindgen-macro-support",
+]
+
+[[package]]
+name = "wasm-bindgen-macro-support"
+version = "0.2.118"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9d08065faf983b2b80a79fd87d8254c409281cf7de75fc4b773019824196c904"
+dependencies = [
+ "bumpalo",
+ "proc-macro2",
+ "quote",
+ "syn",
+ "wasm-bindgen-shared",
+]
+
+[[package]]
+name = "wasm-bindgen-shared"
+version = "0.2.118"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5fd04d9e306f1907bd13c6361b5c6bfc7b3b3c095ed3f8a9246390f8dbdee129"
+dependencies = [
+ "unicode-ident",
+]
+
+[[package]]
+name = "web-sys"
+version = "0.3.95"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4f2dfbb17949fa2088e5d39408c48368947b86f7834484e87b73de55bc14d97d"
+dependencies = [
+ "js-sys",
+ "wasm-bindgen",
+]
+
+[[package]]
+name = "web-time"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb"
+dependencies = [
+ "js-sys",
+ "wasm-bindgen",
+]
+
+[[package]]
+name = "webpki-roots"
+version = "1.0.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "52f5ee44c96cf55f1b349600768e3ece3a8f26010c05265ab73f945bb1a2eb9d"
+dependencies = [
+ "rustls-pki-types",
+]
+
+[[package]]
+name = "windows-link"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
+
+[[package]]
+name = "windows-registry"
+version = "0.6.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "02752bf7fbdcce7f2a27a742f798510f3e5ad88dbe84871e5168e2120c3d5720"
+dependencies = [
+ "windows-link",
+ "windows-result",
+ "windows-strings",
+]
+
+[[package]]
+name = "windows-result"
+version = "0.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5"
+dependencies = [
+ "windows-link",
+]
+
+[[package]]
+name = "windows-strings"
+version = "0.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091"
+dependencies = [
+ "windows-link",
+]
+
+[[package]]
+name = "windows-sys"
+version = "0.52.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
+dependencies = [
+ "windows-targets 0.52.6",
+]
+
+[[package]]
+name = "windows-sys"
+version = "0.60.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb"
+dependencies = [
+ "windows-targets 0.53.5",
+]
+
+[[package]]
+name = "windows-sys"
+version = "0.61.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc"
+dependencies = [
+ "windows-link",
+]
+
+[[package]]
+name = "windows-targets"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
+dependencies = [
+ "windows_aarch64_gnullvm 0.52.6",
+ "windows_aarch64_msvc 0.52.6",
+ "windows_i686_gnu 0.52.6",
+ "windows_i686_gnullvm 0.52.6",
+ "windows_i686_msvc 0.52.6",
+ "windows_x86_64_gnu 0.52.6",
+ "windows_x86_64_gnullvm 0.52.6",
+ "windows_x86_64_msvc 0.52.6",
+]
+
+[[package]]
+name = "windows-targets"
+version = "0.53.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3"
+dependencies = [
+ "windows-link",
+ "windows_aarch64_gnullvm 0.53.1",
+ "windows_aarch64_msvc 0.53.1",
+ "windows_i686_gnu 0.53.1",
+ "windows_i686_gnullvm 0.53.1",
+ "windows_i686_msvc 0.53.1",
+ "windows_x86_64_gnu 0.53.1",
+ "windows_x86_64_gnullvm 0.53.1",
+ "windows_x86_64_msvc 0.53.1",
+]
+
+[[package]]
+name = "windows_aarch64_gnullvm"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
+
+[[package]]
+name = "windows_aarch64_gnullvm"
+version = "0.53.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53"
+
+[[package]]
+name = "windows_aarch64_msvc"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
+
+[[package]]
+name = "windows_aarch64_msvc"
+version = "0.53.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006"
+
+[[package]]
+name = "windows_i686_gnu"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
+
+[[package]]
+name = "windows_i686_gnu"
+version = "0.53.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3"
+
+[[package]]
+name = "windows_i686_gnullvm"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
+
+[[package]]
+name = "windows_i686_gnullvm"
+version = "0.53.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c"
+
+[[package]]
+name = "windows_i686_msvc"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
+
+[[package]]
+name = "windows_i686_msvc"
+version = "0.53.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2"
+
+[[package]]
+name = "windows_x86_64_gnu"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
+
+[[package]]
+name = "windows_x86_64_gnu"
+version = "0.53.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499"
+
+[[package]]
+name = "windows_x86_64_gnullvm"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
+
+[[package]]
+name = "windows_x86_64_gnullvm"
+version = "0.53.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1"
+
+[[package]]
+name = "windows_x86_64_msvc"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
+
+[[package]]
+name = "windows_x86_64_msvc"
+version = "0.53.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650"
+
+[[package]]
+name = "wit-bindgen"
+version = "0.57.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e"
+
+[[package]]
+name = "writeable"
+version = "0.6.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1ffae5123b2d3fc086436f8834ae3ab053a283cfac8fe0a0b8eaae044768a4c4"
+
+[[package]]
+name = "x25519-dalek"
+version = "2.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c7e468321c81fb07fa7f4c636c3972b9100f0346e5b6a9f2bd0603a52f7ed277"
+dependencies = [
+ "curve25519-dalek",
+ "rand_core 0.6.4",
+ "serde",
+ "zeroize",
+]
+
+[[package]]
+name = "xsalsa20poly1305"
+version = "0.9.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "02a6dad357567f81cd78ee75f7c61f1b30bb2fe4390be8fb7c69e2ac8dffb6c7"
+dependencies = [
+ "aead",
+ "poly1305",
+ "salsa20",
+ "subtle",
+ "zeroize",
+]
+
+[[package]]
+name = "yoke"
+version = "0.8.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "abe8c5fda708d9ca3df187cae8bfb9ceda00dd96231bed36e445a1a48e66f9ca"
+dependencies = [
+ "stable_deref_trait",
+ "yoke-derive",
+ "zerofrom",
+]
+
+[[package]]
+name = "yoke-derive"
+version = "0.8.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "de844c262c8848816172cef550288e7dc6c7b7814b4ee56b3e1553f275f1858e"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+ "synstructure",
+]
+
+[[package]]
+name = "zerocopy"
+version = "0.8.48"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "eed437bf9d6692032087e337407a86f04cd8d6a16a37199ed57949d415bd68e9"
+dependencies = [
+ "zerocopy-derive",
+]
+
+[[package]]
+name = "zerocopy-derive"
+version = "0.8.48"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "70e3cd084b1788766f53af483dd21f93881ff30d7320490ec3ef7526d203bad4"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "zerofrom"
+version = "0.1.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "69faa1f2a1ea75661980b013019ed6687ed0e83d069bc1114e2cc74c6c04c4df"
+dependencies = [
+ "zerofrom-derive",
+]
+
+[[package]]
+name = "zerofrom-derive"
+version = "0.1.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "11532158c46691caf0f2593ea8358fed6bbf68a0315e80aae9bd41fbade684a1"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+ "synstructure",
+]
+
+[[package]]
+name = "zeroize"
+version = "1.8.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0"
+dependencies = [
+ "zeroize_derive",
+]
+
+[[package]]
+name = "zeroize_derive"
+version = "1.4.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "85a5b4158499876c763cb03bc4e49185d3cccbabb15b33c627f7884f43db852e"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "zerotrie"
+version = "0.2.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0f9152d31db0792fa83f70fb2f83148effb5c1f5b8c7686c3459e361d9bc20bf"
+dependencies = [
+ "displaydoc",
+ "yoke",
+ "zerofrom",
+]
+
+[[package]]
+name = "zerovec"
+version = "0.11.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "90f911cbc359ab6af17377d242225f4d75119aec87ea711a880987b18cd7b239"
+dependencies = [
+ "yoke",
+ "zerofrom",
+ "zerovec-derive",
+]
+
+[[package]]
+name = "zerovec-derive"
+version = "0.11.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "625dc425cab0dca6dc3c3319506e6593dcb08a9f387ea3b284dbd52a92c40555"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "zmij"
+version = "1.0.21"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa"
diff --git a/rust/wall/Cargo.toml b/rust/wall/Cargo.toml
new file mode 100644
index 0000000000..36f284e96e
--- /dev/null
+++ b/rust/wall/Cargo.toml
@@ -0,0 +1,18 @@
+[package]
+name = "ente-wall"
+version = "0.0.1"
+edition = "2024"
+
+[dependencies]
+base64 = "0.22"
+ente-core = { path = "../core" }
+serde = { version = "1", features = ["derive"] }
+sha2 = "0.10"
+thiserror = "2"
+url = "2"
+urlencoding = "2"
+
+[dev-dependencies]
+mockito = "1.6"
+serde_json = "1"
+tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
diff --git a/rust/wall/src/client.rs b/rust/wall/src/client.rs
new file mode 100644
index 0000000000..592549440c
--- /dev/null
+++ b/rust/wall/src/client.rs
@@ -0,0 +1,1874 @@
+use std::collections::BTreeMap;
+
+use crate::crypto::{
+ decode_b64, decode_b64_url, decrypt_entity_key, decrypt_secretbox_packed, derive_labeled_key,
+ encode_b64, encode_b64_url, encrypt_asset_payload, encrypt_entity_key,
+ encrypt_secretbox_packed, generate_key, pack_payload, unpack_payload,
+};
+use crate::error::{Result, WallError};
+use crate::models::{
+ CreatedWall, CreatedWallLink, DecryptedComment, DecryptedFollowShare, DecryptedPost,
+ DecryptedWallProfile, FeedItem, FeedPage, HydratedKeys, OpenAccountWallCtxInput,
+ OpenWallLinkCtxInput, PrivateKeySource,
+};
+use crate::transport::{
+ ApproveFollowPayload, AssetDownloadResponse, CancelFollowRequestPayload, CommentResponse,
+ CommunityResponse, CreateCommentRequest, CreateEntityKeyRequest, CreatePostRequest,
+ CreatePostResponse, CreateWallRequest, EntityKeyPayload, EntityKeyResponse,
+ FollowRequestCreatedResponse, FollowRequestPayload, FollowRequestResponse, FollowShareResponse,
+ LikePostRequest, LikePostResponse, ListCommentsResponse, OutgoingFollowRequestResponse,
+ PostObjectPayload, PostResponse, PresignUploadRequest, PresignUploadResponse,
+ ProfileAvatarPayload, RefreshFollowSharesRequest, RejectFollowPayload, RotateWallKeyRequest,
+ ShareUpdatePayload, StatusResponse, UpdatePostCaptionRequest, UpdateWallProfileRequest,
+ UpdateWallProfileResponse, UpdateWallSlugRequest, UpdatedCountResponse, WallFollowerResponse,
+ WallKeyResponse, WallKeyVersionResponse, WallLinkCreateRequest, WallLinkLoginRequest,
+ WallLinkLoginResponse, WallLinkStatusResponse, WallLookupResponse, WallProfileResponse,
+};
+use ente_core::crypto::{sealed, secretbox};
+use ente_core::http::{Error as HttpError, HttpClient, HttpConfig};
+
+const ROOT_WALL_KEY_TYPE: &str = "root_wall_key";
+const WALL_LINK_AUTH_LABEL: &str = "wall-link-login-v1";
+const WALL_LINK_WRAP_LABEL: &str = "wall-link-view-v1";
+const UPLOAD_PURPOSE_AVATAR: &str = "avatar";
+
+#[derive(Debug, Clone)]
+struct ResolvedWallAccess {
+ wall_key: Vec<u8>,
+ key_version: i32,
+}
+
+pub struct AccountWallCtx {
+ client: HttpClient,
+ base_url: String,
+ master_key: Vec<u8>,
+ public_key: Vec<u8>,
+ private_key: Vec<u8>,
+ user_id: Option<i64>,
+}
+
+pub struct WallLinkCtx {
+ client: HttpClient,
+ base_url: String,
+ owner_handle: String,
+ wall_id: String,
+ wall_slug: String,
+ wall_key: Vec<u8>,
+ key_version: i32,
+}
+
+impl AccountWallCtx {
+ pub fn open(input: OpenAccountWallCtxInput) -> Result<Self> {
+ let client = build_http_client(
+ &input.base_url,
+ Some(input.auth_token),
+ input.user_agent,
+ input.client_package,
+ input.client_version,
+ )?;
+ let private_key = decrypt_private_key(&input.master_key, input.private_key_source)?;
+ Ok(Self {
+ client,
+ base_url: input.base_url,
+ master_key: input.master_key,
+ public_key: input.public_key,
+ private_key,
+ user_id: input.user_id,
+ })
+ }
+
+ pub fn client(&self) -> &HttpClient {
+ &self.client
+ }
+
+ pub fn user_id(&self) -> Option<i64> {
+ self.user_id
+ }
+
+ pub fn master_key(&self) -> &[u8] {
+ &self.master_key
+ }
+
+ pub fn public_key(&self) -> &[u8] {
+ &self.public_key
+ }
+
+ pub fn private_key(&self) -> &[u8] {
+ &self.private_key
+ }
+
+ pub async fn get_entity_key(&self, key_type: &str) -> Result<Option<EntityKeyPayload>> {
+ let query = vec![("type", key_type.to_owned())];
+ let payload = self
+ .client
+ .get_json_optional::<EntityKeyResponse>("/user-entity/key", &query)
+ .await?;
+ Ok(payload.map(|value| EntityKeyPayload {
+ encrypted_key: value.encrypted_key,
+ nonce: value.nonce,
+ }))
+ }
+
+ pub async fn create_entity_key(
+ &self,
+ key_type: &str,
+ payload: &EntityKeyPayload,
+ ) -> Result<()> {
+ let request = CreateEntityKeyRequest {
+ key_type: key_type.to_owned(),
+ encrypted_key: payload.encrypted_key.clone(),
+ nonce: payload.nonce.clone(),
+ };
+ match self
+ .client
+ .post_json::<StatusResponse, _>("/user-entity/key", &request)
+ .await
+ {
+ Ok(_) => Ok(()),
+ Err(HttpError::Http { status: 409, .. }) => Err(WallError::EntityKeyConflict),
+ Err(err) => Err(err.into()),
+ }
+ }
+
+ pub async fn get_root_wall_key(&self) -> Result<Option<Vec<u8>>> {
+ let payload = match self.get_entity_key(ROOT_WALL_KEY_TYPE).await? {
+ Some(value) => value,
+ None => return Ok(None),
+ };
+ Ok(Some(decrypt_entity_key(&self.master_key, &payload)?))
+ }
+
+ pub async fn get_or_create_root_wall_key(&self) -> Result<Vec<u8>> {
+ if let Some(root_wall_key) = self.get_root_wall_key().await? {
+ return Ok(root_wall_key);
+ }
+ let root_wall_key = generate_key();
+ let payload = encrypt_entity_key(&self.master_key, &root_wall_key)?;
+ match self.create_entity_key(ROOT_WALL_KEY_TYPE, &payload).await {
+ Ok(()) => Ok(root_wall_key),
+ Err(WallError::EntityKeyConflict) => self.get_root_wall_key().await?.ok_or_else(|| {
+ WallError::InvalidInput("root wall key was created but not retrievable".into())
+ }),
+ Err(err) => Err(err),
+ }
+ }
+
+ pub async fn list_owned_walls(&self) -> Result<Vec<WallKeyResponse>> {
+ self.client.get_json("/wall", &[]).await.map_err(Into::into)
+ }
+
+ pub async fn list_follow_shares(&self) -> Result<Vec<FollowShareResponse>> {
+ self.client
+ .get_json("/wall/follow/shares", &[])
+ .await
+ .map_err(Into::into)
+ }
+
+ pub fn decrypt_follow_share(
+ &self,
+ share: &FollowShareResponse,
+ ) -> Result<DecryptedFollowShare> {
+ let packed = decode_b64(&share.encrypted_wall_key)?;
+ let (ciphertext, _) = unpack_payload(&packed)?;
+ if ciphertext.is_empty() {
+ return Err(WallError::MissingEncryptedWallKey);
+ }
+ let wall_key = sealed::open(&ciphertext, &self.public_key, &self.private_key)?;
+ Ok(DecryptedFollowShare {
+ followee: share.followee.clone(),
+ wall_id: share.wall_id.clone(),
+ wall_slug: share.wall_slug.clone(),
+ wall_key,
+ key_version: share.key_version,
+ })
+ }
+
+ pub async fn resolve_owned_wall_key(&self, wall_id: &str) -> Result<Option<Vec<u8>>> {
+ Ok(self
+ .resolve_owned_wall_access(wall_id)
+ .await?
+ .map(|value| value.wall_key))
+ }
+
+ pub async fn resolve_wall_key(&self, wall_id: &str) -> Result<Option<Vec<u8>>> {
+ Ok(self
+ .resolve_wall_access(wall_id)
+ .await?
+ .map(|value| value.wall_key))
+ }
+
+ pub async fn create_wall(&self, wall_slug: &str, profile: &[u8]) -> Result<CreatedWall> {
+ let wall_key = generate_key();
+ self.create_wall_with_key(wall_slug, &wall_key, profile)
+ .await
+ }
+
+ pub async fn create_wall_with_key(
+ &self,
+ wall_slug: &str,
+ wall_key: &[u8],
+ profile: &[u8],
+ ) -> Result<CreatedWall> {
+ let root_wall_key = self.get_or_create_root_wall_key().await?;
+ let encrypted_wall_key = encode_b64(&encrypt_secretbox_packed(&root_wall_key, wall_key)?);
+ let encrypted_profile = encode_b64(&encrypt_secretbox_packed(wall_key, profile)?);
+ let request = CreateWallRequest {
+ wall_slug: wall_slug.to_owned(),
+ encrypted_wall_key: encrypted_wall_key.clone(),
+ encrypted_profile: encrypted_profile.clone(),
+ };
+ let response = self
+ .client
+ .post_json::<WallKeyResponse, _>("/wall", &request)
+ .await?;
+ Ok(CreatedWall {
+ wall_id: response.wall_id,
+ wall_slug: response.wall_slug,
+ key_version: response.key_version,
+ wall_key: wall_key.to_vec(),
+ encrypted_wall_key,
+ encrypted_profile,
+ })
+ }
+
+ pub async fn get_wall_profile_raw(
+ &self,
+ wall_id: &str,
+ version: Option<i32>,
+ ) -> Result<WallProfileResponse> {
+ let mut query = vec![("wallId", wall_id.to_owned())];
+ if let Some(value) = version {
+ query.push(("version", value.to_string()));
+ }
+ self.client
+ .get_json("/wall/profile", &query)
+ .await
+ .map_err(Into::into)
+ }
+
+ pub async fn lookup_wall_by_slug(&self, wall_slug: &str) -> Result<WallLookupResponse> {
+ let path = format!("/wall/public/by-slug/{}", urlencoding::encode(wall_slug));
+ self.client.get_json(&path, &[]).await.map_err(Into::into)
+ }
+
+ pub async fn search_community(
+ &self,
+ query: &str,
+ cursor: Option<String>,
+ limit: Option<i32>,
+ ) -> Result<CommunityResponse> {
+ let mut query_params = vec![("q", query.to_owned())];
+ if let Some(value) = cursor.filter(|value| !value.trim().is_empty()) {
+ query_params.push(("cursor", value));
+ }
+ if let Some(value) = limit {
+ query_params.push(("limit", value.to_string()));
+ }
+ self.client
+ .get_json("/wall/community", &query_params)
+ .await
+ .map_err(Into::into)
+ }
+
+ pub async fn update_wall_slug(
+ &self,
+ wall_id: &str,
+ wall_slug: &str,
+ ) -> Result<WallLookupResponse> {
+ let path = format!("/wall/{wall_id}/slug");
+ let request = UpdateWallSlugRequest {
+ wall_slug: wall_slug.to_owned(),
+ };
+ self.client
+ .put_json(&path, &request)
+ .await
+ .map_err(Into::into)
+ }
+
+ pub async fn get_wall_profile_decrypted(
+ &self,
+ wall_id: &str,
+ version: Option<i32>,
+ ) -> Result<DecryptedWallProfile> {
+ let profile = self.get_wall_profile_raw(wall_id, version).await?;
+ let wall_key = self
+ .resolve_wall_key_for_version(wall_id, Some(profile.version))
+ .await?
+ .ok_or_else(|| {
+ WallError::InvalidInput(format!(
+ "no key available for wall {wall_id} version {}",
+ profile.version
+ ))
+ })?;
+ decrypt_wall_profile(&profile, &wall_key)
+ }
+
+ pub async fn update_wall_profile(
+ &self,
+ wall_id: &str,
+ profile: &[u8],
+ avatar: Option<ProfileAvatarPayload>,
+ remove_avatar: bool,
+ ) -> Result<UpdateWallProfileResponse> {
+ let wall_key = self
+ .resolve_owned_wall_access(wall_id)
+ .await?
+ .ok_or_else(|| {
+ WallError::InvalidInput(format!("wall {wall_id} is not owned by the account"))
+ })?;
+ let request = UpdateWallProfileRequest {
+ wall_id: wall_id.to_owned(),
+ encrypted_profile: encode_b64(&encrypt_secretbox_packed(&wall_key.wall_key, profile)?),
+ avatar,
+ remove_avatar,
+ };
+ self.client
+ .post_json("/wall/profile", &request)
+ .await
+ .map_err(Into::into)
+ }
+
+ pub async fn list_wall_key_versions(
+ &self,
+ wall_id: &str,
+ ) -> Result<Vec<WallKeyVersionResponse>> {
+ let query = vec![("wallId", wall_id.to_owned())];
+ self.client
+ .get_json("/wall/versions", &query)
+ .await
+ .map_err(Into::into)
+ }
+
+ pub fn build_wall_key_history(
+ &self,
+ current_version: i32,
+ current_key: &[u8],
+ versions: &[WallKeyVersionResponse],
+ ) -> Result<BTreeMap<i32, Vec<u8>>> {
+ build_wall_key_history_map(current_version, current_key, versions)
+ }
+
+ pub async fn build_wall_key_history_for_wall(
+ &self,
+ wall_id: &str,
+ ) -> Result<BTreeMap<i32, Vec<u8>>> {
+ let access = self
+ .resolve_wall_access(wall_id)
+ .await?
+ .ok_or_else(|| WallError::InvalidInput(format!("no access to wall {wall_id}")))?;
+ let versions = self.list_wall_key_versions(wall_id).await?;
+ build_wall_key_history_map(access.key_version, &access.wall_key, &versions)
+ }
+
+ pub async fn rotate_wall_key(
+ &self,
+ wall_id: &str,
+ profile: Option<&[u8]>,
+ ) -> Result<CreatedWall> {
+ let current = self
+ .resolve_owned_wall_access(wall_id)
+ .await?
+ .ok_or_else(|| {
+ WallError::InvalidInput(format!("wall {wall_id} is not owned by the account"))
+ })?;
+ let current_profile = if profile.is_none() {
+ Some(self.get_wall_profile_decrypted(wall_id, None).await?)
+ } else {
+ None
+ };
+ let next_profile = match profile {
+ Some(value) => value.to_vec(),
+ None => current_profile
+ .as_ref()
+ .map(|value| value.profile.clone())
+ .ok_or_else(|| WallError::InvalidInput("missing current profile".into()))?,
+ };
+ let next_wall_key = generate_key();
+ let root_wall_key = self.get_or_create_root_wall_key().await?;
+ let request = RotateWallKeyRequest {
+ wall_id: wall_id.to_owned(),
+ encrypted_wall_key: encode_b64(&encrypt_secretbox_packed(
+ &root_wall_key,
+ &next_wall_key,
+ )?),
+ wrapped_prev_key: encode_b64(&encrypt_secretbox_packed(
+ &next_wall_key,
+ &current.wall_key,
+ )?),
+ encrypted_profile: Some(encode_b64(&encrypt_secretbox_packed(
+ &next_wall_key,
+ &next_profile,
+ )?)),
+ };
+ let response = self
+ .client
+ .post_json::<WallKeyResponse, _>("/wall/rotate", &request)
+ .await?;
+ Ok(CreatedWall {
+ wall_id: response.wall_id,
+ wall_slug: response.wall_slug,
+ key_version: response.key_version,
+ wall_key: next_wall_key,
+ encrypted_wall_key: request.encrypted_wall_key,
+ encrypted_profile: request.encrypted_profile.unwrap_or_default(),
+ })
+ }
+
+ pub async fn presign_post_upload(
+ &self,
+ content_type: &str,
+ size: usize,
+ ) -> Result<PresignUploadResponse> {
+ let request = PresignUploadRequest {
+ content_type: content_type.to_owned(),
+ size: size as i64,
+ purpose: None,
+ wall_id: None,
+ };
+ self.client
+ .post_json("/wall/uploads/presign", &request)
+ .await
+ .map_err(Into::into)
+ }
+
+ pub async fn presign_avatar_upload(
+ &self,
+ wall_id: &str,
+ content_type: &str,
+ size: usize,
+ ) -> Result<PresignUploadResponse> {
+ let request = PresignUploadRequest {
+ content_type: content_type.to_owned(),
+ size: size as i64,
+ purpose: Some(UPLOAD_PURPOSE_AVATAR.to_owned()),
+ wall_id: Some(wall_id.to_owned()),
+ };
+ self.client
+ .post_json("/wall/uploads/presign", &request)
+ .await
+ .map_err(Into::into)
+ }
+
+ pub async fn upload_bytes(&self, presign: &PresignUploadResponse, body: &[u8]) -> Result<()> {
+ let headers: Vec<(&str, String)> = presign
+ .headers
+ .iter()
+ .map(|(key, value)| (key.as_str(), value.clone()))
+ .collect();
+ self.client
+ .object_store()
+ .put_bytes(&presign.url, body, &headers)
+ .await
+ .map_err(Into::into)
+ }
+
+ pub async fn upload_post_asset(
+ &self,
+ post_key: &[u8],
+ plaintext: &[u8],
+ content_type: &str,
+ position: Option<i32>,
+ ) -> Result<PostObjectPayload> {
+ let encrypted = encrypt_asset_payload(post_key, plaintext)?;
+ let presign = self
+ .presign_post_upload(content_type, encrypted.len())
+ .await?;
+ self.upload_bytes(&presign, &encrypted).await?;
+ Ok(PostObjectPayload {
+ object_key: presign.object_key,
+ content_type: Some(content_type.to_owned()),
+ size: Some(encrypted.len() as i64),
+ position,
+ blur_hash_cipher: None,
+ variant: None,
+ })
+ }
+
+ pub async fn upload_avatar(
+ &self,
+ wall_id: &str,
+ wall_key: &[u8],
+ plaintext: &[u8],
+ content_type: &str,
+ ) -> Result<ProfileAvatarPayload> {
+ let encrypted = encrypt_asset_payload(wall_key, plaintext)?;
+ let presign = self
+ .presign_avatar_upload(wall_id, content_type, encrypted.len())
+ .await?;
+ self.upload_bytes(&presign, &encrypted).await?;
+ Ok(ProfileAvatarPayload {
+ object_key: presign.object_key,
+ content_type: Some(content_type.to_owned()),
+ size: Some(encrypted.len() as i64),
+ })
+ }
+
+ pub async fn get_asset_url(
+ &self,
+ wall_id: &str,
+ object_key: &str,
+ ) -> Result<AssetDownloadResponse> {
+ let query = vec![
+ ("wallId", wall_id.to_owned()),
+ ("objectKey", object_key.to_owned()),
+ ];
+ self.client
+ .get_json("/wall/assets/redirect", &query)
+ .await
+ .map_err(Into::into)
+ }
+
+ pub async fn download_encrypted_asset(
+ &self,
+ wall_id: &str,
+ object_key: &str,
+ ) -> Result<Vec<u8>> {
+ let download = self.get_asset_url(wall_id, object_key).await?;
+ self.client
+ .object_store()
+ .get_bytes(&download.url)
+ .await
+ .map_err(Into::into)
+ }
+
+ pub async fn download_decrypted_asset(
+ &self,
+ wall_id: &str,
+ object_key: &str,
+ key: &[u8],
+ ) -> Result<Vec<u8>> {
+ let encrypted = self.download_encrypted_asset(wall_id, object_key).await?;
+ crate::crypto::decrypt_asset_payload(key, &encrypted)
+ }
+
+ pub fn generate_post_key(&self) -> Vec<u8> {
+ generate_key()
+ }
+
+ pub async fn create_post(
+ &self,
+ wall_id: &str,
+ objects: &[PostObjectPayload],
+ caption_plaintext: Option<&[u8]>,
+ post_key: Option<&[u8]>,
+ ) -> Result<(i64, Vec<u8>)> {
+ let access = self
+ .resolve_owned_wall_access(wall_id)
+ .await?
+ .ok_or_else(|| {
+ WallError::InvalidInput(format!("wall {wall_id} is not owned by the account"))
+ })?;
+ let post_key_bytes = post_key.map_or_else(generate_key, ToOwned::to_owned);
+ let caption_cipher = match caption_plaintext {
+ Some(value) => Some(encode_b64(&encrypt_secretbox_packed(
+ &post_key_bytes,
+ value,
+ )?)),
+ None => None,
+ };
+ let request = CreatePostRequest {
+ wall_id: wall_id.to_owned(),
+ encrypted_post_key: encode_b64(&encrypt_secretbox_packed(
+ &access.wall_key,
+ &post_key_bytes,
+ )?),
+ caption_cipher,
+ objects: objects.to_vec(),
+ };
+ let response = self
+ .client
+ .post_json::<CreatePostResponse, _>("/wall/posts", &request)
+ .await?;
+ Ok((response.post_id, post_key_bytes))
+ }
+
+ pub async fn list_posts(&self, wall_id: &str, limit: Option<i32>) -> Result<Vec<PostResponse>> {
+ let mut query = vec![("wallId", wall_id.to_owned())];
+ if let Some(value) = limit {
+ query.push(("limit", value.to_string()));
+ }
+ self.client
+ .get_json("/wall/posts", &query)
+ .await
+ .map_err(Into::into)
+ }
+
+ pub async fn list_feed(&self, cursor: Option<String>, limit: Option<i32>) -> Result<FeedPage> {
+ let mut query = Vec::new();
+ if let Some(value) = cursor.filter(|value| !value.trim().is_empty()) {
+ query.push(("cursor", value));
+ }
+ if let Some(value) = limit {
+ query.push(("limit", value.to_string()));
+ }
+ self.client
+ .get_json("/wall/feed", &query)
+ .await
+ .map_err(Into::into)
+ }
+
+ pub async fn fetch_post_decrypted(&self, post_id: i64) -> Result<DecryptedPost> {
+ let path = format!("/wall/posts/{post_id}");
+ let post: PostResponse = self.client.get_json(&path, &[]).await?;
+ self.decrypt_post_for_wall(&post.wall_id, &post).await
+ }
+
+ pub async fn hydrate_wall_keys(&self) -> Result<HydratedKeys> {
+ let root_wall_key = self.get_root_wall_key().await?;
+ let owned_records = self.list_owned_walls().await?;
+ let mut owned = Vec::with_capacity(owned_records.len());
+ if let Some(root_wall_key) = root_wall_key {
+ for record in owned_records {
+ let packed = decode_b64(&record.encrypted_wall_key)?;
+ let wall_key = decrypt_secretbox_packed(&root_wall_key, &packed)?;
+ owned.push((record.wall_id, wall_key));
+ }
+ }
+
+ let followed_records = self.list_follow_shares().await?;
+ let mut followed = Vec::with_capacity(followed_records.len());
+ for record in &followed_records {
+ followed.push(self.decrypt_follow_share(record)?);
+ }
+
+ Ok(HydratedKeys { owned, followed })
+ }
+
+ pub fn decrypt_post_key(&self, wall_key: &[u8], post: &PostResponse) -> Result<Vec<u8>> {
+ let packed = decode_b64(&post.encrypted_post_key)?;
+ decrypt_secretbox_packed(wall_key, &packed)
+ }
+
+ pub fn decrypt_post(&self, wall_key: &[u8], post: &PostResponse) -> Result<DecryptedPost> {
+ let post_key = self.decrypt_post_key(wall_key, post)?;
+ let caption_plaintext = if post.caption_cipher.is_empty() {
+ None
+ } else {
+ let packed = decode_b64(&post.caption_cipher)?;
+ Some(decrypt_secretbox_packed(&post_key, &packed)?)
+ };
+ Ok(DecryptedPost {
+ post_key,
+ caption_plaintext,
+ })
+ }
+
+ pub fn decrypt_blur_hash(
+ &self,
+ post_key: &[u8],
+ object: &PostObjectPayload,
+ ) -> Result<Option<String>> {
+ let Some(cipher) = object.blur_hash_cipher.as_deref() else {
+ return Ok(None);
+ };
+ let packed = decode_b64(cipher)?;
+ let plaintext = decrypt_secretbox_packed(post_key, &packed)?;
+ let blur_hash = String::from_utf8(plaintext)
+ .map_err(|err| WallError::InvalidInput(format!("invalid blur hash utf8: {err}")))?;
+ Ok(Some(blur_hash))
+ }
+
+ pub async fn decrypt_post_for_wall(
+ &self,
+ wall_id: &str,
+ post: &PostResponse,
+ ) -> Result<DecryptedPost> {
+ let wall_key = self
+ .resolve_wall_key_for_version(wall_id, Some(post.key_version))
+ .await?
+ .ok_or_else(|| {
+ WallError::InvalidInput(format!("no wall key available for post {}", post.post_id))
+ })?;
+ self.decrypt_post(&wall_key, post)
+ }
+
+ pub async fn decrypt_feed_item(&self, item: &FeedItem) -> Result<DecryptedPost> {
+ let post = post_response_from_feed_item(item);
+ self.decrypt_post_for_wall(&item.wall_id, &post).await
+ }
+
+ pub async fn update_post_caption(
+ &self,
+ post_id: i64,
+ post_key: &[u8],
+ caption_plaintext: Option<&[u8]>,
+ ) -> Result<()> {
+ let request = UpdatePostCaptionRequest {
+ caption_cipher: match caption_plaintext {
+ Some(value) => Some(encode_b64(&encrypt_secretbox_packed(post_key, value)?)),
+ None => None,
+ },
+ };
+ let path = format!("/wall/posts/{post_id}/caption");
+ self.client
+ .post_empty(&path, &request)
+ .await
+ .map_err(Into::into)
+ }
+
+ pub async fn delete_post(&self, post_id: i64) -> Result<()> {
+ let path = format!("/wall/posts/{post_id}");
+ let _: StatusResponse = self.client.delete_json(&path, &[]).await?;
+ Ok(())
+ }
+
+ pub async fn like_post(&self, post_id: i64, like: bool) -> Result<LikePostResponse> {
+ let path = format!("/wall/posts/{post_id}/like");
+ let request = LikePostRequest { like };
+ self.client
+ .post_json(&path, &request)
+ .await
+ .map_err(Into::into)
+ }
+
+ pub async fn list_comments(
+ &self,
+ post_id: i64,
+ limit: Option<i32>,
+ cursor: Option<i64>,
+ ) -> Result<ListCommentsResponse> {
+ let mut query = Vec::new();
+ if let Some(value) = limit {
+ query.push(("limit", value.to_string()));
+ }
+ if let Some(value) = cursor {
+ query.push(("cursor", value.to_string()));
+ }
+ let path = format!("/wall/posts/{post_id}/comments");
+ self.client
+ .get_json(&path, &query)
+ .await
+ .map_err(Into::into)
+ }
+
+ pub async fn create_comment(
+ &self,
+ post_id: i64,
+ post_key: &[u8],
+ plaintext: &[u8],
+ parent_comment_id: Option<i64>,
+ ) -> Result<CommentResponse> {
+ let request = CreateCommentRequest {
+ comment_cipher: encode_b64(&encrypt_secretbox_packed(post_key, plaintext)?),
+ parent_comment_id,
+ };
+ let path = format!("/wall/posts/{post_id}/comments");
+ self.client
+ .post_json(&path, &request)
+ .await
+ .map_err(Into::into)
+ }
+
+ pub fn decrypt_comment(
+ &self,
+ post_key: &[u8],
+ comment: &CommentResponse,
+ ) -> Result<DecryptedComment> {
+ let packed = decode_b64(&comment.comment_cipher)?;
+ Ok(DecryptedComment {
+ plaintext: decrypt_secretbox_packed(post_key, &packed)?,
+ })
+ }
+
+ pub async fn delete_comment(&self, post_id: i64, comment_id: i64) -> Result<()> {
+ let path = format!("/wall/posts/{post_id}/comments/{comment_id}");
+ let _: StatusResponse = self.client.delete_json(&path, &[]).await?;
+ Ok(())
+ }
+
+ pub async fn request_follow_by_wall(
+ &self,
+ wall_id: &str,
+ ) -> Result<FollowRequestCreatedResponse> {
+ let request = FollowRequestPayload {
+ target_username: None,
+ target_wall_id: Some(wall_id.to_owned()),
+ };
+ self.client
+ .post_json("/wall/follow/request", &request)
+ .await
+ .map_err(Into::into)
+ }
+
+ pub async fn request_follow_by_username(
+ &self,
+ username: &str,
+ ) -> Result<FollowRequestCreatedResponse> {
+ let request = FollowRequestPayload {
+ target_username: Some(username.to_owned()),
+ target_wall_id: None,
+ };
+ self.client
+ .post_json("/wall/follow/request", &request)
+ .await
+ .map_err(Into::into)
+ }
+
+ pub async fn list_incoming_follow_requests(&self) -> Result<Vec<FollowRequestResponse>> {
+ self.client
+ .get_json("/wall/follow/requests", &[])
+ .await
+ .map_err(Into::into)
+ }
+
+ pub async fn list_follow_requests(&self) -> Result<Vec<FollowRequestResponse>> {
+ self.list_incoming_follow_requests().await
+ }
+
+ pub async fn list_outgoing_follow_requests(
+ &self,
+ ) -> Result<Vec<OutgoingFollowRequestResponse>> {
+ self.client
+ .get_json("/wall/follow/requests/outgoing", &[])
+ .await
+ .map_err(Into::into)
+ }
+
+ pub async fn approve_follow_request(
+ &self,
+ request: &FollowRequestResponse,
+ ) -> Result<FollowRequestCreatedResponse> {
+ let access = self
+ .resolve_owned_wall_access(&request.wall_id)
+ .await?
+ .ok_or_else(|| {
+ WallError::InvalidInput(format!(
+ "wall {} is not owned by the account",
+ request.wall_id
+ ))
+ })?;
+ let follower_public_key = decode_b64(&request.follower_public_key)?;
+ let sealed_share = sealed::seal(&access.wall_key, &follower_public_key)?;
+ let payload = ApproveFollowPayload {
+ request_id: request.request_id,
+ wall_id: request.wall_id.clone(),
+ encrypted_wall_key: encode_b64(&pack_payload(&sealed_share, &[])),
+ };
+ self.client
+ .post_json("/wall/follow/approve", &payload)
+ .await
+ .map_err(Into::into)
+ }
+
+ pub async fn reject_follow_request(
+ &self,
+ request_id: i64,
+ ) -> Result<FollowRequestCreatedResponse> {
+ let payload = RejectFollowPayload { request_id };
+ self.client
+ .post_json("/wall/follow/reject", &payload)
+ .await
+ .map_err(Into::into)
+ }
+
+ pub async fn cancel_follow_request(
+ &self,
+ request_id: i64,
+ ) -> Result<FollowRequestCreatedResponse> {
+ let payload = CancelFollowRequestPayload { request_id };
+ self.client
+ .post_json("/wall/follow/request/cancel", &payload)
+ .await
+ .map_err(Into::into)
+ }
+
+ pub async fn cancel_follow_request_by_wall(
+ &self,
+ wall_id: &str,
+ ) -> Result<FollowRequestCreatedResponse> {
+ let request = self
+ .list_outgoing_follow_requests()
+ .await?
+ .into_iter()
+ .find(|request| request.wall_id == wall_id)
+ .ok_or_else(|| {
+ WallError::InvalidInput(format!("no pending follow request for wall {wall_id}"))
+ })?;
+ self.cancel_follow_request(request.request_id).await
+ }
+
+ pub async fn unfollow_by_wall(&self, wall_id: &str) -> Result<String> {
+ let request = FollowRequestPayload {
+ target_username: None,
+ target_wall_id: Some(wall_id.to_owned()),
+ };
+ let response: StatusResponse = self
+ .client
+ .post_json("/wall/follow/unfollow", &request)
+ .await?;
+ Ok(response.status)
+ }
+
+ pub async fn unfollow_by_username(&self, username: &str) -> Result<String> {
+ let request = FollowRequestPayload {
+ target_username: Some(username.to_owned()),
+ target_wall_id: None,
+ };
+ let response: StatusResponse = self
+ .client
+ .post_json("/wall/follow/unfollow", &request)
+ .await?;
+ Ok(response.status)
+ }
+
+ pub async fn list_wall_followers(&self, wall_id: &str) -> Result<Vec<WallFollowerResponse>> {
+ let query = vec![("wallId", wall_id.to_owned())];
+ self.client
+ .get_json("/wall/follow/followers", &query)
+ .await
+ .map_err(Into::into)
+ }
+
+ pub async fn refresh_follow_shares(&self, wall_id: &str) -> Result<usize> {
+ let access = self
+ .resolve_owned_wall_access(wall_id)
+ .await?
+ .ok_or_else(|| {
+ WallError::InvalidInput(format!("wall {wall_id} is not owned by the account"))
+ })?;
+ let followers = self.list_wall_followers(wall_id).await?;
+ let mut updates = Vec::new();
+ for follower in followers {
+ if follower.key_version == access.key_version {
+ continue;
+ }
+ let public_key = decode_b64(&follower.public_key)?;
+ let sealed_share = sealed::seal(&access.wall_key, &public_key)?;
+ updates.push(ShareUpdatePayload {
+ follower_id: follower.follower_id,
+ encrypted_wall_key: encode_b64(&pack_payload(&sealed_share, &[])),
+ });
+ }
+ if updates.is_empty() {
+ return Ok(0);
+ }
+ let payload = RefreshFollowSharesRequest {
+ wall_id: wall_id.to_owned(),
+ shares: updates,
+ };
+ let response: UpdatedCountResponse = self
+ .client
+ .post_json("/wall/follow/shares/refresh", &payload)
+ .await?;
+ Ok(response.updated)
+ }
+
+ pub async fn get_wall_link_status(&self, wall_id: &str) -> Result<WallLinkStatusResponse> {
+ let path = format!("/wall/links/{wall_id}");
+ self.client.get_json(&path, &[]).await.map_err(Into::into)
+ }
+
+ pub async fn create_wall_link(
+ &self,
+ owner_handle: &str,
+ wall_id: &str,
+ ) -> Result<CreatedWallLink> {
+ let access = self
+ .resolve_owned_wall_access(wall_id)
+ .await?
+ .ok_or_else(|| {
+ WallError::InvalidInput(format!("wall {wall_id} is not owned by the account"))
+ })?;
+ let secret_bytes = generate_key();
+ let auth_key = derive_labeled_key(&secret_bytes, WALL_LINK_AUTH_LABEL);
+ let wrap_key = derive_labeled_key(&secret_bytes, WALL_LINK_WRAP_LABEL);
+ let request = WallLinkCreateRequest {
+ wall_id: wall_id.to_owned(),
+ auth_key: encode_b64(&auth_key),
+ key_version: access.key_version,
+ encrypted_wall_key: encode_b64(&encrypt_secretbox_packed(&wrap_key, &access.wall_key)?),
+ };
+ let status: WallLinkStatusResponse = self.client.post_json("/wall/links", &request).await?;
+ Ok(CreatedWallLink {
+ secret: encode_b64_url(&secret_bytes),
+ owner_handle: owner_handle.to_owned(),
+ wall_id: wall_id.to_owned(),
+ wall_slug: status.wall_slug,
+ key_version: status.key_version,
+ })
+ }
+
+ pub async fn delete_wall_link(&self, wall_id: &str) -> Result<()> {
+ let path = format!("/wall/links/{wall_id}");
+ let _: StatusResponse = self.client.delete_json(&path, &[]).await?;
+ Ok(())
+ }
+
+ async fn resolve_owned_wall_access(&self, wall_id: &str) -> Result<Option<ResolvedWallAccess>> {
+ let root_wall_key = match self.get_root_wall_key().await? {
+ Some(value) => value,
+ None => return Ok(None),
+ };
+ let walls = self.list_owned_walls().await?;
+ let Some(record) = walls.into_iter().find(|value| value.wall_id == wall_id) else {
+ return Ok(None);
+ };
+ let packed = decode_b64(&record.encrypted_wall_key)?;
+ let wall_key = decrypt_secretbox_packed(&root_wall_key, &packed)?;
+ Ok(Some(ResolvedWallAccess {
+ wall_key,
+ key_version: record.key_version,
+ }))
+ }
+
+ async fn resolve_shared_wall_access(
+ &self,
+ wall_id: &str,
+ ) -> Result<Option<ResolvedWallAccess>> {
+ let shares = self.list_follow_shares().await?;
+ let Some(record) = shares.into_iter().find(|value| value.wall_id == wall_id) else {
+ return Ok(None);
+ };
+ let share = self.decrypt_follow_share(&record)?;
+ Ok(Some(ResolvedWallAccess {
+ wall_key: share.wall_key,
+ key_version: share.key_version,
+ }))
+ }
+
+ async fn resolve_wall_access(&self, wall_id: &str) -> Result<Option<ResolvedWallAccess>> {
+ if let Some(access) = self.resolve_owned_wall_access(wall_id).await? {
+ return Ok(Some(access));
+ }
+ self.resolve_shared_wall_access(wall_id).await
+ }
+
+ async fn resolve_wall_key_for_version(
+ &self,
+ wall_id: &str,
+ version: Option<i32>,
+ ) -> Result<Option<Vec<u8>>> {
+ let access = match self.resolve_wall_access(wall_id).await? {
+ Some(value) => value,
+ None => return Ok(None),
+ };
+ let target_version = version.unwrap_or(access.key_version);
+ if target_version == access.key_version {
+ return Ok(Some(access.wall_key));
+ }
+ let history = self.build_wall_key_history_for_wall(wall_id).await?;
+ Ok(history.get(&target_version).cloned())
+ }
+}
+
+fn post_response_from_feed_item(item: &FeedItem) -> PostResponse {
+ PostResponse {
+ post_id: item.post_id,
+ wall_id: item.wall_id.clone(),
+ wall_slug: item.wall_slug.clone(),
+ author: item.wall_slug.clone(),
+ encrypted_post_key: item.encrypted_post_key.clone(),
+ caption_cipher: item.caption_cipher.clone(),
+ key_version: item.key_version,
+ objects: item.objects.clone(),
+ created_at: item.created_at.clone(),
+ likes: item.likes,
+ viewer_liked: item.viewer_liked,
+ comments: item.comments,
+ }
+}
+
+impl WallLinkCtx {
+ pub async fn open(input: OpenWallLinkCtxInput) -> Result<Self> {
+ let secret_bytes = decode_b64_url(&input.secret)?;
+ let auth_key = derive_labeled_key(&secret_bytes, WALL_LINK_AUTH_LABEL);
+ let wrap_key = derive_labeled_key(&secret_bytes, WALL_LINK_WRAP_LABEL);
+ let client = build_http_client(
+ &input.base_url,
+ None,
+ input.user_agent,
+ input.client_package,
+ input.client_version,
+ )?;
+ let response = client
+ .post_json::<WallLinkLoginResponse, _>(
+ "/wall/links/session",
+ &WallLinkLoginRequest {
+ wall_id: input.wall_id.clone(),
+ auth_key: encode_b64(&auth_key),
+ },
+ )
+ .await?;
+ client.set_auth_token(Some(response.session_token.clone()));
+ let wall_key =
+ decrypt_secretbox_packed(&wrap_key, &decode_b64(&response.encrypted_wall_key)?)?;
+ Ok(Self {
+ client,
+ base_url: input.base_url,
+ owner_handle: response.owner,
+ wall_id: response.wall_id,
+ wall_slug: response.wall_slug,
+ wall_key,
+ key_version: response.key_version,
+ })
+ }
+
+ pub fn client(&self) -> &HttpClient {
+ &self.client
+ }
+
+ pub fn owner(&self) -> &str {
+ &self.owner_handle
+ }
+
+ pub fn wall_id(&self) -> &str {
+ &self.wall_id
+ }
+
+ pub fn wall_slug(&self) -> &str {
+ &self.wall_slug
+ }
+
+ pub fn key_version(&self) -> i32 {
+ self.key_version
+ }
+
+ pub fn wall_key(&self) -> &[u8] {
+ &self.wall_key
+ }
+
+ pub async fn get_wall_profile_raw(&self, version: Option<i32>) -> Result<WallProfileResponse> {
+ let mut query = vec![("wallId", self.wall_id.clone())];
+ if let Some(value) = version {
+ query.push(("version", value.to_string()));
+ }
+ self.client
+ .get_json("/wall/profile", &query)
+ .await
+ .map_err(Into::into)
+ }
+
+ pub async fn get_wall_profile_decrypted(
+ &self,
+ version: Option<i32>,
+ ) -> Result<DecryptedWallProfile> {
+ let profile = self.get_wall_profile_raw(version).await?;
+ let wall_key = self
+ .resolve_wall_key_for_version(Some(profile.version))
+ .await?
+ .ok_or_else(|| {
+ WallError::InvalidInput(format!("missing wall key for version {}", profile.version))
+ })?;
+ decrypt_wall_profile(&profile, &wall_key)
+ }
+
+ pub async fn list_posts(&self, limit: Option<i32>) -> Result<Vec<PostResponse>> {
+ let mut query = vec![("wallId", self.wall_id.clone())];
+ if let Some(value) = limit {
+ query.push(("limit", value.to_string()));
+ }
+ self.client
+ .get_json("/wall/posts", &query)
+ .await
+ .map_err(Into::into)
+ }
+
+ pub fn decrypt_post_key(&self, post: &PostResponse) -> Result<Vec<u8>> {
+ let packed = decode_b64(&post.encrypted_post_key)?;
+ decrypt_secretbox_packed(&self.wall_key, &packed)
+ }
+
+ pub async fn decrypt_post(&self, post: &PostResponse) -> Result<DecryptedPost> {
+ let wall_key = self
+ .resolve_wall_key_for_version(Some(post.key_version))
+ .await?
+ .ok_or_else(|| {
+ WallError::InvalidInput(format!("missing wall key for post {}", post.post_id))
+ })?;
+ let post_key = decrypt_secretbox_packed(&wall_key, &decode_b64(&post.encrypted_post_key)?)?;
+ let caption_plaintext = if post.caption_cipher.is_empty() {
+ None
+ } else {
+ Some(decrypt_secretbox_packed(
+ &post_key,
+ &decode_b64(&post.caption_cipher)?,
+ )?)
+ };
+ Ok(DecryptedPost {
+ post_key,
+ caption_plaintext,
+ })
+ }
+
+ pub async fn list_comments(
+ &self,
+ post_id: i64,
+ limit: Option<i32>,
+ cursor: Option<i64>,
+ ) -> Result<ListCommentsResponse> {
+ let mut query = Vec::new();
+ if let Some(value) = limit {
+ query.push(("limit", value.to_string()));
+ }
+ if let Some(value) = cursor {
+ query.push(("cursor", value.to_string()));
+ }
+ let path = format!("/wall/posts/{post_id}/comments");
+ self.client
+ .get_json(&path, &query)
+ .await
+ .map_err(Into::into)
+ }
+
+ pub fn decrypt_comment(
+ &self,
+ post_key: &[u8],
+ comment: &CommentResponse,
+ ) -> Result<DecryptedComment> {
+ let packed = decode_b64(&comment.comment_cipher)?;
+ Ok(DecryptedComment {
+ plaintext: decrypt_secretbox_packed(post_key, &packed)?,
+ })
+ }
+
+ pub async fn list_wall_key_versions(&self) -> Result<Vec<WallKeyVersionResponse>> {
+ let query = vec![("wallId", self.wall_id.clone())];
+ self.client
+ .get_json("/wall/versions", &query)
+ .await
+ .map_err(Into::into)
+ }
+
+ pub fn build_wall_key_history(
+ &self,
+ versions: &[WallKeyVersionResponse],
+ ) -> Result<BTreeMap<i32, Vec<u8>>> {
+ build_wall_key_history_map(self.key_version, &self.wall_key, versions)
+ }
+
+ pub async fn get_asset_url(&self, object_key: &str) -> Result<AssetDownloadResponse> {
+ let query = vec![
+ ("wallId", self.wall_id.clone()),
+ ("objectKey", object_key.to_owned()),
+ ];
+ self.client
+ .get_json("/wall/assets/redirect", &query)
+ .await
+ .map_err(Into::into)
+ }
+
+ pub async fn download_encrypted_asset(&self, object_key: &str) -> Result<Vec<u8>> {
+ let download = self.get_asset_url(object_key).await?;
+ self.client
+ .object_store()
+ .get_bytes(&download.url)
+ .await
+ .map_err(Into::into)
+ }
+
+ pub async fn download_decrypted_asset(&self, object_key: &str, key: &[u8]) -> Result<Vec<u8>> {
+ let encrypted = self.download_encrypted_asset(object_key).await?;
+ crate::crypto::decrypt_asset_payload(key, &encrypted)
+ }
+
+ async fn resolve_wall_key_for_version(&self, version: Option<i32>) -> Result<Option<Vec<u8>>> {
+ let target_version = version.unwrap_or(self.key_version);
+ if target_version == self.key_version {
+ return Ok(Some(self.wall_key.clone()));
+ }
+ let versions = self.list_wall_key_versions().await?;
+ let history = build_wall_key_history_map(self.key_version, &self.wall_key, &versions)?;
+ Ok(history.get(&target_version).cloned())
+ }
+}
+
+fn build_http_client(
+ base_url: &str,
+ auth_token: Option<String>,
+ user_agent: Option<String>,
+ client_package: Option<String>,
+ client_version: Option<String>,
+) -> Result<HttpClient> {
+ HttpClient::new_with_config(HttpConfig {
+ base_url: base_url.to_owned(),
+ auth_token,
+ user_agent,
+ client_package,
+ client_version,
+ timeout_secs: Some(30),
+ })
+ .map_err(Into::into)
+}
+
+fn decrypt_private_key(master_key: &[u8], source: PrivateKeySource) -> Result<Vec<u8>> {
+ match source {
+ PrivateKeySource::Plain(value) => Ok(value),
+ PrivateKeySource::EncryptedKeyAttributes(value) => {
+ let ciphertext = decode_b64(&value.encrypted_secret_key)?;
+ let nonce = decode_b64(&value.secret_key_decryption_nonce)?;
+ secretbox::decrypt(&ciphertext, &nonce, master_key).map_err(Into::into)
+ }
+ }
+}
+
+fn decrypt_wall_profile(
+ profile: &WallProfileResponse,
+ wall_key: &[u8],
+) -> Result<DecryptedWallProfile> {
+ let profile_bytes = if profile.encrypted_profile.is_empty() {
+ Vec::new()
+ } else {
+ decrypt_secretbox_packed(wall_key, &decode_b64(&profile.encrypted_profile)?)?
+ };
+ Ok(DecryptedWallProfile {
+ wall_id: profile.wall_id.clone(),
+ wall_slug: profile.wall_slug.clone(),
+ version: profile.version,
+ profile: profile_bytes,
+ avatar: profile.avatar.clone(),
+ updated_at: if profile.updated_at.is_empty() {
+ None
+ } else {
+ Some(profile.updated_at.clone())
+ },
+ })
+}
+
+fn build_wall_key_history_map(
+ current_version: i32,
+ current_key: &[u8],
+ versions: &[WallKeyVersionResponse],
+) -> Result<BTreeMap<i32, Vec<u8>>> {
+ let mut history = BTreeMap::new();
+ history.insert(current_version, current_key.to_vec());
+ let mut ordered = versions.to_vec();
+ ordered.sort_by(|left, right| right.version.cmp(&left.version));
+ for entry in ordered {
+ if entry.wrapped_prev_key.is_empty() || entry.version <= 1 {
+ continue;
+ }
+ let Some(known_key) = history.get(&entry.version).cloned() else {
+ continue;
+ };
+ let packed = decode_b64(&entry.wrapped_prev_key)?;
+ let previous_key = decrypt_secretbox_packed(&known_key, &packed)?;
+ history.insert(entry.version - 1, previous_key);
+ }
+ Ok(history)
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ use ente_core::crypto::{keys, sealed};
+ use mockito::{Matcher, Server};
+ use serde_json::json;
+
+ fn test_account_ctx(base_url: &str) -> AccountWallCtx {
+ let (public_key, private_key) = keys::generate_keypair().expect("valid keypair");
+ AccountWallCtx::open(OpenAccountWallCtxInput {
+ base_url: base_url.to_owned(),
+ auth_token: "token".to_owned(),
+ master_key: generate_key(),
+ public_key,
+ private_key_source: PrivateKeySource::Plain(private_key),
+ user_id: Some(1),
+ user_agent: None,
+ client_package: None,
+ client_version: None,
+ })
+ .expect("account wall ctx should open")
+ }
+
+ #[tokio::test]
+ async fn get_or_create_root_wall_key_creates_when_missing() {
+ let mut server = Server::new_async().await;
+ let ctx = test_account_ctx(&server.url());
+ let first_get = server
+ .mock("GET", "/user-entity/key")
+ .match_query(Matcher::UrlEncoded(
+ "type".into(),
+ ROOT_WALL_KEY_TYPE.into(),
+ ))
+ .with_status(404)
+ .create_async()
+ .await;
+ let create = server
+ .mock("POST", "/user-entity/key")
+ .match_header("x-auth-token", "token")
+ .with_status(200)
+ .with_body(r#"{"status":"ok"}"#)
+ .create_async()
+ .await;
+
+ let root = ctx
+ .get_or_create_root_wall_key()
+ .await
+ .expect("root wall key should be created");
+
+ assert_eq!(root.len(), 32);
+ first_get.assert_async().await;
+ create.assert_async().await;
+ }
+
+ #[tokio::test]
+ async fn get_or_create_root_wall_key_refetches_on_conflict() {
+ let mut server = Server::new_async().await;
+ let ctx = test_account_ctx(&server.url());
+ let expected_root = generate_key();
+ let payload = encrypt_entity_key(&ctx.master_key, &expected_root).expect("entity key");
+
+ let missing = server
+ .mock("GET", "/user-entity/key")
+ .match_query(Matcher::UrlEncoded(
+ "type".into(),
+ ROOT_WALL_KEY_TYPE.into(),
+ ))
+ .with_status(404)
+ .expect(1)
+ .create_async()
+ .await;
+ let conflict = server
+ .mock("POST", "/user-entity/key")
+ .with_status(409)
+ .with_body("conflict")
+ .create_async()
+ .await;
+ let refetch = server
+ .mock("GET", "/user-entity/key")
+ .match_query(Matcher::UrlEncoded(
+ "type".into(),
+ ROOT_WALL_KEY_TYPE.into(),
+ ))
+ .with_status(200)
+ .with_body(
+ json!({
+ "type": ROOT_WALL_KEY_TYPE,
+ "encryptedKey": payload.encrypted_key,
+ "nonce": payload.nonce,
+ })
+ .to_string(),
+ )
+ .expect(1)
+ .create_async()
+ .await;
+
+ let root = ctx
+ .get_or_create_root_wall_key()
+ .await
+ .expect("root wall key should refetch on conflict");
+ assert_eq!(root, expected_root);
+ missing.assert_async().await;
+ conflict.assert_async().await;
+ refetch.assert_async().await;
+ }
+
+ #[tokio::test]
+ async fn wall_link_open_decrypts_current_wall_key() {
+ let mut server = Server::new_async().await;
+ let wall_key = generate_key();
+ let secret = generate_key();
+ let auth_key = derive_labeled_key(&secret, WALL_LINK_AUTH_LABEL);
+ let wrap_key = derive_labeled_key(&secret, WALL_LINK_WRAP_LABEL);
+ let encrypted_wall_key = encode_b64(
+ &encrypt_secretbox_packed(&wrap_key, &wall_key).expect("encrypted wall key"),
+ );
+
+ let session = server
+ .mock("POST", "/wall/links/session")
+ .match_body(Matcher::JsonString(
+ json!({
+ "wallId": "wall_owner_gallery",
+ "authKey": encode_b64(&auth_key),
+ })
+ .to_string(),
+ ))
+ .with_status(200)
+ .with_body(
+ json!({
+ "sessionToken": "wall-link-token",
+ "wallId": "wall_owner_gallery",
+ "wallSlug": "owner-gallery",
+ "owner": "owner-handle",
+ "keyVersion": 3,
+ "encryptedWallKey": encrypted_wall_key,
+ "encryptedPublicProfile": "",
+ "encryptedPrivateProfile": "",
+ })
+ .to_string(),
+ )
+ .create_async()
+ .await;
+
+ let ctx = WallLinkCtx::open(OpenWallLinkCtxInput {
+ base_url: server.url(),
+ wall_id: "wall_owner_gallery".to_owned(),
+ secret: encode_b64_url(&secret),
+ user_agent: None,
+ client_package: None,
+ client_version: None,
+ })
+ .await
+ .expect("wall link ctx should open");
+
+ assert_eq!(ctx.wall_id(), "wall_owner_gallery");
+ assert_eq!(ctx.wall_slug(), "owner-gallery");
+ assert_eq!(ctx.key_version(), 3);
+ assert_eq!(ctx.wall_key(), wall_key.as_slice());
+ session.assert_async().await;
+ }
+
+ #[tokio::test]
+ async fn upload_post_asset_uses_presign_and_object_store() {
+ let mut server = Server::new_async().await;
+ let ctx = test_account_ctx(&server.url());
+
+ let presign = server
+ .mock("POST", "/wall/uploads/presign")
+ .match_header("x-auth-token", "token")
+ .match_body(Matcher::Regex("contentType".into()))
+ .with_status(200)
+ .with_body(
+ json!({
+ "url": format!("{}/upload/object-1", server.url()),
+ "method": "PUT",
+ "headers": {
+ "content-type": "application/octet-stream"
+ },
+ "objectKey": "object-1",
+ "expiresIn": 300
+ })
+ .to_string(),
+ )
+ .create_async()
+ .await;
+ let upload = server
+ .mock("PUT", "/upload/object-1")
+ .match_header("content-type", "application/octet-stream")
+ .with_status(200)
+ .create_async()
+ .await;
+
+ let payload = ctx
+ .upload_post_asset(&generate_key(), b"tiny-image", "image/png", Some(0))
+ .await
+ .expect("upload should succeed");
+
+ assert_eq!(payload.object_key, "object-1");
+ assert_eq!(payload.position, Some(0));
+ assert!(payload.size.unwrap_or_default() > 0);
+ presign.assert_async().await;
+ upload.assert_async().await;
+ }
+
+ #[tokio::test]
+ async fn follow_request_helpers_use_explicit_incoming_and_outgoing_routes() {
+ let mut server = Server::new_async().await;
+ let ctx = test_account_ctx(&server.url());
+
+ let incoming = server
+ .mock("GET", "/wall/follow/requests")
+ .match_header("x-auth-token", "token")
+ .with_status(200)
+ .with_body(
+ json!([{
+ "requestId": 41,
+ "follower": "viewer",
+ "wallId": "wall_owner_main",
+ "wallSlug": "owner-main",
+ "followerPublicKey": "cHVi",
+ "status": "pending",
+ "createdAt": "2026-04-16T00:00:00Z"
+ }])
+ .to_string(),
+ )
+ .create_async()
+ .await;
+ let outgoing = server
+ .mock("GET", "/wall/follow/requests/outgoing")
+ .match_header("x-auth-token", "token")
+ .with_status(200)
+ .with_body(
+ json!([{
+ "requestId": 42,
+ "followee": "owner",
+ "wallId": "wall_owner_main",
+ "wallSlug": "owner-main",
+ "status": "pending",
+ "createdAt": "2026-04-16T00:00:00Z"
+ }])
+ .to_string(),
+ )
+ .expect(2)
+ .create_async()
+ .await;
+ let cancel = server
+ .mock("POST", "/wall/follow/request/cancel")
+ .match_header("x-auth-token", "token")
+ .match_body(Matcher::JsonString(json!({"requestId": 42}).to_string()))
+ .with_status(200)
+ .with_body(r#"{"requestId":42,"status":"withdrawn"}"#)
+ .expect(2)
+ .create_async()
+ .await;
+
+ let incoming_requests = ctx
+ .list_incoming_follow_requests()
+ .await
+ .expect("incoming follow requests should load");
+ assert_eq!(incoming_requests.len(), 1);
+ assert_eq!(incoming_requests[0].request_id, 41);
+
+ let outgoing_requests = ctx
+ .list_outgoing_follow_requests()
+ .await
+ .expect("outgoing follow requests should load");
+ assert_eq!(outgoing_requests.len(), 1);
+ assert_eq!(outgoing_requests[0].followee, "owner");
+
+ let direct_cancel = ctx
+ .cancel_follow_request(42)
+ .await
+ .expect("direct cancel should succeed");
+ assert_eq!(direct_cancel.status, "withdrawn");
+
+ let by_wall_cancel = ctx
+ .cancel_follow_request_by_wall("wall_owner_main")
+ .await
+ .expect("cancel by wall should resolve outgoing request");
+ assert_eq!(by_wall_cancel.request_id, 42);
+
+ incoming.assert_async().await;
+ outgoing.assert_async().await;
+ cancel.assert_async().await;
+ }
+
+ #[tokio::test]
+ async fn list_feed_uses_wall_feed_endpoint() {
+ let mut server = Server::new_async().await;
+ let ctx = test_account_ctx(&server.url());
+ let feed = server
+ .mock("GET", "/wall/feed")
+ .match_header("x-auth-token", "token")
+ .match_query(Matcher::AllOf(vec![
+ Matcher::UrlEncoded("cursor".into(), "cursor-1".into()),
+ Matcher::UrlEncoded("limit".into(), "5".into()),
+ ]))
+ .with_status(200)
+ .with_body(
+ json!({
+ "items": [{
+ "postId": 42,
+ "wallId": "wall_owner_gallery",
+ "wallSlug": "owner-gallery",
+ "ownerUserId": 7,
+ "encryptedPostKey": "cGFja2Vk",
+ "captionCipher": "",
+ "keyVersion": 3,
+ "objects": [],
+ "createdAt": "2026-04-16T00:00:00Z",
+ "likes": 2,
+ "viewerLiked": true,
+ "comments": 1
+ }],
+ "nextCursor": "cursor-2"
+ })
+ .to_string(),
+ )
+ .create_async()
+ .await;
+
+ let page = ctx
+ .list_feed(Some("cursor-1".to_owned()), Some(5))
+ .await
+ .expect("feed page should load");
+
+ assert_eq!(page.items.len(), 1);
+ assert_eq!(page.items[0].post_id, 42);
+ assert_eq!(page.next_cursor, "cursor-2");
+ feed.assert_async().await;
+ }
+
+ #[tokio::test]
+ async fn fetch_post_decrypted_uses_post_by_id_endpoint() {
+ let mut server = Server::new_async().await;
+ let ctx = test_account_ctx(&server.url());
+ let root_wall_key = generate_key();
+ let wall_key = generate_key();
+ let post_key = generate_key();
+ let caption = b"hello from post";
+ let entity_payload =
+ encrypt_entity_key(&ctx.master_key, &root_wall_key).expect("root wall entity");
+
+ let entity = server
+ .mock("GET", "/user-entity/key")
+ .match_header("x-auth-token", "token")
+ .match_query(Matcher::UrlEncoded(
+ "type".into(),
+ ROOT_WALL_KEY_TYPE.into(),
+ ))
+ .with_status(200)
+ .with_body(
+ json!({
+ "type": ROOT_WALL_KEY_TYPE,
+ "encryptedKey": entity_payload.encrypted_key,
+ "nonce": entity_payload.nonce,
+ })
+ .to_string(),
+ )
+ .create_async()
+ .await;
+ let walls = server
+ .mock("GET", "/wall")
+ .match_header("x-auth-token", "token")
+ .with_status(200)
+ .with_body(
+ json!([{
+ "wallId": "wall_owner_gallery",
+ "wallSlug": "owner-gallery",
+ "encryptedWallKey": encode_b64(&encrypt_secretbox_packed(&root_wall_key, &wall_key).expect("wall key wrap")),
+ "encryptedPublicProfile": "",
+ "encryptedPrivateProfile": "",
+ "keyVersion": 3
+ }])
+ .to_string(),
+ )
+ .create_async()
+ .await;
+ let post = server
+ .mock("GET", "/wall/posts/42")
+ .match_header("x-auth-token", "token")
+ .with_status(200)
+ .with_body(
+ json!({
+ "postId": 42,
+ "wallId": "wall_owner_gallery",
+ "wallSlug": "owner-gallery",
+ "author": "owner-gallery",
+ "encryptedPostKey": encode_b64(&encrypt_secretbox_packed(&wall_key, &post_key).expect("post key wrap")),
+ "captionCipher": encode_b64(&encrypt_secretbox_packed(&post_key, caption).expect("caption wrap")),
+ "keyVersion": 3,
+ "objects": [],
+ "createdAt": "2026-04-16T00:00:00Z",
+ "likes": 0,
+ "viewerLiked": false,
+ "comments": 0
+ })
+ .to_string(),
+ )
+ .create_async()
+ .await;
+
+ let decrypted = ctx
+ .fetch_post_decrypted(42)
+ .await
+ .expect("post should decrypt");
+
+ assert_eq!(decrypted.post_key, post_key);
+ assert_eq!(
+ decrypted.caption_plaintext.as_deref(),
+ Some(caption.as_slice())
+ );
+ entity.assert_async().await;
+ walls.assert_async().await;
+ post.assert_async().await;
+ }
+
+ #[tokio::test]
+ async fn hydrate_wall_keys_loads_owned_and_followed_walls() {
+ let mut server = Server::new_async().await;
+ let ctx = test_account_ctx(&server.url());
+ let root_wall_key = generate_key();
+ let owned_wall_key = generate_key();
+ let shared_wall_key = generate_key();
+ let entity_payload =
+ encrypt_entity_key(&ctx.master_key, &root_wall_key).expect("root wall entity");
+ let sealed_share =
+ sealed::seal(&shared_wall_key, &ctx.public_key).expect("sealed wall share");
+
+ let entity = server
+ .mock("GET", "/user-entity/key")
+ .match_header("x-auth-token", "token")
+ .match_query(Matcher::UrlEncoded(
+ "type".into(),
+ ROOT_WALL_KEY_TYPE.into(),
+ ))
+ .with_status(200)
+ .with_body(
+ json!({
+ "type": ROOT_WALL_KEY_TYPE,
+ "encryptedKey": entity_payload.encrypted_key,
+ "nonce": entity_payload.nonce,
+ })
+ .to_string(),
+ )
+ .create_async()
+ .await;
+ let owned = server
+ .mock("GET", "/wall")
+ .match_header("x-auth-token", "token")
+ .with_status(200)
+ .with_body(
+ json!([{
+ "wallId": "wall_owner_gallery",
+ "wallSlug": "owner-gallery",
+ "encryptedWallKey": encode_b64(&encrypt_secretbox_packed(&root_wall_key, &owned_wall_key).expect("owned wrap")),
+ "encryptedPublicProfile": "",
+ "encryptedPrivateProfile": "",
+ "keyVersion": 1
+ }])
+ .to_string(),
+ )
+ .create_async()
+ .await;
+ let shares = server
+ .mock("GET", "/wall/follow/shares")
+ .match_header("x-auth-token", "token")
+ .with_status(200)
+ .with_body(
+ json!([{
+ "followee": "owner",
+ "wallId": "wall_shared_gallery",
+ "wallSlug": "shared-gallery",
+ "encryptedWallKey": encode_b64(&pack_payload(&sealed_share, &[])),
+ "encryptedPublicProfile": "",
+ "encryptedPrivateProfile": "",
+ "keyVersion": 4
+ }])
+ .to_string(),
+ )
+ .create_async()
+ .await;
+
+ let hydrated = ctx
+ .hydrate_wall_keys()
+ .await
+ .expect("wall keys should hydrate");
+
+ assert_eq!(hydrated.owned.len(), 1);
+ assert_eq!(hydrated.owned[0].0, "wall_owner_gallery");
+ assert_eq!(hydrated.owned[0].1, owned_wall_key);
+ assert_eq!(hydrated.followed.len(), 1);
+ assert_eq!(hydrated.followed[0].wall_id, "wall_shared_gallery");
+ assert_eq!(hydrated.followed[0].wall_key, shared_wall_key);
+ entity.assert_async().await;
+ owned.assert_async().await;
+ shares.assert_async().await;
+ }
+
+ #[test]
+ fn build_history_walks_back_versions() {
+ let v3 = generate_key();
+ let v2 = generate_key();
+ let v1 = generate_key();
+ let versions = vec![
+ WallKeyVersionResponse {
+ version: 3,
+ wrapped_prev_key: encode_b64(&encrypt_secretbox_packed(&v3, &v2).expect("wrap v2")),
+ created_at: "2026-01-03T00:00:00Z".to_owned(),
+ },
+ WallKeyVersionResponse {
+ version: 2,
+ wrapped_prev_key: encode_b64(&encrypt_secretbox_packed(&v2, &v1).expect("wrap v1")),
+ created_at: "2026-01-02T00:00:00Z".to_owned(),
+ },
+ ];
+
+ let history = build_wall_key_history_map(3, &v3, &versions).expect("history");
+
+ assert_eq!(history.get(&3), Some(&v3));
+ assert_eq!(history.get(&2), Some(&v2));
+ assert_eq!(history.get(&1), Some(&v1));
+ }
+}
diff --git a/rust/wall/src/crypto.rs b/rust/wall/src/crypto.rs
new file mode 100644
index 0000000000..bbd0a18b0b
--- /dev/null
+++ b/rust/wall/src/crypto.rs
@@ -0,0 +1,148 @@
+use base64::{
+ Engine,
+ engine::general_purpose::{STANDARD, URL_SAFE_NO_PAD},
+};
+use ente_core::crypto::{keys, secretbox};
+use sha2::{Digest, Sha256};
+
+use crate::error::{Result, WallError};
+use crate::transport::EntityKeyPayload;
+
+pub const SECRETBOX_NONCE_BYTES: usize = secretbox::NONCE_BYTES;
+
+pub fn generate_key() -> Vec<u8> {
+ keys::generate_key_secure().into_vec()
+}
+
+pub fn encode_b64(bytes: &[u8]) -> String {
+ STANDARD.encode(bytes)
+}
+
+pub fn decode_b64(value: &str) -> Result<Vec<u8>> {
+ Ok(STANDARD.decode(value.trim())?)
+}
+
+pub fn encode_b64_url(bytes: &[u8]) -> String {
+ URL_SAFE_NO_PAD.encode(bytes)
+}
+
+pub fn decode_b64_url(value: &str) -> Result<Vec<u8>> {
+ Ok(URL_SAFE_NO_PAD.decode(value.trim())?)
+}
+
+pub fn derive_labeled_key(secret: &[u8], label: &str) -> Vec<u8> {
+ let mut hasher = Sha256::new();
+ hasher.update(secret);
+ hasher.update(label.as_bytes());
+ hasher.finalize().to_vec()
+}
+
+pub fn encrypt_secretbox_split(key: &[u8], plaintext: &[u8]) -> Result<(Vec<u8>, Vec<u8>)> {
+ let encrypted = secretbox::encrypt_with_key(plaintext, key)?;
+ Ok((encrypted.ciphertext, encrypted.nonce))
+}
+
+pub fn decrypt_secretbox_split(key: &[u8], ciphertext: &[u8], nonce: &[u8]) -> Result<Vec<u8>> {
+ if nonce.len() != SECRETBOX_NONCE_BYTES {
+ return Err(WallError::InvalidInput(
+ "invalid secretbox nonce length".into(),
+ ));
+ }
+ secretbox::decrypt(ciphertext, nonce, key).map_err(Into::into)
+}
+
+pub fn encrypt_secretbox_packed(key: &[u8], plaintext: &[u8]) -> Result<Vec<u8>> {
+ let (ciphertext, nonce) = encrypt_secretbox_split(key, plaintext)?;
+ Ok(pack_payload(&ciphertext, &nonce))
+}
+
+pub fn decrypt_secretbox_packed(key: &[u8], packed: &[u8]) -> Result<Vec<u8>> {
+ let (ciphertext, nonce) = unpack_payload(packed)?;
+ decrypt_secretbox_split(key, &ciphertext, &nonce)
+}
+
+pub fn encrypt_entity_key(master_key: &[u8], plaintext: &[u8]) -> Result<EntityKeyPayload> {
+ let (ciphertext, nonce) = encrypt_secretbox_split(master_key, plaintext)?;
+ Ok(EntityKeyPayload {
+ encrypted_key: encode_b64(&ciphertext),
+ nonce: encode_b64(&nonce),
+ })
+}
+
+pub fn decrypt_entity_key(master_key: &[u8], payload: &EntityKeyPayload) -> Result<Vec<u8>> {
+ let ciphertext = decode_b64(&payload.encrypted_key)?;
+ let nonce = decode_b64(&payload.nonce)?;
+ decrypt_secretbox_split(master_key, &ciphertext, &nonce)
+}
+
+pub fn pack_payload(ciphertext: &[u8], nonce: &[u8]) -> Vec<u8> {
+ if ciphertext.is_empty() && nonce.is_empty() {
+ return Vec::new();
+ }
+ let mut out = Vec::with_capacity(2 + nonce.len() + ciphertext.len());
+ out.extend_from_slice(&(nonce.len() as u16).to_be_bytes());
+ out.extend_from_slice(nonce);
+ out.extend_from_slice(ciphertext);
+ out
+}
+
+pub fn unpack_payload(packed: &[u8]) -> Result<(Vec<u8>, Vec<u8>)> {
+ if packed.is_empty() {
+ return Ok((Vec::new(), Vec::new()));
+ }
+ if packed.len() < 2 {
+ return Err(WallError::InvalidInput("packed payload too short".into()));
+ }
+ let nonce_len = u16::from_be_bytes([packed[0], packed[1]]) as usize;
+ if packed.len() < 2 + nonce_len {
+ return Err(WallError::InvalidInput("packed payload truncated".into()));
+ }
+ Ok((
+ packed[2 + nonce_len..].to_vec(),
+ packed[2..2 + nonce_len].to_vec(),
+ ))
+}
+
+pub fn encrypt_asset_payload(key: &[u8], plaintext: &[u8]) -> Result<Vec<u8>> {
+ encrypt_secretbox_packed(key, plaintext)
+}
+
+pub fn decrypt_asset_payload(key: &[u8], payload: &[u8]) -> Result<Vec<u8>> {
+ decrypt_secretbox_packed(key, payload)
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ #[test]
+ fn packed_secretbox_round_trip() {
+ let key = generate_key();
+ let plaintext = b"hello wall";
+ let packed = encrypt_secretbox_packed(&key, plaintext).unwrap();
+ let decrypted = decrypt_secretbox_packed(&key, &packed).unwrap();
+ assert_eq!(decrypted, plaintext);
+ }
+
+ #[test]
+ fn labeled_key_matches_frontend_ordering() {
+ let secret = b"secret";
+ let derived = derive_labeled_key(secret, "wall-link-login-v1");
+ let expected = {
+ let mut hasher = Sha256::new();
+ hasher.update(secret);
+ hasher.update(b"wall-link-login-v1");
+ hasher.finalize().to_vec()
+ };
+ assert_eq!(derived, expected);
+ }
+
+ #[test]
+ fn asset_round_trip() {
+ let key = generate_key();
+ let plaintext = b"asset-bytes";
+ let encrypted = encrypt_asset_payload(&key, plaintext).unwrap();
+ let decrypted = decrypt_asset_payload(&key, &encrypted).unwrap();
+ assert_eq!(decrypted, plaintext);
+ }
+}
diff --git a/rust/wall/src/error.rs b/rust/wall/src/error.rs
new file mode 100644
index 0000000000..54e924f5d8
--- /dev/null
+++ b/rust/wall/src/error.rs
@@ -0,0 +1,32 @@
+use base64::DecodeError;
+use ente_core::{auth::AuthError, crypto::CryptoError, http::Error as HttpError};
+use thiserror::Error;
+
+#[derive(Debug, Error)]
+pub enum WallError {
+ #[error(transparent)]
+ Http(#[from] HttpError),
+
+ #[error(transparent)]
+ Crypto(#[from] CryptoError),
+
+ #[error(transparent)]
+ Auth(#[from] AuthError),
+
+ #[error(transparent)]
+ Base64(#[from] DecodeError),
+
+ #[error("invalid input: {0}")]
+ InvalidInput(String),
+
+ #[error("missing private key material")]
+ MissingPrivateKey,
+
+ #[error("missing encrypted wall key")]
+ MissingEncryptedWallKey,
+
+ #[error("entity key conflict")]
+ EntityKeyConflict,
+}
+
+pub type Result<T> = std::result::Result<T, WallError>;
diff --git a/rust/wall/src/lib.rs b/rust/wall/src/lib.rs
new file mode 100644
index 0000000000..34338bb10b
--- /dev/null
+++ b/rust/wall/src/lib.rs
@@ -0,0 +1,21 @@
+pub mod client;
+pub mod crypto;
+pub mod error;
+pub mod models;
+pub mod transport;
+
+pub use client::{AccountWallCtx, WallLinkCtx};
+pub use error::{Result, WallError};
+pub use models::{
+ AuthKeyAttributes, CreatedWall, CreatedWallLink, DecryptedComment, DecryptedFollowShare,
+ DecryptedPost, DecryptedWallProfile, FeedItem, FeedPage, HydratedKeys, OpenAccountWallCtxInput,
+ OpenWallLinkCtxInput, PrivateKeySource,
+};
+pub use transport::{
+ CommentResponse, CommunityResponse, CommunityUserResponse, EntityKeyPayload,
+ FollowRequestCreatedResponse, FollowRequestResponse, FollowShareResponse,
+ OutgoingFollowRequestResponse, PostObjectPayload, PostResponse, PresignUploadResponse,
+ ProfileAvatarPayload, ProfileAvatarResponse, WallFollowerResponse, WallKeyResponse,
+ WallKeyVersionResponse, WallLinkLoginResponse, WallLinkStatusResponse, WallLookupResponse,
+ WallProfileResponse,
+};
diff --git a/rust/wall/src/models.rs b/rust/wall/src/models.rs
new file mode 100644
index 0000000000..0b74e6f61c
--- /dev/null
+++ b/rust/wall/src/models.rs
@@ -0,0 +1,127 @@
+use serde::{Deserialize, Serialize};
+
+use crate::transport::{PostObjectPayload, ProfileAvatarResponse};
+
+#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
+#[serde(rename_all = "camelCase")]
+pub struct AuthKeyAttributes {
+ pub kek_salt: String,
+ pub encrypted_key: String,
+ pub key_decryption_nonce: String,
+ pub public_key: String,
+ pub encrypted_secret_key: String,
+ pub secret_key_decryption_nonce: String,
+ pub mem_limit: u32,
+ pub ops_limit: u32,
+}
+
+#[derive(Debug, Clone)]
+pub enum PrivateKeySource {
+ Plain(Vec<u8>),
+ EncryptedKeyAttributes(AuthKeyAttributes),
+}
+
+#[derive(Debug, Clone)]
+pub struct OpenAccountWallCtxInput {
+ pub base_url: String,
+ pub auth_token: String,
+ pub master_key: Vec<u8>,
+ pub public_key: Vec<u8>,
+ pub private_key_source: PrivateKeySource,
+ pub user_id: Option<i64>,
+ pub user_agent: Option<String>,
+ pub client_package: Option<String>,
+ pub client_version: Option<String>,
+}
+
+#[derive(Debug, Clone)]
+pub struct OpenWallLinkCtxInput {
+ pub base_url: String,
+ pub wall_id: String,
+ pub secret: String,
+ pub user_agent: Option<String>,
+ pub client_package: Option<String>,
+ pub client_version: Option<String>,
+}
+
+#[derive(Debug, Clone)]
+pub struct CreatedWall {
+ pub wall_id: String,
+ pub wall_slug: String,
+ pub key_version: i32,
+ pub wall_key: Vec<u8>,
+ pub encrypted_wall_key: String,
+ pub encrypted_profile: String,
+}
+
+#[derive(Debug, Clone)]
+pub struct CreatedWallLink {
+ pub secret: String,
+ pub owner_handle: String,
+ pub wall_id: String,
+ pub wall_slug: String,
+ pub key_version: i32,
+}
+
+#[derive(Debug, Clone)]
+pub struct DecryptedWallProfile {
+ pub wall_id: String,
+ pub wall_slug: String,
+ pub version: i32,
+ pub profile: Vec<u8>,
+ pub avatar: Option<ProfileAvatarResponse>,
+ pub updated_at: Option<String>,
+}
+
+#[derive(Debug, Clone)]
+pub struct DecryptedPost {
+ pub post_key: Vec<u8>,
+ pub caption_plaintext: Option<Vec<u8>>,
+}
+
+#[derive(Debug, Clone)]
+pub struct DecryptedComment {
+ pub plaintext: Vec<u8>,
+}
+
+#[derive(Debug, Clone)]
+pub struct DecryptedFollowShare {
+ pub followee: String,
+ pub wall_id: String,
+ pub wall_slug: String,
+ pub wall_key: Vec<u8>,
+ pub key_version: i32,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
+#[serde(rename_all = "camelCase")]
+pub struct FeedItem {
+ pub post_id: i64,
+ pub wall_id: String,
+ pub wall_slug: String,
+ pub owner_user_id: i64,
+ pub encrypted_post_key: String,
+ #[serde(default)]
+ pub caption_cipher: String,
+ pub key_version: i32,
+ #[serde(default)]
+ pub objects: Vec<PostObjectPayload>,
+ pub created_at: String,
+ pub likes: i64,
+ pub viewer_liked: bool,
+ pub comments: i64,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
+#[serde(rename_all = "camelCase")]
+pub struct FeedPage {
+ pub items: Vec<FeedItem>,
+ #[serde(default)]
+ pub next_cursor: String,
+}
+
+#[derive(Debug, Clone)]
+pub struct HydratedKeys {
+ pub owned: Vec<(String, Vec<u8>)>,
+ pub followed: Vec<DecryptedFollowShare>,
+}
diff --git a/rust/wall/src/transport.rs b/rust/wall/src/transport.rs
new file mode 100644
index 0000000000..ee91f4bf7c
--- /dev/null
+++ b/rust/wall/src/transport.rs
@@ -0,0 +1,443 @@
+use serde::{Deserialize, Serialize};
+
+fn is_false(value: &bool) -> bool {
+ !*value
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
+#[serde(rename_all = "camelCase")]
+pub struct EntityKeyPayload {
+ pub encrypted_key: String,
+ pub nonce: String,
+}
+
+#[derive(Debug, Clone, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct EntityKeyResponse {
+ #[serde(rename = "type")]
+ pub key_type: String,
+ pub encrypted_key: String,
+ pub nonce: String,
+}
+
+#[derive(Debug, Clone, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct CreateEntityKeyRequest {
+ #[serde(rename = "type")]
+ pub key_type: String,
+ pub encrypted_key: String,
+ pub nonce: String,
+}
+
+#[derive(Debug, Clone, Deserialize)]
+pub struct StatusResponse {
+ pub status: String,
+}
+
+#[derive(Debug, Clone, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct CreateWallRequest {
+ pub wall_slug: String,
+ pub encrypted_wall_key: String,
+ pub encrypted_profile: String,
+}
+
+#[derive(Debug, Clone, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct WallKeyResponse {
+ pub wall_id: String,
+ pub wall_slug: String,
+ pub encrypted_wall_key: String,
+ #[serde(default)]
+ pub encrypted_profile: String,
+ pub key_version: i32,
+}
+
+#[derive(Debug, Clone, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct PresignUploadRequest {
+ pub content_type: String,
+ pub size: i64,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub purpose: Option<String>,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub wall_id: Option<String>,
+}
+
+#[derive(Debug, Clone, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct PresignUploadResponse {
+ pub url: String,
+ pub method: String,
+ pub headers: std::collections::BTreeMap<String, String>,
+ pub object_key: String,
+ pub expires_in: i32,
+}
+
+#[derive(Debug, Clone, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct AssetDownloadResponse {
+ pub url: String,
+ pub expires_in: i32,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
+#[serde(rename_all = "camelCase")]
+pub struct PostObjectPayload {
+ pub object_key: String,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub content_type: Option<String>,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub size: Option<i64>,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub position: Option<i32>,
+ #[serde(default, skip_serializing_if = "Option::is_none")]
+ pub blur_hash_cipher: Option<String>,
+ #[serde(default, skip_serializing_if = "Option::is_none")]
+ pub variant: Option<String>,
+}
+
+#[derive(Debug, Clone, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct CreatePostRequest {
+ pub wall_id: String,
+ pub encrypted_post_key: String,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub caption_cipher: Option<String>,
+ pub objects: Vec<PostObjectPayload>,
+}
+
+#[derive(Debug, Clone, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct CreatePostResponse {
+ pub post_id: i64,
+}
+
+#[derive(Debug, Clone, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct LikePostRequest {
+ pub like: bool,
+}
+
+#[derive(Debug, Clone, Deserialize)]
+pub struct LikePostResponse {
+ pub liked: bool,
+}
+
+#[derive(Debug, Clone, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct UpdatePostCaptionRequest {
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub caption_cipher: Option<String>,
+}
+
+#[derive(Debug, Clone, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct PostResponse {
+ pub post_id: i64,
+ pub wall_id: String,
+ pub wall_slug: String,
+ pub author: String,
+ pub encrypted_post_key: String,
+ #[serde(default)]
+ pub caption_cipher: String,
+ pub key_version: i32,
+ #[serde(default)]
+ pub objects: Vec<PostObjectPayload>,
+ pub created_at: String,
+ pub likes: i64,
+ pub viewer_liked: bool,
+ pub comments: i64,
+}
+
+#[derive(Debug, Clone, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct CreateCommentRequest {
+ pub comment_cipher: String,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub parent_comment_id: Option<i64>,
+}
+
+#[derive(Debug, Clone, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct CommentResponse {
+ pub comment_id: i64,
+ pub author: String,
+ pub comment_cipher: String,
+ pub created_at: String,
+ pub viewer_can_delete: bool,
+ #[serde(default)]
+ pub parent_comment_id: Option<i64>,
+ #[serde(default)]
+ pub replies: Vec<CommentResponse>,
+}
+
+#[derive(Debug, Clone, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct ListCommentsResponse {
+ pub comments: Vec<CommentResponse>,
+ #[serde(default)]
+ pub next_cursor: String,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
+#[serde(rename_all = "camelCase")]
+pub struct ProfileAvatarPayload {
+ pub object_key: String,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub content_type: Option<String>,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub size: Option<i64>,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
+#[serde(rename_all = "camelCase")]
+pub struct ProfileAvatarResponse {
+ pub object_key: String,
+ #[serde(default)]
+ pub content_type: String,
+ #[serde(default)]
+ pub size: i64,
+ #[serde(default)]
+ pub updated_at: String,
+}
+
+#[derive(Debug, Clone, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct UpdateWallProfileRequest {
+ pub wall_id: String,
+ pub encrypted_profile: String,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub avatar: Option<ProfileAvatarPayload>,
+ #[serde(skip_serializing_if = "is_false")]
+ pub remove_avatar: bool,
+}
+
+#[derive(Debug, Clone, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct UpdateWallProfileResponse {
+ pub status: String,
+ #[serde(default)]
+ pub avatar: Option<ProfileAvatarResponse>,
+}
+
+#[derive(Debug, Clone, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct WallProfileResponse {
+ pub wall_id: String,
+ pub wall_slug: String,
+ pub version: i32,
+ #[serde(default)]
+ pub encrypted_profile: String,
+ #[serde(default)]
+ pub updated_at: String,
+ #[serde(default)]
+ pub avatar: Option<ProfileAvatarResponse>,
+}
+
+#[derive(Debug, Clone, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct RotateWallKeyRequest {
+ pub wall_id: String,
+ pub encrypted_wall_key: String,
+ pub wrapped_prev_key: String,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub encrypted_profile: Option<String>,
+}
+
+#[derive(Debug, Clone, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct WallKeyVersionResponse {
+ pub version: i32,
+ #[serde(default)]
+ pub wrapped_prev_key: String,
+ pub created_at: String,
+}
+
+#[cfg(test)]
+mod tests {
+ use super::AssetDownloadResponse;
+
+ #[test]
+ fn asset_download_response_deserializes_camel_case() {
+ let response: AssetDownloadResponse =
+ serde_json::from_str(r#"{"url":"http://127.0.0.1:3900/example","expiresIn":900}"#)
+ .expect("asset download response should deserialize");
+ assert_eq!(response.url, "http://127.0.0.1:3900/example");
+ assert_eq!(response.expires_in, 900);
+ }
+}
+
+#[derive(Debug, Clone, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct FollowRequestPayload {
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub target_username: Option<String>,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub target_wall_id: Option<String>,
+}
+
+#[derive(Debug, Clone, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct FollowRequestCreatedResponse {
+ pub request_id: i64,
+ pub status: String,
+}
+
+#[derive(Debug, Clone, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct FollowRequestResponse {
+ pub request_id: i64,
+ pub follower: String,
+ pub wall_id: String,
+ pub wall_slug: String,
+ pub follower_public_key: String,
+ pub status: String,
+ pub created_at: String,
+}
+
+#[derive(Debug, Clone, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct OutgoingFollowRequestResponse {
+ pub request_id: i64,
+ pub followee: String,
+ pub wall_id: String,
+ pub wall_slug: String,
+ pub status: String,
+ pub created_at: String,
+}
+
+#[derive(Debug, Clone, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct ApproveFollowPayload {
+ pub request_id: i64,
+ pub wall_id: String,
+ pub encrypted_wall_key: String,
+}
+
+#[derive(Debug, Clone, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct RejectFollowPayload {
+ pub request_id: i64,
+}
+
+#[derive(Debug, Clone, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct CancelFollowRequestPayload {
+ pub request_id: i64,
+}
+
+#[derive(Debug, Clone, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct WallFollowerResponse {
+ pub follower_id: i64,
+ pub username: String,
+ pub public_key: String,
+ pub key_version: i32,
+ pub created_at: String,
+}
+
+#[derive(Debug, Clone, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct ShareUpdatePayload {
+ pub follower_id: i64,
+ pub encrypted_wall_key: String,
+}
+
+#[derive(Debug, Clone, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct RefreshFollowSharesRequest {
+ pub wall_id: String,
+ pub shares: Vec<ShareUpdatePayload>,
+}
+
+#[derive(Debug, Clone, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct FollowShareResponse {
+ pub followee: String,
+ pub wall_id: String,
+ pub wall_slug: String,
+ pub encrypted_wall_key: String,
+ pub key_version: i32,
+}
+
+#[derive(Debug, Clone, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct WallLinkStatusResponse {
+ pub wall_id: String,
+ pub wall_slug: String,
+ pub key_version: i32,
+ pub active: bool,
+ pub created_at: String,
+ pub updated_at: String,
+}
+
+#[derive(Debug, Clone, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct WallLinkCreateRequest {
+ pub wall_id: String,
+ pub auth_key: String,
+ pub key_version: i32,
+ pub encrypted_wall_key: String,
+}
+
+#[derive(Debug, Clone, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct WallLinkLoginRequest {
+ pub wall_id: String,
+ pub auth_key: String,
+}
+
+#[derive(Debug, Clone, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct WallLinkLoginResponse {
+ pub session_token: String,
+ pub wall_id: String,
+ pub wall_slug: String,
+ pub owner: String,
+ pub key_version: i32,
+ pub encrypted_wall_key: String,
+}
+
+#[derive(Debug, Clone, Deserialize)]
+pub struct UpdatedCountResponse {
+ pub updated: usize,
+}
+
+#[derive(Debug, Clone, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct UpdateWallSlugRequest {
+ pub wall_slug: String,
+}
+
+#[derive(Debug, Clone, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct WallLookupResponse {
+ pub wall_id: String,
+ pub wall_slug: String,
+ pub owner: String,
+}
+
+#[derive(Debug, Clone, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct CommunityUserResponse {
+ pub username: String,
+ pub wall_id: String,
+ pub wall_slug: String,
+ pub followers: i64,
+ #[serde(default)]
+ pub following: i64,
+ pub posts: i64,
+ #[serde(default)]
+ pub relationship: String,
+ #[serde(default)]
+ pub bio: String,
+}
+
+#[derive(Debug, Clone, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct CommunityResponse {
+ pub users: Vec<CommunityUserResponse>,
+ #[serde(default)]
+ pub next_cursor: String,
+}