diff --git a/.github/workflows/bump-version.yml b/.github/workflows/bump-version.yml
index f6520e86..fb4e28b8 100644
--- a/.github/workflows/bump-version.yml
+++ b/.github/workflows/bump-version.yml
@@ -51,7 +51,7 @@ jobs:
- id: cargo-set-version
name: Set Version
- run: cargo set-version --bump ${{ inputs.version }}
+ run: cargo set-version --bump ${{ inputs.version }} --exclude protocol
- name: Set Crate Version as Environment Variable
id: set_crate_version
diff --git a/Cargo.lock b/Cargo.lock
index f251b811..64054d02 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -218,7 +218,7 @@ checksum = "9e8b47f52ea9bae42228d07ec09eb676433d7c4ed1ebdf0f1d1c29ed446f1ab8"
dependencies = [
"cfg-if",
"cipher 0.3.0",
- "cpufeatures 0.2.14",
+ "cpufeatures 0.2.15",
"opaque-debug 0.3.1",
]
@@ -230,7 +230,7 @@ checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0"
dependencies = [
"cfg-if",
"cipher 0.4.4",
- "cpufeatures 0.2.14",
+ "cpufeatures 0.2.15",
]
[[package]]
@@ -249,7 +249,7 @@ dependencies = [
[[package]]
name = "agent"
-version = "3.2.0"
+version = "3.3.0"
dependencies = [
"actix-rt",
"actix-web",
@@ -279,7 +279,7 @@ dependencies = [
"sha2 0.10.8",
"shadow-rs",
"sysinfo",
- "thiserror",
+ "thiserror 1.0.69",
"tokio",
"trait-variant",
"url",
@@ -342,9 +342,9 @@ dependencies = [
[[package]]
name = "anstream"
-version = "0.6.17"
+version = "0.6.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "23a1e53f0f5d86382dafe1cf314783b2044280f406e7e1506368220ad11b1338"
+checksum = "8acc5369981196006228e28809f761875c0327210a891e941f4c683b3a99529b"
dependencies = [
"anstyle",
"anstyle-parse",
@@ -391,15 +391,15 @@ dependencies = [
[[package]]
name = "anyhow"
-version = "1.0.92"
+version = "1.0.93"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "74f37166d7d48a0284b99dd824694c26119c700b53bf0d1540cdb147dbdaaf13"
+checksum = "4c95c10ba0b00a02636238b814946408b1322d5ac4760326e6fb8ec956d85775"
[[package]]
name = "arbitrary"
-version = "1.3.2"
+version = "1.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7d5a26814d8dcb93b0e5a0ff3c6d80a8843bafb21b39e8e18a6f05471870e110"
+checksum = "dde20b3d026af13f561bdd0f15edf01fc734f0dafcedbaf42bba506a9517f223"
dependencies = [
"derive_arbitrary",
]
@@ -493,7 +493,7 @@ checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b"
[[package]]
name = "bin"
-version = "3.2.0"
+version = "3.3.0"
dependencies = [
"agent",
"clap",
@@ -623,9 +623,9 @@ dependencies = [
[[package]]
name = "cc"
-version = "1.1.34"
+version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "67b9470d453346108f93a59222a9a1a5724db32d0a4727b7ab7ace4b4d822dc9"
+checksum = "fd9de9f2205d5ef3fd67e685b0df337994ddd4495e2a28d185500d0e1edfea47"
dependencies = [
"jobserver",
"libc",
@@ -711,9 +711,9 @@ dependencies = [
[[package]]
name = "clap"
-version = "4.5.20"
+version = "4.5.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b97f376d85a664d5837dbae44bf546e6477a679ff6610010f17276f686d867e8"
+checksum = "fb3b4b9e5a7c7514dfa52869339ee98b3156b0bfb4e8a77c4ff4babb64b1604f"
dependencies = [
"clap_builder",
"clap_derive",
@@ -721,9 +721,9 @@ dependencies = [
[[package]]
name = "clap_builder"
-version = "4.5.20"
+version = "4.5.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "19bc80abd44e4bed93ca373a0704ccbd1b710dc5749406201bb018272808dc54"
+checksum = "b17a95aa67cc7b5ebd32aa5370189aa0d79069ef1c64ce893bd30fb24bff20ec"
dependencies = [
"anstream",
"anstyle",
@@ -745,9 +745,9 @@ dependencies = [
[[package]]
name = "clap_lex"
-version = "0.7.2"
+version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97"
+checksum = "afb84c814227b90d6895e01398aee0d8033c00e7466aca416fb6a8e0eb19d8a7"
[[package]]
name = "colorchoice"
@@ -801,7 +801,7 @@ checksum = "7c74b8349d32d297c9134b8c88677813a227df8f779daa29bfc29c183fe3dca6"
[[package]]
name = "controller"
-version = "3.2.0"
+version = "3.3.0"
dependencies = [
"bytes",
"chrono",
@@ -820,7 +820,7 @@ dependencies = [
"shadow-rs",
"sysinfo",
"tar",
- "thiserror",
+ "thiserror 1.0.69",
"tokio",
"zip",
]
@@ -869,9 +869,9 @@ dependencies = [
[[package]]
name = "cpufeatures"
-version = "0.2.14"
+version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "608697df725056feaccfa42cffdaeeec3fccc4ffc38358ecd19b243e716a78e0"
+checksum = "0ca741a962e1b0bff6d724a1a0958b686406e853bb14061f218562e1896f95e6"
dependencies = [
"libc",
]
@@ -1033,7 +1033,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be"
dependencies = [
"cfg-if",
- "cpufeatures 0.2.14",
+ "cpufeatures 0.2.15",
"curve25519-dalek-derive",
"fiat-crypto",
"rustc_version",
@@ -1103,9 +1103,9 @@ dependencies = [
[[package]]
name = "derive_arbitrary"
-version = "1.3.2"
+version = "1.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611"
+checksum = "30542c1ad912e0e3d22a1935c290e12e8a29d704a420177a31faad4a601a0800"
dependencies = [
"proc-macro2",
"quote",
@@ -1150,7 +1150,7 @@ dependencies = [
"serde",
"serde_json",
"sha2 0.8.2",
- "thiserror",
+ "thiserror 1.0.69",
"uuid",
"x25519-dalek 1.1.1",
]
@@ -1416,7 +1416,7 @@ dependencies = [
"proc-macro2",
"quote",
"syn 1.0.109",
- "synstructure",
+ "synstructure 0.12.6",
]
[[package]]
@@ -1726,9 +1726,9 @@ dependencies = [
[[package]]
name = "hashbrown"
-version = "0.15.0"
+version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb"
+checksum = "3a9bfc1af68b1726ea47d3d5109de126281def866b33970e10fbab11b5dafab3"
[[package]]
name = "heck"
@@ -1954,14 +1954,143 @@ dependencies = [
"cc",
]
+[[package]]
+name = "icu_collections"
+version = "1.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "db2fa452206ebee18c4b5c2274dbf1de17008e874b4dc4f0aea9d01ca79e4526"
+dependencies = [
+ "displaydoc",
+ "yoke",
+ "zerofrom",
+ "zerovec",
+]
+
+[[package]]
+name = "icu_locid"
+version = "1.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "13acbb8371917fc971be86fc8057c41a64b521c184808a698c02acc242dbf637"
+dependencies = [
+ "displaydoc",
+ "litemap",
+ "tinystr",
+ "writeable",
+ "zerovec",
+]
+
+[[package]]
+name = "icu_locid_transform"
+version = "1.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "01d11ac35de8e40fdeda00d9e1e9d92525f3f9d887cdd7aa81d727596788b54e"
+dependencies = [
+ "displaydoc",
+ "icu_locid",
+ "icu_locid_transform_data",
+ "icu_provider",
+ "tinystr",
+ "zerovec",
+]
+
+[[package]]
+name = "icu_locid_transform_data"
+version = "1.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fdc8ff3388f852bede6b579ad4e978ab004f139284d7b28715f773507b946f6e"
+
+[[package]]
+name = "icu_normalizer"
+version = "1.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "19ce3e0da2ec68599d193c93d088142efd7f9c5d6fc9b803774855747dc6a84f"
+dependencies = [
+ "displaydoc",
+ "icu_collections",
+ "icu_normalizer_data",
+ "icu_properties",
+ "icu_provider",
+ "smallvec",
+ "utf16_iter",
+ "utf8_iter",
+ "write16",
+ "zerovec",
+]
+
+[[package]]
+name = "icu_normalizer_data"
+version = "1.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f8cafbf7aa791e9b22bec55a167906f9e1215fd475cd22adfcf660e03e989516"
+
+[[package]]
+name = "icu_properties"
+version = "1.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "93d6020766cfc6302c15dbbc9c8778c37e62c14427cb7f6e601d849e092aeef5"
+dependencies = [
+ "displaydoc",
+ "icu_collections",
+ "icu_locid_transform",
+ "icu_properties_data",
+ "icu_provider",
+ "tinystr",
+ "zerovec",
+]
+
+[[package]]
+name = "icu_properties_data"
+version = "1.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "67a8effbc3dd3e4ba1afa8ad918d5684b8868b3b26500753effea8d2eed19569"
+
+[[package]]
+name = "icu_provider"
+version = "1.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6ed421c8a8ef78d3e2dbc98a973be2f3770cb42b606e3ab18d6237c4dfde68d9"
+dependencies = [
+ "displaydoc",
+ "icu_locid",
+ "icu_provider_macros",
+ "stable_deref_trait",
+ "tinystr",
+ "writeable",
+ "yoke",
+ "zerofrom",
+ "zerovec",
+]
+
+[[package]]
+name = "icu_provider_macros"
+version = "1.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.87",
+]
+
[[package]]
name = "idna"
-version = "0.5.0"
+version = "1.0.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e"
+dependencies = [
+ "idna_adapter",
+ "smallvec",
+ "utf8_iter",
+]
+
+[[package]]
+name = "idna_adapter"
+version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6"
+checksum = "daca1df1c957320b2cf139ac61e7bd64fed304c5040df000a745aa1de3b4ef71"
dependencies = [
- "unicode-bidi",
- "unicode-normalization",
+ "icu_normalizer",
+ "icu_properties",
]
[[package]]
@@ -2064,7 +2193,7 @@ version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654"
dependencies = [
- "cpufeatures 0.2.14",
+ "cpufeatures 0.2.15",
]
[[package]]
@@ -2087,9 +2216,9 @@ checksum = "884609db30d6c40a6bd8e0e22b0b5002546e4dcb53295d33fc700b1644b8a656"
[[package]]
name = "libc"
-version = "0.2.161"
+version = "0.2.162"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8e9489c2807c139ffd9c1794f4af0ebe86a828db53ecdc7fea2111d0fed085d1"
+checksum = "18d287de67fe55fd7e1581fe933d965a5a9477b38e949cfa9f8574ef01506398"
[[package]]
name = "libgit2-sys"
@@ -2132,6 +2261,12 @@ version = "0.4.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89"
+[[package]]
+name = "litemap"
+version = "0.7.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "643cb0b8d4fcc284004d5fd0d67ccf61dfffadb7f75e1e71bc420f4688a3a704"
+
[[package]]
name = "local-channel"
version = "0.1.5"
@@ -2495,7 +2630,7 @@ version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "048aeb476be11a4b6ca432ca569e375810de9294ae78f4774e78ea98a9246ede"
dependencies = [
- "cpufeatures 0.2.14",
+ "cpufeatures 0.2.15",
"opaque-debug 0.3.1",
"universal-hash",
]
@@ -2507,7 +2642,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8419d2b623c7c0896ff2d5d96e2cb4ede590fed28fcc34934f4c33c036e620a1"
dependencies = [
"cfg-if",
- "cpufeatures 0.2.14",
+ "cpufeatures 0.2.15",
"opaque-debug 0.3.1",
"universal-hash",
]
@@ -2547,7 +2682,7 @@ dependencies = [
[[package]]
name = "protocol"
-version = "0.3.0"
+version = "0.2.0"
dependencies = [
"actix-rt",
"chrono",
@@ -2563,7 +2698,7 @@ dependencies = [
"serde_jcs",
"serde_json",
"sha2 0.10.8",
- "thiserror",
+ "thiserror 1.0.69",
"trait-variant",
"x25519-dalek 2.0.1",
"zeroize",
@@ -2571,9 +2706,9 @@ dependencies = [
[[package]]
name = "quinn"
-version = "0.11.5"
+version = "0.11.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8c7c5fdde3cdae7203427dc4f0a68fe0ed09833edc525a03456b153b79828684"
+checksum = "62e96808277ec6f97351a2380e6c25114bc9e67037775464979f3037c92d05ef"
dependencies = [
"bytes",
"pin-project-lite",
@@ -2582,33 +2717,36 @@ dependencies = [
"rustc-hash",
"rustls 0.23.16",
"socket2",
- "thiserror",
+ "thiserror 2.0.3",
"tokio",
"tracing",
]
[[package]]
name = "quinn-proto"
-version = "0.11.8"
+version = "0.11.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fadfaed2cd7f389d0161bb73eeb07b7b78f8691047a6f3e73caaeae55310a4a6"
+checksum = "a2fe5ef3495d7d2e377ff17b1a8ce2ee2ec2a18cde8b6ad6619d65d0701c135d"
dependencies = [
"bytes",
+ "getrandom 0.2.15",
"rand 0.8.5",
"ring",
"rustc-hash",
"rustls 0.23.16",
+ "rustls-pki-types",
"slab",
- "thiserror",
+ "thiserror 2.0.3",
"tinyvec",
"tracing",
+ "web-time",
]
[[package]]
name = "quinn-udp"
-version = "0.5.6"
+version = "0.5.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e346e016eacfff12233c243718197ca12f148c84e1e84268a896699b41c71780"
+checksum = "7d5a626c6807713b15cac82a6acaccd6043c9a5408c24baae07611fec3f243da"
dependencies = [
"cfg_aliases 0.2.1",
"libc",
@@ -2735,7 +2873,7 @@ checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43"
dependencies = [
"getrandom 0.2.15",
"libredox",
- "thiserror",
+ "thiserror 1.0.69",
]
[[package]]
@@ -2752,9 +2890,9 @@ dependencies = [
[[package]]
name = "regex-automata"
-version = "0.4.8"
+version = "0.4.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "368758f23274712b504848e9d5a6f010445cc8b87a7cdb4d7cbee666c1288da3"
+checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908"
dependencies = [
"aho-corasick",
"memchr",
@@ -2889,7 +3027,7 @@ dependencies = [
"rustls-native-certs 0.7.3",
"rustls-pemfile",
"rustls-webpki",
- "thiserror",
+ "thiserror 1.0.69",
"tokio",
"tokio-rustls 0.25.0",
]
@@ -2917,9 +3055,9 @@ dependencies = [
[[package]]
name = "rustix"
-version = "0.38.39"
+version = "0.38.40"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "375116bee2be9ed569afe2154ea6a99dfdffd257f533f187498c2a8f5feaf4ee"
+checksum = "99e4ea3e1cdc4b559b8e5650f9c8e5998e3e5c1343b4eaf034565f32318d63c0"
dependencies = [
"bitflags",
"errno",
@@ -2996,6 +3134,9 @@ name = "rustls-pki-types"
version = "1.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "16f1201b3c9a7ee8039bcadc17b7e605e2945b27eee7631788c1bd2b0643674b"
+dependencies = [
+ "web-time",
+]
[[package]]
name = "rustls-webpki"
@@ -3065,9 +3206,9 @@ dependencies = [
[[package]]
name = "security-framework-sys"
-version = "2.12.0"
+version = "2.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ea4a292869320c0272d7bc55a5a6aafaff59b4f63404a003887b679a2e05b4b6"
+checksum = "fa39c7303dc58b5543c94d22c1766b0d31f2ee58306363ea622b10bbc075eaa2"
dependencies = [
"core-foundation-sys",
"libc",
@@ -3081,18 +3222,18 @@ checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b"
[[package]]
name = "serde"
-version = "1.0.214"
+version = "1.0.215"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f55c3193aca71c12ad7890f1785d2b73e1b9f63a0bbc353c08ef26fe03fc56b5"
+checksum = "6513c1ad0b11a9376da888e3e0baa0077f1aed55c17f50e7b2397136129fb88f"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
-version = "1.0.214"
+version = "1.0.215"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "de523f781f095e28fa605cdce0f8307e451cc0fd14e2eb4cd2e98a355b147766"
+checksum = "ad1e866f866923f252f05c889987993144fb74e722403468a4ebd70c3cd756c0"
dependencies = [
"proc-macro2",
"quote",
@@ -3164,7 +3305,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba"
dependencies = [
"cfg-if",
- "cpufeatures 0.2.14",
+ "cpufeatures 0.2.15",
"digest 0.10.7",
]
@@ -3188,7 +3329,7 @@ checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800"
dependencies = [
"block-buffer 0.9.0",
"cfg-if",
- "cpufeatures 0.2.14",
+ "cpufeatures 0.2.15",
"digest 0.9.0",
"opaque-debug 0.3.1",
]
@@ -3200,7 +3341,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8"
dependencies = [
"cfg-if",
- "cpufeatures 0.2.14",
+ "cpufeatures 0.2.15",
"digest 0.10.7",
]
@@ -3321,6 +3462,12 @@ dependencies = [
"der 0.7.9",
]
+[[package]]
+name = "stable_deref_trait"
+version = "1.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
+
[[package]]
name = "strsim"
version = "0.11.1"
@@ -3376,6 +3523,17 @@ dependencies = [
"unicode-xid",
]
+[[package]]
+name = "synstructure"
+version = "0.13.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.87",
+]
+
[[package]]
name = "sysinfo"
version = "0.30.13"
@@ -3413,18 +3571,38 @@ dependencies = [
[[package]]
name = "thiserror"
-version = "1.0.67"
+version = "1.0.69"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52"
+dependencies = [
+ "thiserror-impl 1.0.69",
+]
+
+[[package]]
+name = "thiserror"
+version = "2.0.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c006c85c7651b3cf2ada4584faa36773bd07bac24acfb39f3c431b36d7e667aa"
+dependencies = [
+ "thiserror-impl 2.0.3",
+]
+
+[[package]]
+name = "thiserror-impl"
+version = "1.0.69"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3b3c6efbfc763e64eb85c11c25320f0737cb7364c4b6336db90aa9ebe27a0bbd"
+checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1"
dependencies = [
- "thiserror-impl",
+ "proc-macro2",
+ "quote",
+ "syn 2.0.87",
]
[[package]]
name = "thiserror-impl"
-version = "1.0.67"
+version = "2.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b607164372e89797d78b8e23a6d67d5d1038c1c65efd52e1389ef8b77caba2a6"
+checksum = "f077553d607adc1caf65430528a576c757a71ed73944b66ebb58ef2bbd243568"
dependencies = [
"proc-macro2",
"quote",
@@ -3464,6 +3642,16 @@ dependencies = [
"time-core",
]
+[[package]]
+name = "tinystr"
+version = "0.7.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f"
+dependencies = [
+ "displaydoc",
+ "zerovec",
+]
+
[[package]]
name = "tinyvec"
version = "1.8.0"
@@ -3481,9 +3669,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
[[package]]
name = "tokio"
-version = "1.41.0"
+version = "1.41.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "145f3413504347a2be84393cc8a7d2fb4d863b375909ea59f2158261aa258bbb"
+checksum = "22cfb5bee7a6a52939ca9224d6ac897bb669134078daa8735560897f69de4d33"
dependencies = [
"backtrace",
"bytes",
@@ -3647,27 +3835,12 @@ dependencies = [
"tz-rs",
]
-[[package]]
-name = "unicode-bidi"
-version = "0.3.17"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5ab17db44d7388991a428b2ee655ce0c212e862eff1768a455c58f9aad6e7893"
-
[[package]]
name = "unicode-ident"
version = "1.0.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe"
-[[package]]
-name = "unicode-normalization"
-version = "0.1.24"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956"
-dependencies = [
- "tinyvec",
-]
-
[[package]]
name = "unicode-xid"
version = "0.2.6"
@@ -3698,15 +3871,27 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"
[[package]]
name = "url"
-version = "2.5.2"
+version = "2.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c"
+checksum = "8d157f1b96d14500ffdc1f10ba712e780825526c03d9a49b4d0324b0d9113ada"
dependencies = [
"form_urlencoded",
"idna",
"percent-encoding",
]
+[[package]]
+name = "utf16_iter"
+version = "1.0.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246"
+
+[[package]]
+name = "utf8_iter"
+version = "1.0.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be"
+
[[package]]
name = "utf8parse"
version = "0.2.2"
@@ -3846,6 +4031,16 @@ dependencies = [
"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 = "winapi"
version = "0.3.9"
@@ -4128,6 +4323,18 @@ dependencies = [
"memchr",
]
+[[package]]
+name = "write16"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936"
+
+[[package]]
+name = "writeable"
+version = "0.5.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51"
+
[[package]]
name = "x25519-dalek"
version = "1.1.1"
@@ -4162,6 +4369,30 @@ dependencies = [
"rustix",
]
+[[package]]
+name = "yoke"
+version = "0.7.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6c5b1314b079b0930c31e3af543d8ee1757b1951ae1e1565ec704403a7240ca5"
+dependencies = [
+ "serde",
+ "stable_deref_trait",
+ "yoke-derive",
+ "zerofrom",
+]
+
+[[package]]
+name = "yoke-derive"
+version = "0.7.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "28cc31741b18cb6f1d5ff12f5b7523e3d6eb0852bbbad19d73905511d9849b95"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.87",
+ "synstructure 0.13.1",
+]
+
[[package]]
name = "zerocopy"
version = "0.7.35"
@@ -4183,6 +4414,27 @@ dependencies = [
"syn 2.0.87",
]
+[[package]]
+name = "zerofrom"
+version = "0.1.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "91ec111ce797d0e0784a1116d0ddcdbea84322cd79e5d5ad173daeba4f93ab55"
+dependencies = [
+ "zerofrom-derive",
+]
+
+[[package]]
+name = "zerofrom-derive"
+version = "0.1.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0ea7b4a3637ea8669cedf0f1fd5c286a17f3de97b8dd5a70a6c167a1730e63a5"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.87",
+ "synstructure 0.13.1",
+]
+
[[package]]
name = "zeroize"
version = "1.8.1"
@@ -4203,6 +4455,28 @@ dependencies = [
"syn 2.0.87",
]
+[[package]]
+name = "zerovec"
+version = "0.10.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "aa2b893d79df23bfb12d5461018d408ea19dfafe76c2c7ef6d4eba614f8ff079"
+dependencies = [
+ "yoke",
+ "zerofrom",
+ "zerovec-derive",
+]
+
+[[package]]
+name = "zerovec-derive"
+version = "0.10.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.87",
+]
+
[[package]]
name = "zip"
version = "2.2.0"
@@ -4225,7 +4499,7 @@ dependencies = [
"pbkdf2",
"rand 0.8.5",
"sha1",
- "thiserror",
+ "thiserror 1.0.69",
"time",
"zeroize",
"zopfli",
diff --git a/Cargo.toml b/Cargo.toml
index a5ec6d31..0617fe9b 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -14,14 +14,14 @@ keywords = ["did", "embedded", "iot", "root-of-trust"]
license-file = "LICENSE"
readme = "README.md"
repository = "https://github.com/nodecross/nodex"
-version = "3.2.0"
+version = "3.3.0"
[workspace.dependencies]
actix-rt = "2.9.0"
actix-web = "4.9.0"
agent = { path = "./agent" }
-anyhow = "1.0.90"
-bytes = "1.6.1"
+anyhow = "1.0.92"
+bytes = "1.8.0"
controller = { path = "./controller" }
chrono = { version = "0.4", features = ["serde"] }
cuid = "1.3.2"
@@ -44,14 +44,14 @@ reqwest = { version = "0.12", features = [
], default-features = false }
rstest = "0.21.0"
rumqttc = "0.24.0"
-serde = { version = "1.0.209", features = ["derive"] }
+serde = { version = "1.0.214", features = ["derive"] }
serde_jcs = "0.1.0"
serde_json = "1.0.132"
sha2 = "0.10.8"
shadow-rs = "0.35.1"
sysinfo = "0.30.13"
-thiserror = "1.0.64"
-tokio = { version = "1.40.0", features = ["full"] }
+thiserror = "1.0.69"
+tokio = { version = "1.41.1", features = ["full"] }
trait-variant = "0.1.2"
url = "2.5.2"
uuid = { version = "1.10.0", features = [
diff --git a/README.md b/README.md
index d2130b27..6a257b96 100644
--- a/README.md
+++ b/README.md
@@ -28,10 +28,6 @@ This repo where we develop libraries to be installed into your devices. It enabl
- Mutiple OS support for Linux kernel x86(32bit) & x86-64(64bit), FreeRTOS ARM Cortex-M33(32bit)
- RoT extensions for TPM, ARM TrustZone, and Renesas SCE
-## Install
-
-- [Build Guide](https://docs.nodecross.io/installation/00-overview.html)
-
## Developer's Document
- NodeX Official Website
diff --git a/agent/Cargo.toml b/agent/Cargo.toml
index 4d05d0ec..44aa3d1b 100644
--- a/agent/Cargo.toml
+++ b/agent/Cargo.toml
@@ -49,7 +49,7 @@ daemonize = "0.5.0"
nix = { version = "0.29.0", features = ["signal"] }
[build-dependencies]
-shadow-rs = "0.35.1"
+shadow-rs = "0.35.2"
[dev-dependencies]
rstest = { workspace = true }
diff --git a/agent/src/controllers/internal/network.rs b/agent/src/controllers/internal/network.rs
index 89ee184a..00574d3c 100644
--- a/agent/src/controllers/internal/network.rs
+++ b/agent/src/controllers/internal/network.rs
@@ -1,4 +1,7 @@
-use crate::services::studio::Studio;
+use crate::{
+ errors::{AgentError, AgentErrorCode},
+ services::studio::Studio,
+};
use actix_web::{web, HttpRequest, HttpResponse};
use serde::{Deserialize, Serialize};
use serde_json::Value;
@@ -12,13 +15,13 @@ pub struct MessageContainer {
pub async fn handler(
_req: HttpRequest,
web::Json(_): web::Json,
-) -> actix_web::Result {
+) -> actix_web::Result {
let studio = Studio::new();
match studio.network().await {
Ok(_) => Ok(HttpResponse::Ok().json("ok")),
Err(e) => {
log::error!("{:?}", e);
- Ok(HttpResponse::InternalServerError().json("Internal Server Error"))
+ Err(AgentErrorCode::NetworkInternal)?
}
}
}
diff --git a/agent/src/controllers/internal/version.rs b/agent/src/controllers/internal/version.rs
index dfba7864..5fbfe59c 100644
--- a/agent/src/controllers/internal/version.rs
+++ b/agent/src/controllers/internal/version.rs
@@ -1,4 +1,7 @@
-use crate::services::nodex::NodeX;
+use crate::{
+ errors::{AgentError, AgentErrorCode},
+ services::nodex::NodeX,
+};
use actix_web::{web, HttpRequest, HttpResponse};
use serde::{Deserialize, Serialize};
use serde_json::{json, Value};
@@ -18,18 +21,18 @@ pub async fn handler_get(_req: HttpRequest) -> actix_web::Result {
pub async fn handler_update(
_req: HttpRequest,
web::Json(json): web::Json,
-) -> actix_web::Result {
+) -> actix_web::Result {
let binary_url = match json.message["binary_url"].as_str() {
Some(url) => url,
- None => return Ok(HttpResponse::BadRequest().json("binary_url is required")),
+ None => Err(AgentErrorCode::VersionNoBinaryUrl)?,
};
let path = match json.message["path"].as_str() {
Some(p) => p,
- None => return Ok(HttpResponse::BadRequest().json("path is required")),
+ None => Err(AgentErrorCode::VersionNoPath)?,
};
let nodex = NodeX::new();
match nodex.update_version(binary_url, PathBuf::from(path)).await {
Ok(_) => Ok(HttpResponse::Ok().json("ok")),
- Err(_) => Ok(HttpResponse::InternalServerError().finish()),
+ Err(_) => Err(AgentErrorCode::VersionInternal)?,
}
}
diff --git a/agent/src/controllers/public/mod.rs b/agent/src/controllers/public/mod.rs
index b3130fc3..47b7cf8b 100644
--- a/agent/src/controllers/public/mod.rs
+++ b/agent/src/controllers/public/mod.rs
@@ -5,7 +5,7 @@ pub mod nodex_find_identifier;
pub mod nodex_receive;
pub mod nodex_verify_didcomm_message;
pub mod nodex_verify_verifiable_message;
-pub mod send_attributes;
+pub mod send_attribute;
pub mod send_custom_metric;
pub mod send_event;
mod utils;
diff --git a/agent/src/controllers/public/nodex_create_didcomm_message.rs b/agent/src/controllers/public/nodex_create_didcomm_message.rs
index 4532b408..683dda6c 100644
--- a/agent/src/controllers/public/nodex_create_didcomm_message.rs
+++ b/agent/src/controllers/public/nodex_create_didcomm_message.rs
@@ -4,6 +4,7 @@ use serde::{Deserialize, Serialize};
use protocol::didcomm::encrypted::DidCommEncryptedServiceGenerateError as S;
+use crate::errors::{AgentError, AgentErrorCode};
use crate::nodex::utils::did_accessor::DidAccessorImpl;
use crate::usecase::didcomm_message_usecase::GenerateDidcommMessageUseCaseError as U;
use crate::{services::studio::Studio, usecase::didcomm_message_usecase::DidcommMessageUseCase};
@@ -13,15 +14,28 @@ use super::utils;
// NOTE: POST /create-didcomm-message
#[derive(Deserialize, Serialize)]
pub struct MessageContainer {
+ #[serde(default)]
destination_did: String,
+ #[serde(default)]
message: String,
+ #[serde(default)]
operation_tag: String,
}
pub async fn handler(
_req: HttpRequest,
web::Json(json): web::Json,
-) -> actix_web::Result {
+) -> actix_web::Result {
+ if json.destination_did.is_empty() {
+ Err(AgentErrorCode::CreateDidCommMessageNoDestinationDid)?
+ }
+ if json.message.is_empty() {
+ Err(AgentErrorCode::CreateDidCommMessageNoMessage)?
+ }
+ if json.operation_tag.is_empty() {
+ Err(AgentErrorCode::CreateDidCommMessageNoOperationTag)?
+ }
+
let now = Utc::now();
let usecase =
@@ -33,30 +47,30 @@ pub async fn handler(
{
Ok(v) => Ok(HttpResponse::Ok().body(v)),
Err(e) => match e {
- U::MessageActivity(e) => Ok(utils::handle_status(e)),
+ U::MessageActivity(e) => Err(utils::handle_status(e)),
U::ServiceGenerate(S::DidDocNotFound(target)) => {
- log::warn!("Target DID not found. did = {}", target);
- Ok(HttpResponse::NotFound().finish())
+ log::warn!("target DID not found. did = {}", target);
+ Err(AgentErrorCode::CreateDidCommMessageNoDid)?
}
U::ServiceGenerate(S::DidPublicKeyNotFound(e)) => {
- log::warn!("cannot public key: {}", e);
- Ok(HttpResponse::BadRequest().body(e.to_string()))
+ log::warn!("cannot find public key: {}", e);
+ Err(AgentErrorCode::CreateDidCommMessageNoPubKey)?
}
U::Json(e) | U::ServiceGenerate(S::Json(e)) => {
log::warn!("json error: {}", e);
- Ok(HttpResponse::InternalServerError().finish())
+ Err(AgentErrorCode::CreateDidcommMessageInternal)?
}
U::ServiceGenerate(S::VcService(e)) => {
- log::warn!("verify error: {}", e);
- Ok(HttpResponse::Unauthorized().finish())
+ log::warn!("verify failed: {}", e);
+ Err(AgentErrorCode::CreateDidCommMessageVerifyFailed)?
}
U::ServiceGenerate(S::SidetreeFindRequestFailed(e)) => {
log::warn!("sidetree error: {}", e);
- Ok(HttpResponse::InternalServerError().finish())
+ Err(AgentErrorCode::CreateDidcommMessageInternal)?
}
U::ServiceGenerate(S::EncryptFailed(e)) => {
log::warn!("decrypt failed: {}", e);
- Ok(HttpResponse::InternalServerError().finish())
+ Err(AgentErrorCode::CreateDidcommMessageInternal)?
}
},
}
diff --git a/agent/src/controllers/public/nodex_create_identifier.rs b/agent/src/controllers/public/nodex_create_identifier.rs
index 58ec1ad3..aafe5e1c 100644
--- a/agent/src/controllers/public/nodex_create_identifier.rs
+++ b/agent/src/controllers/public/nodex_create_identifier.rs
@@ -1,18 +1,20 @@
use actix_web::{HttpRequest, HttpResponse};
use serde::{Deserialize, Serialize};
+use crate::errors::{AgentError, AgentErrorCode};
+
// NOTE: POST /identifiers
#[derive(Deserialize, Serialize)]
struct MessageContainer {}
-pub async fn handler(_req: HttpRequest) -> actix_web::Result {
+pub async fn handler(_req: HttpRequest) -> actix_web::Result {
let service = crate::services::nodex::NodeX::new();
match service.create_identifier().await {
Ok(v) => Ok(HttpResponse::Ok().json(&v)),
Err(e) => {
log::error!("{:?}", e);
- Ok(HttpResponse::InternalServerError().finish())
+ Err(AgentErrorCode::CreateIdentifierInternal)?
}
}
}
diff --git a/agent/src/controllers/public/nodex_create_verifiable_message.rs b/agent/src/controllers/public/nodex_create_verifiable_message.rs
index 687d391a..a0279917 100644
--- a/agent/src/controllers/public/nodex_create_verifiable_message.rs
+++ b/agent/src/controllers/public/nodex_create_verifiable_message.rs
@@ -2,6 +2,7 @@ use actix_web::{web, HttpRequest, HttpResponse};
use chrono::Utc;
use serde::{Deserialize, Serialize};
+use crate::errors::{AgentError, AgentErrorCode};
use crate::nodex::utils::did_accessor::DidAccessorImpl;
use crate::usecase::verifiable_message_usecase::CreateVerifiableMessageUseCaseError as U;
use crate::{
@@ -13,15 +14,27 @@ use super::utils;
// NOTE: POST /create-verifiable-message
#[derive(Deserialize, Serialize)]
pub struct MessageContainer {
+ #[serde(default)]
destination_did: String,
+ #[serde(default)]
message: String,
+ #[serde(default)]
operation_tag: String,
}
pub async fn handler(
_req: HttpRequest,
web::Json(json): web::Json,
-) -> actix_web::Result {
+) -> actix_web::Result {
+ if json.destination_did.is_empty() {
+ Err(AgentErrorCode::CreateVerifiableMessageNoDestinationDid)?
+ }
+ if json.message.is_empty() {
+ Err(AgentErrorCode::CreateVerifiableMessageNoMessage)?
+ }
+ if json.operation_tag.is_empty() {
+ Err(AgentErrorCode::CreateVerifiableMessageNoOperationTag)?
+ }
let now = Utc::now();
let repo = utils::did_repository();
@@ -34,20 +47,20 @@ pub async fn handler(
{
Ok(v) => Ok(HttpResponse::Ok().body(v)),
Err(e) => match e {
- U::MessageActivity(e) => Ok(utils::handle_status(e)),
+ U::MessageActivity(e) => Err(utils::handle_status(e)),
U::DestinationNotFound(e) => {
if let Some(e) = e {
log::error!("{:?}", e);
}
- Ok(HttpResponse::NotFound().finish())
+ Err(AgentErrorCode::CreateVerifiableMessageNoTargetDid)?
}
U::DidVcServiceGenerate(e) => {
log::error!("{:?}", e);
- Ok(HttpResponse::InternalServerError().finish())
+ Err(AgentErrorCode::CreateVerifiableMessageInternal)?
}
U::Json(e) => {
log::warn!("json error: {}", e);
- Ok(HttpResponse::InternalServerError().finish())
+ Err(AgentErrorCode::CreateVerifiableMessageInternal)?
}
},
}
diff --git a/agent/src/controllers/public/nodex_find_identifier.rs b/agent/src/controllers/public/nodex_find_identifier.rs
index ec95890a..c88ac355 100644
--- a/agent/src/controllers/public/nodex_find_identifier.rs
+++ b/agent/src/controllers/public/nodex_find_identifier.rs
@@ -1,18 +1,23 @@
use actix_web::{web, HttpRequest, HttpResponse};
use serde::{Deserialize, Serialize};
+use crate::errors::{AgentError, AgentErrorCode};
+
// NOTE: GET /identifiers/${ did }
#[derive(Deserialize, Serialize)]
struct MessageContainer {}
-pub async fn handler(_req: HttpRequest, did: web::Path) -> actix_web::Result {
+pub async fn handler(
+ _req: HttpRequest,
+ did: web::Path,
+) -> actix_web::Result {
let service = crate::services::nodex::NodeX::new();
match service.find_identifier(&did).await {
Ok(v) => Ok(HttpResponse::Ok().json(&v)),
Err(e) => {
log::error!("{:?}", e);
- Ok(HttpResponse::InternalServerError().finish())
+ Err(AgentErrorCode::FindIdentifierInternal)?
}
}
}
diff --git a/agent/src/controllers/public/nodex_verify_didcomm_message.rs b/agent/src/controllers/public/nodex_verify_didcomm_message.rs
index cdabef1e..96f20cec 100644
--- a/agent/src/controllers/public/nodex_verify_didcomm_message.rs
+++ b/agent/src/controllers/public/nodex_verify_didcomm_message.rs
@@ -5,6 +5,7 @@ use serde::{Deserialize, Serialize};
use protocol::didcomm::encrypted::DidCommEncryptedServiceVerifyError as S;
use protocol::didcomm::types::DidCommMessage;
+use crate::errors::{AgentError, AgentErrorCode};
use crate::nodex::utils::did_accessor::DidAccessorImpl;
use crate::{
services::studio::Studio,
@@ -18,60 +19,64 @@ use super::utils;
// NOTE: POST /verify-verifiable-message
#[derive(Deserialize, Serialize)]
pub struct MessageContainer {
+ #[serde(default)]
message: String,
}
pub async fn handler(
_req: HttpRequest,
web::Json(json): web::Json,
-) -> actix_web::Result {
+) -> actix_web::Result {
let now = Utc::now();
let usecase =
DidcommMessageUseCase::new(Studio::new(), utils::did_repository(), DidAccessorImpl {});
match serde_json::from_str::(&json.message) {
- Err(e) => Ok(HttpResponse::BadRequest().body(e.to_string())),
+ Err(e) => {
+ log::warn!("json error: {}", e);
+ Err(AgentErrorCode::VerifyDidcommMessageJsonError)?
+ }
Ok(message) => match usecase.verify(message, now).await {
Ok(v) => Ok(HttpResponse::Ok().json(v)),
Err(e) => match e {
- U::MessageActivity(e) => Ok(utils::handle_status(e)),
+ U::MessageActivity(e) => Err(utils::handle_status(e)),
U::NotAddressedToMe => {
- log::warn!("its not to me: {}", e);
- Ok(HttpResponse::Forbidden().finish())
+ log::warn!("this message is not addressed to me: {}", e);
+ Err(AgentErrorCode::VerifyDidcommMessageNotAddressedToMe)?
}
U::ServiceVerify(S::FindSender(e)) => {
log::warn!("cannot find sender: {}", e);
- Ok(HttpResponse::BadRequest().body(e.to_string()))
+ Err(AgentErrorCode::VerifyDidcommMessageNoSender)?
}
U::ServiceVerify(S::DidPublicKeyNotFound(e)) => {
- log::warn!("cannot public key: {}", e);
- Ok(HttpResponse::BadRequest().body(e.to_string()))
+ log::warn!("cannot find public key: {}", e);
+ Err(AgentErrorCode::VerifyDidcommMessageNoPublicKey)?
}
U::ServiceVerify(S::MetadataBodyNotFound(e)) => {
let e = e.map(|e| e.to_string()).unwrap_or("".to_string());
- log::warn!("cannot find sender: {}", e);
- Ok(HttpResponse::BadRequest().body(e))
+ log::warn!("cannot find metadata: {}", e);
+ Err(AgentErrorCode::VerifyDidcommMessageNoMetadata)?
}
U::ServiceVerify(S::VcService(e)) => {
- log::warn!("verify error: {}", e);
- Ok(HttpResponse::Unauthorized().finish())
+ log::warn!("verify failed: {}", e);
+ Err(AgentErrorCode::VerifyDidcommMessageVerifyFailed)?
}
U::ServiceVerify(S::DidDocNotFound(target)) => {
- log::warn!("Target DID not found. did = {}", target);
- Ok(HttpResponse::NotFound().finish())
+ log::warn!("target DID not found. DID = {}", target);
+ Err(AgentErrorCode::VerifyDidcommMessageNoTargetDid)?
}
U::Json(e) | U::ServiceVerify(S::Json(e)) => {
log::warn!("json error: {}", e);
- Ok(HttpResponse::InternalServerError().finish())
+ Err(AgentErrorCode::VerifyDidcommMessageInternal)?
}
U::ServiceVerify(S::DecryptFailed(e)) => {
log::warn!("decrypt failed: {}", e);
- Ok(HttpResponse::InternalServerError().finish())
+ Err(AgentErrorCode::VerifyDidcommMessageInternal)?
}
U::ServiceVerify(S::SidetreeFindRequestFailed(e)) => {
log::warn!("sidetree error: {}", e);
- Ok(HttpResponse::InternalServerError().finish())
+ Err(AgentErrorCode::VerifyDidcommMessageInternal)?
}
},
},
diff --git a/agent/src/controllers/public/nodex_verify_verifiable_message.rs b/agent/src/controllers/public/nodex_verify_verifiable_message.rs
index 842cc184..aafaf08b 100644
--- a/agent/src/controllers/public/nodex_verify_verifiable_message.rs
+++ b/agent/src/controllers/public/nodex_verify_verifiable_message.rs
@@ -5,6 +5,7 @@ use serde::{Deserialize, Serialize};
use protocol::verifiable_credentials::did_vc::DidVcServiceVerifyError as S;
use protocol::verifiable_credentials::types::VerifiableCredentials;
+use crate::errors::{AgentError, AgentErrorCode};
use crate::nodex::utils::did_accessor::DidAccessorImpl;
use crate::usecase::verifiable_message_usecase::VerifyVerifiableMessageUseCaseError as U;
use crate::{
@@ -16,13 +17,14 @@ use super::utils;
// NOTE: POST /verify-verifiable-message
#[derive(Deserialize, Serialize)]
pub struct MessageContainer {
+ #[serde(default)]
message: String,
}
pub async fn handler(
_req: HttpRequest,
web::Json(json): web::Json,
-) -> actix_web::Result {
+) -> actix_web::Result {
let now = Utc::now();
let repo = utils::did_repository();
@@ -30,31 +32,37 @@ pub async fn handler(
VerifiableMessageUseCase::new(Studio::new(), repo.clone(), DidAccessorImpl {}, repo);
match serde_json::from_str::(&json.message) {
- Err(e) => Ok(HttpResponse::BadRequest().body(e.to_string())),
+ Err(e) => {
+ log::warn!("json error: {}", e);
+ Err(AgentErrorCode::VerifyVerifiableMessageJsonError)?
+ }
Ok(vc) => match usecase.verify(vc, now).await {
Ok(v) => Ok(HttpResponse::Ok().json(v)),
Err(e) => match e {
- U::MessageActivity(e) => Ok(utils::handle_status(e)),
+ U::MessageActivity(e) => Err(utils::handle_status(e)),
U::DidVcServiceVerify(S::VerifyFailed(e)) => {
- log::warn!("verify error: {}", e);
- Ok(HttpResponse::Unauthorized().finish())
+ log::warn!("verify failed: {}", e);
+ Err(AgentErrorCode::VerifyVerifiableMessageVerifyFailed)?
}
U::DidVcServiceVerify(S::FindIdentifier(e)) => {
log::warn!("find identifier error: {}", e);
- Ok(HttpResponse::NotFound().finish())
+ Err(AgentErrorCode::VerifyVerifiableMessageNoIdentifier)?
}
U::DidVcServiceVerify(S::DidDocNotFound(target)) => {
- log::warn!("Target DID not found. did = {}", target);
- Ok(HttpResponse::NotFound().finish())
+ log::warn!("target DID not found. DID = {}", target);
+ Err(AgentErrorCode::VerifyVerifiableMessageNoTargetDid)?
+ }
+ U::NotAddressedToMe => {
+ log::warn!("this message is not addressed to me: {}", e);
+ Err(AgentErrorCode::VerifyVerifiableMessageNotAddressedToMe)?
}
- U::NotAddressedToMe => Ok(HttpResponse::Forbidden().finish()),
U::Json(e) => {
log::warn!("json error: {}", e);
- Ok(HttpResponse::InternalServerError().finish())
+ Err(AgentErrorCode::VerifyVerifiableMessageInternal)?
}
U::DidVcServiceVerify(S::PublicKeyNotFound(e)) => {
- log::warn!("cannot public key: {}", e);
- Ok(HttpResponse::BadRequest().body(e.to_string()))
+ log::warn!("cannot find public key: {}", e);
+ Err(AgentErrorCode::VerifyVerifiableMessageNoPublicKey)?
}
},
},
diff --git a/agent/src/controllers/public/send_attributes.rs b/agent/src/controllers/public/send_attribute.rs
similarity index 75%
rename from agent/src/controllers/public/send_attributes.rs
rename to agent/src/controllers/public/send_attribute.rs
index 171dcd59..800b3ba7 100644
--- a/agent/src/controllers/public/send_attributes.rs
+++ b/agent/src/controllers/public/send_attribute.rs
@@ -2,25 +2,28 @@ use actix_web::{web, HttpRequest, HttpResponse};
use serde::{Deserialize, Serialize};
use crate::{
+ errors::{AgentError, AgentErrorCode},
repository::attribute_repository::AttributeStoreRequest,
usecase::attribute_usecase::AttributeUsecase,
};
#[derive(Deserialize, Serialize)]
pub struct MessageContainer {
+ #[serde(default)]
key_name: String,
+ #[serde(default)]
value: String,
}
pub async fn handler(
_req: HttpRequest,
web::Json(json): web::Json,
-) -> actix_web::Result {
+) -> actix_web::Result {
if json.key_name.is_empty() {
- return Ok(HttpResponse::BadRequest().json("key_name is required"));
+ Err(AgentErrorCode::SendAttributeNoKeyName)?
}
if json.value.is_empty() {
- return Ok(HttpResponse::BadRequest().json("value is required"));
+ Err(AgentErrorCode::SendAttributeNoValue)?
}
let usecase = AttributeUsecase::new();
@@ -37,7 +40,7 @@ pub async fn handler(
}
Err(e) => {
log::error!("{:?}", e);
- Ok(HttpResponse::InternalServerError().json("internal server error"))
+ Err(AgentErrorCode::SendAttributeInternal)?
}
}
}
diff --git a/agent/src/controllers/public/send_custom_metric.rs b/agent/src/controllers/public/send_custom_metric.rs
index bddac1fc..58431959 100644
--- a/agent/src/controllers/public/send_custom_metric.rs
+++ b/agent/src/controllers/public/send_custom_metric.rs
@@ -1,38 +1,33 @@
+use super::utils::str2time;
use actix_web::{web, HttpRequest, HttpResponse};
-use chrono::DateTime;
+
use serde::{Deserialize, Serialize};
use crate::{
+ errors::{AgentError, AgentErrorCode},
repository::custom_metric_repository::CustomMetricStoreRequest,
usecase::custom_metric_usecase::CustomMetricUsecase,
};
#[derive(Deserialize, Serialize)]
pub struct MessageContainer {
+ #[serde(default)]
key: String,
value: f32,
+ #[serde(default)]
occurred_at: String,
}
pub async fn handler(
_req: HttpRequest,
web::Json(json): web::Json,
-) -> actix_web::Result {
+) -> actix_web::Result {
if json.key.is_empty() {
- return Ok(HttpResponse::BadRequest().json("key is required"));
+ Err(AgentErrorCode::SendCustomMetricNoKey)?
}
- let occurred_at = match json.occurred_at.parse::() {
- Ok(timestamp) => match DateTime::from_timestamp(timestamp, 0) {
- Some(dt) => dt,
- _ => {
- return Ok(HttpResponse::BadRequest().json("occurred_at is invalid format"));
- }
- },
- Err(_) => {
- return Ok(HttpResponse::BadRequest().json("occurred_at is invalid format"));
- }
- };
+ let occurred_at =
+ str2time(&json.occurred_at).ok_or(AgentErrorCode::SendCustomMetricInvalidOccurredAt)?;
let usecase = CustomMetricUsecase::new();
match usecase
@@ -49,7 +44,7 @@ pub async fn handler(
}
Err(e) => {
log::error!("{:?}", e);
- Ok(HttpResponse::InternalServerError().json("internal server error"))
+ Err(AgentErrorCode::SendCustomMetricInternal)?
}
}
}
diff --git a/agent/src/controllers/public/send_event.rs b/agent/src/controllers/public/send_event.rs
index d865da34..af86f703 100644
--- a/agent/src/controllers/public/send_event.rs
+++ b/agent/src/controllers/public/send_event.rs
@@ -1,40 +1,38 @@
use actix_web::{web, HttpRequest, HttpResponse};
-use chrono::DateTime;
+
use serde::{Deserialize, Serialize};
use crate::{
- repository::event_repository::EventStoreRequest, usecase::event_usecase::EventUsecase,
+ errors::{AgentError, AgentErrorCode},
+ repository::event_repository::EventStoreRequest,
+ usecase::event_usecase::EventUsecase,
};
+use super::utils::str2time;
+
#[derive(Deserialize, Serialize)]
pub struct MessageContainer {
+ #[serde(default)]
key: String,
+ #[serde(default)]
detail: String,
+ #[serde(default)]
occurred_at: String,
}
pub async fn handler(
_req: HttpRequest,
web::Json(json): web::Json,
-) -> actix_web::Result {
+) -> actix_web::Result {
if json.key.is_empty() {
- return Ok(HttpResponse::BadRequest().json("key is required"));
+ Err(AgentErrorCode::SendEventNoKey)?
}
if json.detail.is_empty() {
- return Ok(HttpResponse::BadRequest().json("detail is required"));
+ Err(AgentErrorCode::SendEventNoDetail)?
}
- let occurred_at = match json.occurred_at.parse::() {
- Ok(timestamp) => match DateTime::from_timestamp(timestamp, 0) {
- Some(dt) => dt,
- _ => {
- return Ok(HttpResponse::BadRequest().json("occurred_at is invalid format"));
- }
- },
- Err(_) => {
- return Ok(HttpResponse::BadRequest().json("occurred_at is invalid format"));
- }
- };
+ let occurred_at =
+ str2time(&json.occurred_at).ok_or(AgentErrorCode::SendEventInvalidOccurredAt)?;
let usecase = EventUsecase::new();
match usecase
@@ -51,7 +49,7 @@ pub async fn handler(
}
Err(e) => {
log::error!("{:?}", e);
- Ok(HttpResponse::InternalServerError().json("internal server error"))
+ Err(AgentErrorCode::SendEventInternal)?
}
}
}
diff --git a/agent/src/controllers/public/utils.rs b/agent/src/controllers/public/utils.rs
index 69e5894f..67f96ddb 100644
--- a/agent/src/controllers/public/utils.rs
+++ b/agent/src/controllers/public/utils.rs
@@ -1,8 +1,9 @@
-use actix_web::HttpResponse;
use anyhow::Context as _;
+use chrono::{DateTime, Utc};
use protocol::did::did_repository::DidRepositoryImpl;
+use crate::errors::{AgentError, AgentErrorCode};
use crate::nodex::utils::sidetree_client::SideTreeClient;
use crate::repository::message_activity_repository::MessageActivityHttpError;
use crate::server_config;
@@ -15,28 +16,33 @@ pub fn did_repository() -> DidRepositoryImpl {
DidRepositoryImpl::new(sidetree_client)
}
-pub fn handle_status(e: MessageActivityHttpError) -> HttpResponse {
+pub fn handle_status(e: MessageActivityHttpError) -> AgentError {
match e {
MessageActivityHttpError::BadRequest(message) => {
log::warn!("Bad Request: {}", message);
- HttpResponse::BadRequest().body(message)
- }
- MessageActivityHttpError::Unauthorized(message) => {
- log::warn!("Unauthorized: {}", message);
- HttpResponse::Unauthorized().body(message)
+ AgentErrorCode::MessageActivityBadRequest.into()
}
MessageActivityHttpError::Forbidden(message) => {
log::warn!("Forbidden: {}", message);
- HttpResponse::Forbidden().body(message)
+ AgentErrorCode::MessageActivityForbidden.into()
+ }
+ MessageActivityHttpError::Unauthorized(message) => {
+ log::warn!("Unauthorized: {}", message);
+ AgentErrorCode::MessageActivityUnauthorized.into()
}
MessageActivityHttpError::NotFound(message) => {
log::warn!("Not Found: {}", message);
- HttpResponse::NotFound().body(message)
+ AgentErrorCode::MessageActivityNotFound.into()
}
MessageActivityHttpError::Conflict(message) => {
log::warn!("Conflict: {}", message);
- HttpResponse::Conflict().body(message)
+ AgentErrorCode::MessageActivityConflict.into()
}
- _ => HttpResponse::InternalServerError().finish(),
+ _ => AgentErrorCode::MessageActivityInternal.into(),
}
}
+
+pub fn str2time(value: &str) -> Option> {
+ let timestamp = value.parse::().ok()?;
+ DateTime::from_timestamp(timestamp, 0)
+}
diff --git a/agent/src/errors.rs b/agent/src/errors.rs
new file mode 100644
index 00000000..ff9823f5
--- /dev/null
+++ b/agent/src/errors.rs
@@ -0,0 +1,170 @@
+use actix_web::HttpResponse;
+use actix_web::{error, http::StatusCode};
+use serde::Serialize;
+use std::convert::From;
+use thiserror::Error;
+
+#[derive(Serialize, Clone, Copy, Debug, Error)]
+pub enum AgentErrorCode {
+ #[error("binary_url is required")]
+ VersionNoBinaryUrl = 1001,
+ #[error("path is required")]
+ VersionNoPath = 1002,
+ #[error("destination_did is required")]
+ CreateDidCommMessageNoDestinationDid = 1003,
+ #[error("message is required")]
+ CreateDidCommMessageNoMessage = 1004,
+ #[error("operation_tag is required")]
+ CreateDidCommMessageNoOperationTag = 1005,
+ #[error("cannot find public key")]
+ CreateDidCommMessageNoPubKey = 1006,
+ #[error("destination_did is required")]
+ CreateVerifiableMessageNoDestinationDid = 1007,
+ #[error("message is required")]
+ CreateVerifiableMessageNoMessage = 1008,
+ #[error("operation_tag is required")]
+ CreateVerifiableMessageNoOperationTag = 1009,
+ #[error("sender not found")]
+ VerifyDidcommMessageNoSender = 1010,
+ #[error("public key not found")]
+ VerifyDidcommMessageNoPublicKey = 1011,
+ #[error("metadata not found")]
+ VerifyDidcommMessageNoMetadata = 1012,
+ #[error("json error")]
+ VerifyDidcommMessageJsonError = 1013,
+ #[error("public key not found")]
+ VerifyVerifiableMessageNoPublicKey = 1014,
+ #[error("json error")]
+ VerifyVerifiableMessageJsonError = 1015,
+ #[error("key_name is required")]
+ SendAttributeNoKeyName = 1016,
+ #[error("value is required")]
+ SendAttributeNoValue = 1017,
+ #[error("key is required")]
+ SendCustomMetricNoKey = 1018,
+ #[error("occurred_at is invalid format")]
+ SendCustomMetricInvalidOccurredAt = 1019,
+ #[error("key is invalid")]
+ SendEventNoKey = 1020,
+ #[error("detail is invalid")]
+ SendEventNoDetail = 1021,
+ #[error("occurred_at is invalid format")]
+ SendEventInvalidOccurredAt = 1022,
+ #[error("Bad Request")]
+ MessageActivityBadRequest = 1023,
+
+ #[error("this message is not addressed to me")]
+ VerifyDidcommMessageNotAddressedToMe = 2001,
+ #[error("this message is not addressed to me")]
+ VerifyVerifiableMessageNotAddressedToMe = 2002,
+ #[error("Forbidden")]
+ MessageActivityForbidden = 2003,
+
+ #[error("verify failed")]
+ CreateDidCommMessageVerifyFailed = 3001,
+ #[error("verify failed")]
+ VerifyDidcommMessageVerifyFailed = 3002,
+ #[error("verify failed")]
+ VerifyVerifiableMessageVerifyFailed = 3003,
+ #[error("Unauthorized")]
+ MessageActivityUnauthorized = 3004,
+
+ #[error("target DID not found")]
+ CreateDidCommMessageNoDid = 4001,
+ #[error("target DID not found")]
+ CreateVerifiableMessageNoTargetDid = 4002,
+ #[error("target DID not found")]
+ VerifyDidcommMessageNoTargetDid = 4003,
+ #[error("identifier not found")]
+ VerifyVerifiableMessageNoIdentifier = 4004,
+ #[error("target DID not found")]
+ VerifyVerifiableMessageNoTargetDid = 4005,
+ #[error("Not Found")]
+ MessageActivityNotFound = 4006,
+
+ #[error("Internal Server Error")]
+ NetworkInternal = 5001,
+ #[error("Internal Server Error")]
+ VersionInternal = 5002,
+ #[error("Internal Server Error")]
+ CreateDidcommMessageInternal = 5003,
+ #[error("Internal Server Error")]
+ CreateIdentifierInternal = 5004,
+ #[error("Internal Server Error")]
+ CreateVerifiableMessageInternal = 5005,
+ #[error("Internal Server Error")]
+ FindIdentifierInternal = 5006,
+ #[error("Internal Server Error")]
+ VerifyDidcommMessageInternal = 5007,
+ #[error("Internal Server Error")]
+ VerifyVerifiableMessageInternal = 5008,
+ #[error("Internal Server Error")]
+ SendAttributeInternal = 5009,
+ #[error("Internal Server Error")]
+ SendCustomMetricInternal = 5010,
+ #[error("Internal Server Error")]
+ SendEventInternal = 5011,
+ #[error("Internal Server Error")]
+ MessageActivityInternal = 5012,
+
+ #[error("it have already been verified")]
+ MessageActivityConflict = 6001,
+}
+
+#[derive(Serialize, Debug)]
+pub struct AgentError {
+ code: u16,
+ message: String,
+}
+
+impl std::fmt::Display for AgentError {
+ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
+ write!(f, "code: {}, message: {}", self.code, self.message)
+ }
+}
+
+impl AgentError {
+ pub fn new(code: AgentErrorCode) -> Self {
+ Self {
+ code: code as u16,
+ message: format!("{}", code),
+ }
+ }
+}
+impl From<&AgentError> for HttpResponse {
+ fn from(error: &AgentError) -> Self {
+ let code = error.code;
+ if (1000..2000).contains(&code) {
+ HttpResponse::BadRequest().json(error)
+ } else if (2000..3000).contains(&code) {
+ HttpResponse::Forbidden().json(error)
+ } else if (3000..4000).contains(&code) {
+ HttpResponse::Unauthorized().json(error)
+ } else if (4000..5000).contains(&code) {
+ HttpResponse::NotFound().json(error)
+ } else if (5000..6000).contains(&code) {
+ HttpResponse::InternalServerError().json(error)
+ } else if (6000..6100).contains(&code) {
+ HttpResponse::Conflict().json(error)
+ } else {
+ HttpResponse::InternalServerError().json(error)
+ }
+ }
+}
+
+impl From for AgentError {
+ fn from(code: AgentErrorCode) -> Self {
+ AgentError::new(code)
+ }
+}
+
+impl error::ResponseError for AgentError {
+ fn error_response(&self) -> HttpResponse {
+ self.into()
+ }
+
+ fn status_code(&self) -> StatusCode {
+ let res: HttpResponse = self.into();
+ res.status()
+ }
+}
diff --git a/agent/src/lib.rs b/agent/src/lib.rs
index f325f378..c0266cb7 100644
--- a/agent/src/lib.rs
+++ b/agent/src/lib.rs
@@ -32,6 +32,7 @@ use usecase::metric_usecase::MetricUsecase;
pub mod cli;
mod config;
mod controllers;
+mod errors;
mod handlers;
mod network;
mod nodex;
diff --git a/agent/src/server.rs b/agent/src/server.rs
index 3e09f88d..83b723c1 100644
--- a/agent/src/server.rs
+++ b/agent/src/server.rs
@@ -91,7 +91,7 @@ fn config_app(
)
.route(
"/attributes",
- web::post().to(controllers::public::send_attributes::handler),
+ web::post().to(controllers::public::send_attribute::handler),
)
// NOTE: Internal (Private) Routes
.service(
diff --git a/examples/python/src/sock.py b/examples/python/src/sock.py
index 90790474..0af70445 100644
--- a/examples/python/src/sock.py
+++ b/examples/python/src/sock.py
@@ -2,6 +2,7 @@
import requests_unixsocket
import json
import urllib.parse
+import sys
# Create a session that can make requests to Unix sockets
@@ -9,7 +10,11 @@
default_path = os.path.join(os.path.expanduser("~"), ".nodex/run/nodex.sock")
path_by_installed_deb = "/home/nodex/.nodex/run/nodex.sock"
-sock_path = path_by_installed_deb if os.path.exists(path_by_installed_deb) else default_path
+sock_path = (
+ path_by_installed_deb
+ if os.path.exists(path_by_installed_deb)
+ else default_path
+)
# Construct the base URL using the Unix socket path
base = f'http+unix://{urllib.parse.quote(sock_path, safe="")}'
@@ -21,25 +26,24 @@ def call(method, path, payload):
print(f"- Method: {method.upper()}")
print(f"- URL: {urllib.parse.unquote(url)}\n")
- try:
- if method == "get":
- response = session.get(url)
- elif method == "post":
- response = session.post(url, json=payload)
- else:
- raise ValueError(f"Unsupported method: {method}")
-
- # Raises stored HTTPError, if one occurred.
- response.raise_for_status()
- if response.status_code == 204:
- return "No content"
- return json.dumps(response.json(), indent=4)
- except Exception as e:
- return (
- f"{e.response.status_code} "
- f"{e.response.reason} "
- f"{e.response.text}"
+ if method == "get":
+ response = session.get(url)
+ elif method == "post":
+ response = session.post(url, json=payload)
+ else:
+ raise ValueError(f"Unsupported method: {method}")
+
+ if response.status_code != 200 and response.status_code != 204:
+ print(
+ f"{response.status_code} {response.reason}\n"
+ f"body : {json.dumps(response.json(), indent=4)}"
)
+ sys.exit(1)
+
+ elif response.status_code == 204:
+ return "No content"
+ else:
+ return json.dumps(response.json(), indent=4)
def get(path):
diff --git a/protocol/Cargo.toml b/protocol/Cargo.toml
index 96b0d39b..df121221 100644
--- a/protocol/Cargo.toml
+++ b/protocol/Cargo.toml
@@ -2,7 +2,7 @@
authors = { workspace = true }
edition = { workspace = true }
name = "protocol"
-version = "0.3.0"
+version = "0.2.0"
[dependencies]
chrono = { workspace = true }