@7h3/protocol 0.1.2 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (276) hide show
  1. package/.dockerignore +19 -0
  2. package/.github/dependabot.yml +32 -0
  3. package/.github/workflows/ci.yml +31 -0
  4. package/.github/workflows/publish.yml +59 -0
  5. package/.github/workflows/scorecard.yml +37 -0
  6. package/7h3.example.yaml +125 -0
  7. package/CHANGELOG.md +152 -0
  8. package/CONTRIBUTING.md +82 -0
  9. package/Dockerfile +73 -0
  10. package/GOVERNANCE.md +62 -0
  11. package/README.md +1317 -6
  12. package/SECURITY.md +70 -0
  13. package/bench-results/replay-cache-full-1777891033256.json +10 -0
  14. package/bench-results/replay-cache-full-1777896317488.json +10 -0
  15. package/bench-results/replay-cache-full-1777900993184.json +10 -0
  16. package/bench-results/replay-cache-full-1777901019285.json +10 -0
  17. package/bench-results/replay-cache-quick-1777870170126.json +10 -0
  18. package/bench-results/signature-profiles-quick-1775875160079.json +85 -0
  19. package/bench-results/signature-profiles-quick-1775983539716.json +85 -0
  20. package/bench-results/signature-profiles-quick-1776237913190.json +85 -0
  21. package/bench-results/wire-codecs-full-1777891019803.json +93 -0
  22. package/bench-results/wire-codecs-full-1777896260964.json +93 -0
  23. package/bench-results/wire-codecs-full-1777901004247.json +93 -0
  24. package/bench-results/wire-codecs-quick-1775972879056.json +93 -0
  25. package/bench-results/wire-codecs-quick-1775983541111.json +93 -0
  26. package/bench-results/wire-codecs-quick-1776237914299.json +93 -0
  27. package/bench-results/wire-codecs-quick-1777841285236.json +93 -0
  28. package/bench-results/wire-codecs-quick-1777841321772.json +93 -0
  29. package/bench-results/wire-codecs-quick-1777841330408.json +93 -0
  30. package/bench-results/wire-codecs-quick-1777852886082.json +93 -0
  31. package/bench-results/wire-codecs-quick-1777852988773.json +93 -0
  32. package/bench-results/wire-codecs-quick-1777870188095.json +93 -0
  33. package/bench-results/wire-codecs-quick-1777870263918.json +93 -0
  34. package/bench-results/wire-codecs-quick-1777870455034.json +93 -0
  35. package/bench-results/wire-codecs-quick-1778816163081.json +93 -0
  36. package/bench-results/wire-codecs-quick-1778843936130.json +93 -0
  37. package/bin/7h3.ts +406 -0
  38. package/conformance/7h3_v0_1.json +77 -0
  39. package/conformance/7h3_v0_1_binary.json +20 -0
  40. package/conformance/aip_v0_1_binary.json +20 -0
  41. package/docker-compose.yaml +77 -0
  42. package/docs/ADOPTION_PLAN.md +120 -0
  43. package/docs/AGENTS.md +77 -0
  44. package/docs/AIP_RFC_v0.1.md +97 -0
  45. package/docs/AI_DECISION_CARD.md +122 -0
  46. package/docs/AI_RUNTIME_POLICY.json +126 -0
  47. package/docs/AI_RUNTIME_POLICY.yaml +110 -0
  48. package/docs/BACKPRESSURE_TUNING.md +65 -0
  49. package/docs/BENCHMARK_CLAIM_MATRIX.md +42 -0
  50. package/docs/BENCHMARK_REPORT_TEMPLATE.md +169 -0
  51. package/docs/BINARY_CODEC_BENCH.md +23 -0
  52. package/docs/CLEAN_CLONE_RUNBOOK.md +36 -0
  53. package/docs/CLOCK_SKEW_POLICY.md +30 -0
  54. package/docs/DISTRIBUTED_REPLAY.md +142 -0
  55. package/docs/FUZZ_CAMPAIGN.md +121 -0
  56. package/docs/GATEWAY.md +195 -0
  57. package/docs/KEY_MANAGEMENT_POLICY.md +53 -0
  58. package/docs/KEY_REVOCATION.md +69 -0
  59. package/docs/MCP_WRAPPER.md +159 -0
  60. package/docs/MIGRATION_GUIDE.md +40 -0
  61. package/docs/OPERATORS.md +184 -0
  62. package/docs/PERF_REGRESSION_POLICY.md +34 -0
  63. package/docs/PROJECT_EXAMINATION_2026-05-31.md +219 -0
  64. package/docs/RELEASE_BENCHMARK_REPORT_2026-05-15.md +135 -0
  65. package/docs/RELEASE_GATE.md +25 -0
  66. package/docs/RELEASE_NOTES_v0.1.0.md +54 -0
  67. package/docs/SECURITY_REVIEW_2026-06-05.md +165 -0
  68. package/docs/TELEMETRY.md +41 -0
  69. package/docs/THREAT_MODEL.md +89 -0
  70. package/docs/VERSIONING_POLICY.md +30 -0
  71. package/docs/assets/banner-github.png +0 -0
  72. package/docs/assets/banner.png +0 -0
  73. package/docs/assets/banner.svg +123 -0
  74. package/eslint.config.js +15 -0
  75. package/fuzz/ts/harness-decode.ts +136 -0
  76. package/fuzz/ts/harness-verify.ts +121 -0
  77. package/fuzz/ts/run.ts +35 -0
  78. package/mcp-server/README.md +38 -0
  79. package/mcp-server/package-lock.json +1187 -0
  80. package/mcp-server/package.json +35 -0
  81. package/mcp-server/src/index.ts +236 -0
  82. package/mcp-server/tsconfig.json +14 -0
  83. package/package.json +121 -13
  84. package/scripts/aip-framework-quickstart.ts +110 -0
  85. package/scripts/aip-mcp-gateway.ts +38 -0
  86. package/scripts/aip-mcp-wrap-demo.ts +72 -0
  87. package/scripts/aip-quickstart.ts +60 -0
  88. package/scripts/bench-diff.ts +118 -0
  89. package/scripts/bench-protocol-e2e.ts +937 -0
  90. package/scripts/bench-protocol-openloop.ts +1397 -0
  91. package/scripts/bench-replay-cache.ts +76 -0
  92. package/scripts/bench-signature-profiles.ts +180 -0
  93. package/scripts/bench-wire-codecs.ts +161 -0
  94. package/scripts/build-binary-conformance.ts +36 -0
  95. package/scripts/build-release-dashboard.ts +175 -0
  96. package/scripts/canary-rollout.ts +38 -0
  97. package/scripts/mcpGatewayCli.test.ts +116 -0
  98. package/scripts/prepare-aip-package.ts +88 -0
  99. package/scripts/regen-conformance-sigs.ts +18 -0
  100. package/scripts/release-gate.ts +19 -0
  101. package/scripts/validate-runtime-policy.ts +18 -0
  102. package/sdk/browser/index.test.ts +162 -0
  103. package/sdk/browser/index.ts +257 -0
  104. package/sdk/browser/package.json +13 -0
  105. package/sdk/go/cbor.go +551 -0
  106. package/sdk/go/cbor_test.go +232 -0
  107. package/sdk/go/encryption.go +280 -0
  108. package/sdk/go/encryption_test.go +318 -0
  109. package/sdk/go/go.mod +7 -0
  110. package/sdk/go/go.sum +4 -0
  111. package/sdk/go/http.go +135 -0
  112. package/sdk/go/protocol.go +324 -0
  113. package/sdk/go/protocol_test.go +334 -0
  114. package/sdk/go/replay.go +121 -0
  115. package/sdk/go/replay_test.go +149 -0
  116. package/sdk/go/webhook.go +136 -0
  117. package/sdk/pq/package-lock.json +1358 -0
  118. package/sdk/pq/package.json +42 -0
  119. package/sdk/pq/src/index.test.ts +143 -0
  120. package/sdk/pq/src/index.ts +166 -0
  121. package/sdk/pq/tsconfig.json +14 -0
  122. package/sdk/pq/vitest.config.ts +7 -0
  123. package/sdk/python/README.md +18 -0
  124. package/sdk/python/protocol_7h3/__init__.py +46 -0
  125. package/sdk/python/protocol_7h3/encryption.py +252 -0
  126. package/sdk/python/protocol_7h3/http.py +212 -0
  127. package/sdk/python/protocol_7h3/keys.py +149 -0
  128. package/sdk/python/protocol_7h3/pq.py +244 -0
  129. package/sdk/python/protocol_7h3/protocol.py +525 -0
  130. package/sdk/python/protocol_7h3/queue.py +118 -0
  131. package/sdk/python/protocol_7h3/replay.py +98 -0
  132. package/sdk/python/protocol_7h3/webhook.py +116 -0
  133. package/sdk/python/pyproject.toml +40 -0
  134. package/sdk/python/tests/test_conformance.py +110 -0
  135. package/sdk/python/tests/test_encryption.py +206 -0
  136. package/sdk/python/tests/test_http.py +305 -0
  137. package/sdk/python/tests/test_keys.py +417 -0
  138. package/sdk/python/tests/test_queue.py +120 -0
  139. package/sdk/python/tests/test_webhook.py +345 -0
  140. package/sdk/rust/Cargo.lock +371 -0
  141. package/sdk/rust/Cargo.toml +25 -0
  142. package/sdk/rust/README.md +31 -0
  143. package/sdk/rust/fuzz/Cargo.toml +29 -0
  144. package/sdk/rust/fuzz/fuzz_targets/fuzz_canonicalize.rs +46 -0
  145. package/sdk/rust/fuzz/fuzz_targets/fuzz_decode.rs +11 -0
  146. package/sdk/rust/src/bin/aip_mcp_gateway.rs +59 -0
  147. package/sdk/rust/src/http.rs +145 -0
  148. package/sdk/rust/src/keys.rs +161 -0
  149. package/sdk/rust/src/lib.rs +688 -0
  150. package/sdk/rust/src/queue.rs +79 -0
  151. package/sdk/rust/src/webhook.rs +86 -0
  152. package/sdk/rust/tests/conformance.rs +148 -0
  153. package/sdk/rust/tests/gateway.rs +130 -0
  154. package/sdk/rust/tests/http_webhook_queue.rs +201 -0
  155. package/sdk/rust/tests/keys.rs +189 -0
  156. package/sdk/threshold/index.d.ts +68 -0
  157. package/sdk/threshold/index.d.ts.map +1 -0
  158. package/sdk/threshold/index.js +254 -0
  159. package/sdk/threshold/package-lock.json +1361 -0
  160. package/sdk/threshold/package.json +39 -0
  161. package/sdk/threshold/src/index.d.ts +68 -0
  162. package/sdk/threshold/src/index.d.ts.map +1 -0
  163. package/sdk/threshold/src/index.js +254 -0
  164. package/sdk/threshold/src/index.test.ts +238 -0
  165. package/sdk/threshold/src/index.ts +355 -0
  166. package/sdk/threshold/tsconfig.json +19 -0
  167. package/sdk/threshold/vitest.config.ts +12 -0
  168. package/src/agentAdapter.test.ts +48 -0
  169. package/src/agentAdapter.ts +56 -0
  170. package/src/auditLog.test.ts +145 -0
  171. package/src/auditLog.ts +147 -0
  172. package/src/capability.test.ts +504 -0
  173. package/src/capability.ts +380 -0
  174. package/src/cborCodec.test.ts +263 -0
  175. package/src/cborCodec.ts +339 -0
  176. package/src/conformance.test.ts +136 -0
  177. package/src/conformanceVectors.ts +99 -0
  178. package/src/encryption.test.ts +206 -0
  179. package/src/encryption.ts +245 -0
  180. package/src/envelopeCbor.ts +140 -0
  181. package/src/frameworkAdapters.test.ts +290 -0
  182. package/src/frameworkAdapters.ts +261 -0
  183. package/src/gateway.test.ts +343 -0
  184. package/src/gateway.ts +246 -0
  185. package/src/grpcBinding.test.ts +211 -0
  186. package/src/grpcBinding.ts +103 -0
  187. package/src/httpBinding.test.ts +376 -0
  188. package/src/httpBinding.ts +189 -0
  189. package/src/index.ts +39 -0
  190. package/src/keyInfra.test.ts +278 -0
  191. package/src/keyInfra.ts +228 -0
  192. package/src/keyRegistry.ts +59 -0
  193. package/src/keyRotation.test.ts +78 -0
  194. package/src/keyRotation.ts +72 -0
  195. package/src/mcpGateway.test.ts +129 -0
  196. package/src/mcpGateway.ts +250 -0
  197. package/src/mcpTransports.test.ts +92 -0
  198. package/src/mcpTransports.ts +169 -0
  199. package/src/mcpWrapper.test.ts +179 -0
  200. package/src/mcpWrapper.ts +206 -0
  201. package/src/otel.ts +136 -0
  202. package/src/policyEnforcer.test.ts +99 -0
  203. package/src/policyEnforcer.ts +169 -0
  204. package/src/policyTelemetryFeedback.test.ts +25 -0
  205. package/src/policyTelemetryFeedback.ts +38 -0
  206. package/src/protocol.bench.ts +37 -0
  207. package/{protocol.d.ts → src/protocol.d.ts} +2 -1
  208. package/src/protocol.d.ts.map +1 -0
  209. package/src/protocol.js +294 -0
  210. package/src/protocol.test.ts +155 -0
  211. package/src/protocol.ts +414 -0
  212. package/src/protocolAgent.test.ts +105 -0
  213. package/src/protocolAgent.ts +169 -0
  214. package/src/protocolBinary.test.ts +165 -0
  215. package/src/protocolBinary.ts +312 -0
  216. package/src/protocolCapabilities.ts +70 -0
  217. package/src/protocolFuzz.advanced.test.ts +235 -0
  218. package/src/protocolFuzz.test.ts +111 -0
  219. package/src/protocolNegative.test.ts +97 -0
  220. package/src/protocolReplay.test.ts +71 -0
  221. package/src/protocolReplay.ts +194 -0
  222. package/src/protocolTransport.test.ts +556 -0
  223. package/src/protocolTransport.ts +483 -0
  224. package/src/queueBinding.test.ts +130 -0
  225. package/src/queueBinding.ts +102 -0
  226. package/src/rateLimiter.test.ts +96 -0
  227. package/src/rateLimiter.ts +46 -0
  228. package/src/redisClient.ts +140 -0
  229. package/src/redisIntegration.test.ts +134 -0
  230. package/src/replayStores.test.ts +273 -0
  231. package/src/replayStores.ts +215 -0
  232. package/src/revocation.test.ts +98 -0
  233. package/src/revocation.ts +0 -0
  234. package/src/routePolicy.test.ts +87 -0
  235. package/src/routePolicy.ts +72 -0
  236. package/src/runtimePolicy.test.ts +49 -0
  237. package/src/runtimePolicy.ts +81 -0
  238. package/src/runtimePolicyManager.test.ts +29 -0
  239. package/src/runtimePolicyManager.ts +50 -0
  240. package/src/runtimePolicyPresets.ts +43 -0
  241. package/src/signedResponse.test.ts +111 -0
  242. package/src/signedResponse.ts +83 -0
  243. package/src/stream.test.ts +254 -0
  244. package/src/stream.ts +417 -0
  245. package/src/telemetry.test.ts +251 -0
  246. package/src/telemetry.ts +299 -0
  247. package/src/webhookBinding.test.ts +144 -0
  248. package/src/webhookBinding.ts +115 -0
  249. package/src/wsBinding.test.ts +221 -0
  250. package/src/wsBinding.ts +200 -0
  251. package/tsconfig.json +15 -0
  252. package/tsconfig.lib.json +23 -0
  253. package/vite.lib.config.ts +16 -0
  254. package/vitest.config.ts +11 -0
  255. package/agentAdapter.d.ts +0 -26
  256. package/conformanceVectors.d.ts +0 -20
  257. package/frameworkAdapters.d.ts +0 -72
  258. package/index.d.ts +0 -20
  259. package/index.js +0 -1702
  260. package/keyRotation.d.ts +0 -20
  261. package/mcpGateway.d.ts +0 -37
  262. package/mcpTransports.d.ts +0 -62
  263. package/mcpWrapper.d.ts +0 -83
  264. package/policyEnforcer.d.ts +0 -50
  265. package/policyTelemetryFeedback.d.ts +0 -11
  266. package/protocolAgent.d.ts +0 -58
  267. package/protocolBinary.d.ts +0 -8
  268. package/protocolCapabilities.d.ts +0 -24
  269. package/protocolReplay.d.ts +0 -35
  270. package/protocolTransport.d.ts +0 -73
  271. package/redisClient.d.ts +0 -49
  272. package/replayStores.d.ts +0 -32
  273. package/revocation.d.ts +0 -71
  274. package/runtimePolicy.d.ts +0 -24
  275. package/runtimePolicyManager.d.ts +0 -15
  276. package/runtimePolicyPresets.d.ts +0 -11
@@ -0,0 +1,371 @@
1
+ # This file is automatically @generated by Cargo.
2
+ # It is not intended for manual editing.
3
+ version = 4
4
+
5
+ [[package]]
6
+ name = "base64"
7
+ version = "0.22.1"
8
+ source = "registry+https://github.com/rust-lang/crates.io-index"
9
+ checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
10
+
11
+ [[package]]
12
+ name = "base64ct"
13
+ version = "1.8.3"
14
+ source = "registry+https://github.com/rust-lang/crates.io-index"
15
+ checksum = "2af50177e190e07a26ab74f8b1efbfe2ef87da2116221318cb1c2e82baf7de06"
16
+
17
+ [[package]]
18
+ name = "block-buffer"
19
+ version = "0.10.4"
20
+ source = "registry+https://github.com/rust-lang/crates.io-index"
21
+ checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71"
22
+ dependencies = [
23
+ "generic-array",
24
+ ]
25
+
26
+ [[package]]
27
+ name = "cfg-if"
28
+ version = "1.0.4"
29
+ source = "registry+https://github.com/rust-lang/crates.io-index"
30
+ checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
31
+
32
+ [[package]]
33
+ name = "const-oid"
34
+ version = "0.9.6"
35
+ source = "registry+https://github.com/rust-lang/crates.io-index"
36
+ checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8"
37
+
38
+ [[package]]
39
+ name = "cpufeatures"
40
+ version = "0.2.17"
41
+ source = "registry+https://github.com/rust-lang/crates.io-index"
42
+ checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280"
43
+ dependencies = [
44
+ "libc",
45
+ ]
46
+
47
+ [[package]]
48
+ name = "crypto-common"
49
+ version = "0.1.7"
50
+ source = "registry+https://github.com/rust-lang/crates.io-index"
51
+ checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a"
52
+ dependencies = [
53
+ "generic-array",
54
+ "typenum",
55
+ ]
56
+
57
+ [[package]]
58
+ name = "curve25519-dalek"
59
+ version = "4.1.3"
60
+ source = "registry+https://github.com/rust-lang/crates.io-index"
61
+ checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be"
62
+ dependencies = [
63
+ "cfg-if",
64
+ "cpufeatures",
65
+ "curve25519-dalek-derive",
66
+ "digest",
67
+ "fiat-crypto",
68
+ "rustc_version",
69
+ "subtle",
70
+ "zeroize",
71
+ ]
72
+
73
+ [[package]]
74
+ name = "curve25519-dalek-derive"
75
+ version = "0.1.1"
76
+ source = "registry+https://github.com/rust-lang/crates.io-index"
77
+ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3"
78
+ dependencies = [
79
+ "proc-macro2",
80
+ "quote",
81
+ "syn",
82
+ ]
83
+
84
+ [[package]]
85
+ name = "der"
86
+ version = "0.7.10"
87
+ source = "registry+https://github.com/rust-lang/crates.io-index"
88
+ checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb"
89
+ dependencies = [
90
+ "const-oid",
91
+ "zeroize",
92
+ ]
93
+
94
+ [[package]]
95
+ name = "digest"
96
+ version = "0.10.7"
97
+ source = "registry+https://github.com/rust-lang/crates.io-index"
98
+ checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
99
+ dependencies = [
100
+ "block-buffer",
101
+ "crypto-common",
102
+ "subtle",
103
+ ]
104
+
105
+ [[package]]
106
+ name = "ed25519"
107
+ version = "2.2.3"
108
+ source = "registry+https://github.com/rust-lang/crates.io-index"
109
+ checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53"
110
+ dependencies = [
111
+ "pkcs8",
112
+ "signature",
113
+ ]
114
+
115
+ [[package]]
116
+ name = "ed25519-dalek"
117
+ version = "2.2.0"
118
+ source = "registry+https://github.com/rust-lang/crates.io-index"
119
+ checksum = "70e796c081cee67dc755e1a36a0a172b897fab85fc3f6bc48307991f64e4eca9"
120
+ dependencies = [
121
+ "curve25519-dalek",
122
+ "ed25519",
123
+ "serde",
124
+ "sha2",
125
+ "subtle",
126
+ "zeroize",
127
+ ]
128
+
129
+ [[package]]
130
+ name = "fiat-crypto"
131
+ version = "0.2.9"
132
+ source = "registry+https://github.com/rust-lang/crates.io-index"
133
+ checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d"
134
+
135
+ [[package]]
136
+ name = "generic-array"
137
+ version = "0.14.7"
138
+ source = "registry+https://github.com/rust-lang/crates.io-index"
139
+ checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a"
140
+ dependencies = [
141
+ "typenum",
142
+ "version_check",
143
+ ]
144
+
145
+ [[package]]
146
+ name = "getrandom"
147
+ version = "0.2.17"
148
+ source = "registry+https://github.com/rust-lang/crates.io-index"
149
+ checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0"
150
+ dependencies = [
151
+ "cfg-if",
152
+ "libc",
153
+ "wasi",
154
+ ]
155
+
156
+ [[package]]
157
+ name = "hmac"
158
+ version = "0.12.1"
159
+ source = "registry+https://github.com/rust-lang/crates.io-index"
160
+ checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e"
161
+ dependencies = [
162
+ "digest",
163
+ ]
164
+
165
+ [[package]]
166
+ name = "itoa"
167
+ version = "1.0.18"
168
+ source = "registry+https://github.com/rust-lang/crates.io-index"
169
+ checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682"
170
+
171
+ [[package]]
172
+ name = "libc"
173
+ version = "0.2.186"
174
+ source = "registry+https://github.com/rust-lang/crates.io-index"
175
+ checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66"
176
+
177
+ [[package]]
178
+ name = "memchr"
179
+ version = "2.8.1"
180
+ source = "registry+https://github.com/rust-lang/crates.io-index"
181
+ checksum = "6b947ae49db0d222b1dbc6b113ce7248a3fc3a6ca21b696717bfc000ba4484d8"
182
+
183
+ [[package]]
184
+ name = "pkcs8"
185
+ version = "0.10.2"
186
+ source = "registry+https://github.com/rust-lang/crates.io-index"
187
+ checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7"
188
+ dependencies = [
189
+ "der",
190
+ "spki",
191
+ ]
192
+
193
+ [[package]]
194
+ name = "proc-macro2"
195
+ version = "1.0.106"
196
+ source = "registry+https://github.com/rust-lang/crates.io-index"
197
+ checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934"
198
+ dependencies = [
199
+ "unicode-ident",
200
+ ]
201
+
202
+ [[package]]
203
+ name = "protocol-7h3"
204
+ version = "0.5.0"
205
+ dependencies = [
206
+ "base64",
207
+ "ed25519-dalek",
208
+ "hmac",
209
+ "serde",
210
+ "serde_json",
211
+ "sha2",
212
+ ]
213
+
214
+ [[package]]
215
+ name = "quote"
216
+ version = "1.0.45"
217
+ source = "registry+https://github.com/rust-lang/crates.io-index"
218
+ checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924"
219
+ dependencies = [
220
+ "proc-macro2",
221
+ ]
222
+
223
+ [[package]]
224
+ name = "rand_core"
225
+ version = "0.6.4"
226
+ source = "registry+https://github.com/rust-lang/crates.io-index"
227
+ checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
228
+ dependencies = [
229
+ "getrandom",
230
+ ]
231
+
232
+ [[package]]
233
+ name = "rustc_version"
234
+ version = "0.4.1"
235
+ source = "registry+https://github.com/rust-lang/crates.io-index"
236
+ checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92"
237
+ dependencies = [
238
+ "semver",
239
+ ]
240
+
241
+ [[package]]
242
+ name = "semver"
243
+ version = "1.0.28"
244
+ source = "registry+https://github.com/rust-lang/crates.io-index"
245
+ checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd"
246
+
247
+ [[package]]
248
+ name = "serde"
249
+ version = "1.0.228"
250
+ source = "registry+https://github.com/rust-lang/crates.io-index"
251
+ checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e"
252
+ dependencies = [
253
+ "serde_core",
254
+ "serde_derive",
255
+ ]
256
+
257
+ [[package]]
258
+ name = "serde_core"
259
+ version = "1.0.228"
260
+ source = "registry+https://github.com/rust-lang/crates.io-index"
261
+ checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad"
262
+ dependencies = [
263
+ "serde_derive",
264
+ ]
265
+
266
+ [[package]]
267
+ name = "serde_derive"
268
+ version = "1.0.228"
269
+ source = "registry+https://github.com/rust-lang/crates.io-index"
270
+ checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79"
271
+ dependencies = [
272
+ "proc-macro2",
273
+ "quote",
274
+ "syn",
275
+ ]
276
+
277
+ [[package]]
278
+ name = "serde_json"
279
+ version = "1.0.150"
280
+ source = "registry+https://github.com/rust-lang/crates.io-index"
281
+ checksum = "e8014e44b4736ed0538adeecded0fce2a272f22dc9578a7eb6b2d9993c74cfb9"
282
+ dependencies = [
283
+ "itoa",
284
+ "memchr",
285
+ "serde",
286
+ "serde_core",
287
+ "zmij",
288
+ ]
289
+
290
+ [[package]]
291
+ name = "sha2"
292
+ version = "0.10.9"
293
+ source = "registry+https://github.com/rust-lang/crates.io-index"
294
+ checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283"
295
+ dependencies = [
296
+ "cfg-if",
297
+ "cpufeatures",
298
+ "digest",
299
+ ]
300
+
301
+ [[package]]
302
+ name = "signature"
303
+ version = "2.2.0"
304
+ source = "registry+https://github.com/rust-lang/crates.io-index"
305
+ checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de"
306
+ dependencies = [
307
+ "rand_core",
308
+ ]
309
+
310
+ [[package]]
311
+ name = "spki"
312
+ version = "0.7.3"
313
+ source = "registry+https://github.com/rust-lang/crates.io-index"
314
+ checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d"
315
+ dependencies = [
316
+ "base64ct",
317
+ "der",
318
+ ]
319
+
320
+ [[package]]
321
+ name = "subtle"
322
+ version = "2.6.1"
323
+ source = "registry+https://github.com/rust-lang/crates.io-index"
324
+ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
325
+
326
+ [[package]]
327
+ name = "syn"
328
+ version = "2.0.117"
329
+ source = "registry+https://github.com/rust-lang/crates.io-index"
330
+ checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99"
331
+ dependencies = [
332
+ "proc-macro2",
333
+ "quote",
334
+ "unicode-ident",
335
+ ]
336
+
337
+ [[package]]
338
+ name = "typenum"
339
+ version = "1.20.1"
340
+ source = "registry+https://github.com/rust-lang/crates.io-index"
341
+ checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20"
342
+
343
+ [[package]]
344
+ name = "unicode-ident"
345
+ version = "1.0.24"
346
+ source = "registry+https://github.com/rust-lang/crates.io-index"
347
+ checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
348
+
349
+ [[package]]
350
+ name = "version_check"
351
+ version = "0.9.5"
352
+ source = "registry+https://github.com/rust-lang/crates.io-index"
353
+ checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
354
+
355
+ [[package]]
356
+ name = "wasi"
357
+ version = "0.11.1+wasi-snapshot-preview1"
358
+ source = "registry+https://github.com/rust-lang/crates.io-index"
359
+ checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"
360
+
361
+ [[package]]
362
+ name = "zeroize"
363
+ version = "1.8.2"
364
+ source = "registry+https://github.com/rust-lang/crates.io-index"
365
+ checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0"
366
+
367
+ [[package]]
368
+ name = "zmij"
369
+ version = "1.0.21"
370
+ source = "registry+https://github.com/rust-lang/crates.io-index"
371
+ checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa"
@@ -0,0 +1,25 @@
1
+ [package]
2
+ name = "protocol-7h3"
3
+ version = "0.5.0"
4
+ edition = "2021"
5
+ description = "7h3 Protocol — Rust SDK. Deterministic, signed, replay-safe AI-to-AI messaging with TypeScript/Python parity. Wire version 7h3/0.1."
6
+ license = "MIT"
7
+ repository = "https://github.com/IceMasterT/7h3-protocol-aip"
8
+ homepage = "https://github.com/IceMasterT/7h3-protocol-aip"
9
+ documentation = "https://docs.rs/7h3-protocol"
10
+ keywords = ["7h3", "agent", "protocol", "ed25519", "mcp"]
11
+ categories = ["cryptography", "network-programming", "web-programming::http-server"]
12
+ readme = "README.md"
13
+ include = ["src/**/*", "README.md", "Cargo.toml"]
14
+
15
+ [lib]
16
+ name = "protocol_7h3"
17
+ path = "src/lib.rs"
18
+
19
+ [dependencies]
20
+ base64 = "0.22"
21
+ ed25519-dalek = { version = "2", features = ["pkcs8"] }
22
+ hmac = "0.12"
23
+ serde = { version = "1.0", features = ["derive"] }
24
+ serde_json = "1.0"
25
+ sha2 = "0.10"
@@ -0,0 +1,31 @@
1
+ # 7h3 Protocol AIP Rust SDK
2
+
3
+ Reference `aip/0.1` SDK in Rust (crate `aip7h3`) with shared conformance fixtures.
4
+
5
+ ## Included
6
+
7
+ - deterministic canonicalization matching TypeScript behavior
8
+ - HS256 HMAC signing and verification
9
+ - ED25519 signing and verification
10
+ - compact wire encode/decode
11
+ - envelope validation helpers (version, required fields, TTL)
12
+ - JSON-RPC bridge helpers for TASK/RESULT mapping
13
+ - line-based MCP-style gateway runtime over signed AIP envelopes
14
+ - conformance tests using `conformance/aip_v0_1.json`
15
+
16
+ ## Run tests
17
+
18
+ ```bash
19
+ cargo test --manifest-path sdk/rust/Cargo.toml
20
+ ```
21
+
22
+ ## Run MCP-style gateway CLI
23
+
24
+ ```bash
25
+ cargo run --manifest-path sdk/rust/Cargo.toml --bin aip_mcp_gateway
26
+ ```
27
+
28
+ Optional env vars:
29
+
30
+ - `AIP_SHARED_SECRET` (default `mcp-gateway-secret`)
31
+ - `AIP_ALLOWED_METHODS` (comma-separated allowlist)
@@ -0,0 +1,29 @@
1
+ [package]
2
+ name = "aip7h3-fuzz"
3
+ version = "0.0.0"
4
+ edition = "2021"
5
+ publish = false
6
+
7
+ [package.metadata]
8
+ cargo-fuzz = true
9
+
10
+ [dependencies]
11
+ libfuzzer-sys = "0.4"
12
+
13
+ [dependencies.aip7h3]
14
+ path = ".."
15
+
16
+ # Each fuzz target is a separate binary
17
+ [[bin]]
18
+ name = "fuzz_decode"
19
+ path = "fuzz_targets/fuzz_decode.rs"
20
+ test = false
21
+ doc = false
22
+ bench = false
23
+
24
+ [[bin]]
25
+ name = "fuzz_canonicalize"
26
+ path = "fuzz_targets/fuzz_canonicalize.rs"
27
+ test = false
28
+ doc = false
29
+ bench = false
@@ -0,0 +1,46 @@
1
+ #![no_main]
2
+
3
+ use libfuzzer_sys::fuzz_target;
4
+
5
+ // Invariant: canonicalize_envelope must be pure — calling it twice on the same
6
+ // input must return the same string. We construct minimal envelopes from the
7
+ // fuzz input and verify idempotence.
8
+ fuzz_target!(|data: &[u8]| {
9
+ if data.len() < 4 {
10
+ return;
11
+ }
12
+ // Carve the fuzz bytes into two string fields to avoid heavy JSON parsing
13
+ let mid_len = (data[0] as usize % 32) + 1;
14
+ let content_len = (data[1] as usize % 64).min(data.len().saturating_sub(2 + mid_len));
15
+
16
+ let mid_bytes = &data[2..2 + mid_len.min(data.len().saturating_sub(2))];
17
+ let content_bytes = &data[2 + mid_len..2 + mid_len + content_len.min(
18
+ data.len().saturating_sub(2 + mid_len),
19
+ )];
20
+
21
+ let mid = String::from_utf8_lossy(mid_bytes).to_string();
22
+ let content = String::from_utf8_lossy(content_bytes).to_string();
23
+
24
+ let envelope = protocol_7h3::ProtocolEnvelope {
25
+ header: protocol_7h3::ProtocolHeader {
26
+ version: "7h3/0.1".to_string(),
27
+ message_id: mid,
28
+ timestamp_ms: 1_700_000_000_000,
29
+ ttl_ms: 30_000,
30
+ sender: "fuzzer".to_string(),
31
+ recipient: None,
32
+ nonce: "nonce-fuzz".to_string(),
33
+ },
34
+ body: protocol_7h3::ProtocolBody {
35
+ intent: "PING".to_string(),
36
+ content,
37
+ capability: None,
38
+ correlation_id: None,
39
+ },
40
+ signature: None,
41
+ };
42
+
43
+ let c1 = protocol_7h3::canonicalize_envelope(&envelope);
44
+ let c2 = protocol_7h3::canonicalize_envelope(&envelope);
45
+ assert_eq!(c1, c2, "canonicalize_envelope must be idempotent");
46
+ });
@@ -0,0 +1,11 @@
1
+ #![no_main]
2
+
3
+ use libfuzzer_sys::fuzz_target;
4
+
5
+ // Invariant: decode_envelope must never panic on any UTF-8-valid string input.
6
+ // On garbage/malformed input it must return Err(...), not panic.
7
+ fuzz_target!(|data: &[u8]| {
8
+ if let Ok(s) = std::str::from_utf8(data) {
9
+ let _ = protocol_7h3::decode_envelope(s);
10
+ }
11
+ });
@@ -0,0 +1,59 @@
1
+ use protocol_7h3::{create_aip_mcp_gateway_runtime, AipMcpGatewayOptions};
2
+ use std::io::{self, BufRead, Write};
3
+ use std::time::{SystemTime, UNIX_EPOCH};
4
+
5
+ fn current_time_ms() -> i64 {
6
+ let millis = SystemTime::now()
7
+ .duration_since(UNIX_EPOCH)
8
+ .unwrap_or_default()
9
+ .as_millis();
10
+ i64::try_from(millis).unwrap_or(i64::MAX)
11
+ }
12
+
13
+ fn parse_allowed_methods_from_env() -> Vec<String> {
14
+ std::env::var("AIP_ALLOWED_METHODS")
15
+ .ok()
16
+ .map(|raw| {
17
+ raw.split(',')
18
+ .map(|item| item.trim().to_string())
19
+ .filter(|item| !item.is_empty())
20
+ .collect::<Vec<_>>()
21
+ })
22
+ .filter(|items| !items.is_empty())
23
+ .unwrap_or_else(|| {
24
+ vec![
25
+ "tools/call".to_string(),
26
+ "resources/read".to_string(),
27
+ "prompts/get".to_string(),
28
+ ]
29
+ })
30
+ }
31
+
32
+ fn main() {
33
+ let shared_secret =
34
+ std::env::var("AIP_SHARED_SECRET").unwrap_or_else(|_| "mcp-gateway-secret".to_string());
35
+ let runtime = create_aip_mcp_gateway_runtime(AipMcpGatewayOptions {
36
+ shared_secret,
37
+ allowed_methods: parse_allowed_methods_from_env(),
38
+ ..AipMcpGatewayOptions::default()
39
+ });
40
+
41
+ let stdin = io::stdin();
42
+ let mut stdout = io::stdout();
43
+
44
+ for line_result in stdin.lock().lines() {
45
+ let line = match line_result {
46
+ Ok(value) => value,
47
+ Err(_) => break,
48
+ };
49
+
50
+ if let Some(response) = runtime.handle_line(&line, current_time_ms()) {
51
+ if writeln!(stdout, "{}", response).is_err() {
52
+ break;
53
+ }
54
+ if stdout.flush().is_err() {
55
+ break;
56
+ }
57
+ }
58
+ }
59
+ }