@suveren/gateway 0.40.0 → 0.41.1

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 (301) hide show
  1. package/content/guides/6-risks.md +1 -0
  2. package/dist/control-plane/index.mjs +182 -37
  3. package/dist/mcp-server/http.mjs +357 -71
  4. package/dist/ui/assets/{index-C-lA_7Lt.js → index-CO-dj98E.js} +27 -27
  5. package/dist/ui/index.html +1 -1
  6. package/node_modules/@hap/core/README.md +3 -3
  7. package/node_modules/@hap/core/dist/index.d.mts +567 -123
  8. package/node_modules/@hap/core/dist/index.d.ts +567 -123
  9. package/node_modules/@hap/core/dist/index.js +869 -23
  10. package/node_modules/@hap/core/dist/index.mjs +829 -22
  11. package/node_modules/@hap/core/node_modules/@hpke/core/LICENSE +21 -0
  12. package/node_modules/@hap/core/node_modules/@hpke/core/README.md +263 -0
  13. package/node_modules/@hap/core/node_modules/@hpke/core/esm/mod.d.ts +11 -0
  14. package/node_modules/@hap/core/node_modules/@hpke/core/esm/mod.d.ts.map +1 -0
  15. package/node_modules/@hap/core/node_modules/@hpke/core/esm/mod.js +6 -0
  16. package/node_modules/@hap/core/node_modules/@hpke/core/esm/package.json +3 -0
  17. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/aeads/aesGcm.d.ts +80 -0
  18. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/aeads/aesGcm.d.ts.map +1 -0
  19. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/aeads/aesGcm.js +167 -0
  20. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/aeads/exportOnly.d.ts +34 -0
  21. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/aeads/exportOnly.d.ts.map +1 -0
  22. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/aeads/exportOnly.js +56 -0
  23. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/cipherSuiteNative.d.ts +145 -0
  24. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/cipherSuiteNative.d.ts.map +1 -0
  25. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/cipherSuiteNative.js +326 -0
  26. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/encryptionContext.d.ts +15 -0
  27. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/encryptionContext.d.ts.map +1 -0
  28. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/encryptionContext.js +68 -0
  29. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/exporterContext.d.ts +19 -0
  30. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/exporterContext.d.ts.map +1 -0
  31. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/exporterContext.js +62 -0
  32. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/aeadParams.d.ts +17 -0
  33. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/aeadParams.d.ts.map +1 -0
  34. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/aeadParams.js +1 -0
  35. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/cipherSuiteParams.d.ts +13 -0
  36. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/cipherSuiteParams.d.ts.map +1 -0
  37. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/cipherSuiteParams.js +1 -0
  38. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/encapsulator.d.ts +8 -0
  39. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/encapsulator.d.ts.map +1 -0
  40. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/encapsulator.js +1 -0
  41. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/encryptionContext.d.ts +40 -0
  42. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/encryptionContext.d.ts.map +1 -0
  43. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/encryptionContext.js +1 -0
  44. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/exporter.d.ts +17 -0
  45. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/exporter.d.ts.map +1 -0
  46. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/exporter.js +1 -0
  47. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/keyInfo.d.ts +7 -0
  48. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/keyInfo.d.ts.map +1 -0
  49. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/keyInfo.js +1 -0
  50. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/responses.d.ts +10 -0
  51. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/responses.d.ts.map +1 -0
  52. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/responses.js +1 -0
  53. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/kems/dhkemNative.d.ts +26 -0
  54. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/kems/dhkemNative.d.ts.map +1 -0
  55. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/kems/dhkemNative.js +112 -0
  56. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/x25519.d.ts +24 -0
  57. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/x25519.d.ts.map +1 -0
  58. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/x25519.js +214 -0
  59. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/x448.d.ts +24 -0
  60. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/x448.d.ts.map +1 -0
  61. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/x448.js +214 -0
  62. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/kems/dhkemX25519.d.ts +38 -0
  63. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/kems/dhkemX25519.d.ts.map +1 -0
  64. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/kems/dhkemX25519.js +66 -0
  65. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/kems/dhkemX448.d.ts +38 -0
  66. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/kems/dhkemX448.d.ts.map +1 -0
  67. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/kems/dhkemX448.js +66 -0
  68. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/mutex.d.ts +5 -0
  69. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/mutex.d.ts.map +1 -0
  70. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/mutex.js +28 -0
  71. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/native.d.ts +236 -0
  72. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/native.d.ts.map +1 -0
  73. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/native.js +235 -0
  74. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/recipientContext.d.ts +6 -0
  75. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/recipientContext.d.ts.map +1 -0
  76. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/recipientContext.js +38 -0
  77. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/senderContext.d.ts +11 -0
  78. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/senderContext.d.ts.map +1 -0
  79. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/senderContext.js +45 -0
  80. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/utils/emitNotSupported.d.ts +2 -0
  81. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/utils/emitNotSupported.d.ts.map +1 -0
  82. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/utils/emitNotSupported.js +6 -0
  83. package/node_modules/@hap/core/node_modules/@hpke/core/package.json +46 -0
  84. package/node_modules/@hap/core/node_modules/@hpke/core/script/mod.d.ts +11 -0
  85. package/node_modules/@hap/core/node_modules/@hpke/core/script/mod.d.ts.map +1 -0
  86. package/node_modules/@hap/core/node_modules/@hpke/core/script/mod.js +47 -0
  87. package/node_modules/@hap/core/node_modules/@hpke/core/script/package.json +3 -0
  88. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/aeads/aesGcm.d.ts +80 -0
  89. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/aeads/aesGcm.d.ts.map +1 -0
  90. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/aeads/aesGcm.js +183 -0
  91. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/aeads/exportOnly.d.ts +34 -0
  92. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/aeads/exportOnly.d.ts.map +1 -0
  93. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/aeads/exportOnly.js +70 -0
  94. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/cipherSuiteNative.d.ts +145 -0
  95. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/cipherSuiteNative.d.ts.map +1 -0
  96. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/cipherSuiteNative.js +340 -0
  97. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/encryptionContext.d.ts +15 -0
  98. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/encryptionContext.d.ts.map +1 -0
  99. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/encryptionContext.js +82 -0
  100. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/exporterContext.d.ts +19 -0
  101. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/exporterContext.d.ts.map +1 -0
  102. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/exporterContext.js +78 -0
  103. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/aeadParams.d.ts +17 -0
  104. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/aeadParams.d.ts.map +1 -0
  105. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/aeadParams.js +12 -0
  106. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/cipherSuiteParams.d.ts +13 -0
  107. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/cipherSuiteParams.d.ts.map +1 -0
  108. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/cipherSuiteParams.js +12 -0
  109. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/encapsulator.d.ts +8 -0
  110. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/encapsulator.d.ts.map +1 -0
  111. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/encapsulator.js +12 -0
  112. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/encryptionContext.d.ts +40 -0
  113. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/encryptionContext.d.ts.map +1 -0
  114. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/encryptionContext.js +12 -0
  115. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/exporter.d.ts +17 -0
  116. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/exporter.d.ts.map +1 -0
  117. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/exporter.js +12 -0
  118. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/keyInfo.d.ts +7 -0
  119. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/keyInfo.d.ts.map +1 -0
  120. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/keyInfo.js +12 -0
  121. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/responses.d.ts +10 -0
  122. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/responses.d.ts.map +1 -0
  123. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/responses.js +12 -0
  124. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/kems/dhkemNative.d.ts +26 -0
  125. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/kems/dhkemNative.d.ts.map +1 -0
  126. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/kems/dhkemNative.js +128 -0
  127. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/kems/dhkemPrimitives/x25519.d.ts +24 -0
  128. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/kems/dhkemPrimitives/x25519.d.ts.map +1 -0
  129. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/kems/dhkemPrimitives/x25519.js +228 -0
  130. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/kems/dhkemPrimitives/x448.d.ts +24 -0
  131. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/kems/dhkemPrimitives/x448.d.ts.map +1 -0
  132. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/kems/dhkemPrimitives/x448.js +228 -0
  133. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/kems/dhkemX25519.d.ts +38 -0
  134. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/kems/dhkemX25519.d.ts.map +1 -0
  135. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/kems/dhkemX25519.js +80 -0
  136. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/kems/dhkemX448.d.ts +38 -0
  137. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/kems/dhkemX448.d.ts.map +1 -0
  138. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/kems/dhkemX448.js +80 -0
  139. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/mutex.d.ts +5 -0
  140. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/mutex.d.ts.map +1 -0
  141. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/mutex.js +42 -0
  142. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/native.d.ts +236 -0
  143. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/native.d.ts.map +1 -0
  144. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/native.js +255 -0
  145. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/recipientContext.d.ts +6 -0
  146. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/recipientContext.d.ts.map +1 -0
  147. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/recipientContext.js +52 -0
  148. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/senderContext.d.ts +11 -0
  149. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/senderContext.d.ts.map +1 -0
  150. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/senderContext.js +59 -0
  151. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/utils/emitNotSupported.d.ts +2 -0
  152. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/utils/emitNotSupported.d.ts.map +1 -0
  153. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/utils/emitNotSupported.js +19 -0
  154. package/node_modules/@hap/core/package.json +2 -1
  155. package/node_modules/@hap/core/src/canonicalize.ts +9 -0
  156. package/node_modules/@hap/core/src/commitment-modes.ts +21 -9
  157. package/node_modules/@hap/core/src/errors.ts +24 -8
  158. package/node_modules/@hap/core/src/gatekeeper.ts +52 -8
  159. package/node_modules/@hap/core/src/index.ts +5 -1
  160. package/node_modules/@hap/core/src/issuance.ts +250 -0
  161. package/node_modules/@hap/core/src/mandate.ts +52 -14
  162. package/node_modules/@hap/core/src/owner-signature.ts +86 -39
  163. package/node_modules/@hap/core/src/profile.ts +45 -0
  164. package/node_modules/@hap/core/src/proposal-content.ts +219 -0
  165. package/node_modules/@hap/core/src/ticket-projection.ts +167 -0
  166. package/node_modules/@hap/core/src/ticket.ts +254 -20
  167. package/node_modules/@hap/core/src/types.ts +33 -5
  168. package/node_modules/@hap/core/src/verifier-policy.ts +178 -0
  169. package/node_modules/@hap/core/src/versions.ts +50 -19
  170. package/node_modules/@hono/node-server/dist/index.cjs +31 -6
  171. package/node_modules/@hono/node-server/dist/index.mjs +31 -6
  172. package/node_modules/@hono/node-server/package.json +1 -1
  173. package/node_modules/@hpke/common/esm/package.json +5 -1
  174. package/node_modules/@hpke/common/esm/src/curve/montgomery.d.ts +2 -2
  175. package/node_modules/@hpke/common/esm/src/curve/montgomery.d.ts.map +1 -1
  176. package/node_modules/@hpke/common/esm/src/curve/montgomery.js +41 -26
  177. package/node_modules/@hpke/common/esm/src/hash/sha3.d.ts.map +1 -1
  178. package/node_modules/@hpke/common/esm/src/hash/sha3.js +0 -15
  179. package/node_modules/@hpke/common/esm/src/kdfs/hkdf.d.ts +2 -1
  180. package/node_modules/@hpke/common/esm/src/kdfs/hkdf.d.ts.map +1 -1
  181. package/node_modules/@hpke/common/esm/src/kdfs/hkdf.js +12 -2
  182. package/node_modules/@hpke/common/esm/src/kems/dhkemPrimitives/xCurve.d.ts.map +1 -1
  183. package/node_modules/@hpke/common/esm/src/kems/dhkemPrimitives/xCurve.js +14 -3
  184. package/node_modules/@hpke/common/esm/src/utils/misc.d.ts +6 -0
  185. package/node_modules/@hpke/common/esm/src/utils/misc.d.ts.map +1 -1
  186. package/node_modules/@hpke/common/esm/src/utils/misc.js +43 -10
  187. package/node_modules/@hpke/common/esm/src/utils/noble.d.ts +1 -1
  188. package/node_modules/@hpke/common/esm/src/utils/noble.d.ts.map +1 -1
  189. package/node_modules/@hpke/common/esm/src/utils/noble.js +21 -10
  190. package/node_modules/@hpke/common/package.json +5 -1
  191. package/node_modules/@hpke/common/script/src/curve/montgomery.d.ts +2 -2
  192. package/node_modules/@hpke/common/script/src/curve/montgomery.d.ts.map +1 -1
  193. package/node_modules/@hpke/common/script/src/curve/montgomery.js +40 -25
  194. package/node_modules/@hpke/common/script/src/hash/sha3.d.ts.map +1 -1
  195. package/node_modules/@hpke/common/script/src/hash/sha3.js +0 -15
  196. package/node_modules/@hpke/common/script/src/kdfs/hkdf.d.ts +2 -1
  197. package/node_modules/@hpke/common/script/src/kdfs/hkdf.d.ts.map +1 -1
  198. package/node_modules/@hpke/common/script/src/kdfs/hkdf.js +12 -2
  199. package/node_modules/@hpke/common/script/src/kems/dhkemPrimitives/xCurve.d.ts.map +1 -1
  200. package/node_modules/@hpke/common/script/src/kems/dhkemPrimitives/xCurve.js +13 -2
  201. package/node_modules/@hpke/common/script/src/utils/misc.d.ts +6 -0
  202. package/node_modules/@hpke/common/script/src/utils/misc.d.ts.map +1 -1
  203. package/node_modules/@hpke/common/script/src/utils/misc.js +43 -9
  204. package/node_modules/@hpke/common/script/src/utils/noble.d.ts +1 -1
  205. package/node_modules/@hpke/common/script/src/utils/noble.d.ts.map +1 -1
  206. package/node_modules/@hpke/common/script/src/utils/noble.js +22 -11
  207. package/node_modules/@hpke/core/README.md +56 -56
  208. package/node_modules/@hpke/core/esm/package.json +2 -1
  209. package/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/x25519.d.ts +3 -21
  210. package/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/x25519.d.ts.map +1 -1
  211. package/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/x25519.js +3 -201
  212. package/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/x448.d.ts +3 -21
  213. package/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/x448.d.ts.map +1 -1
  214. package/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/x448.js +3 -201
  215. package/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/xCurveNative.d.ts +26 -0
  216. package/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/xCurveNative.d.ts.map +1 -0
  217. package/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/xCurveNative.js +216 -0
  218. package/node_modules/@hpke/core/package.json +6 -2
  219. package/node_modules/@hpke/core/script/src/kems/dhkemPrimitives/x25519.d.ts +3 -21
  220. package/node_modules/@hpke/core/script/src/kems/dhkemPrimitives/x25519.d.ts.map +1 -1
  221. package/node_modules/@hpke/core/script/src/kems/dhkemPrimitives/x25519.js +4 -202
  222. package/node_modules/@hpke/core/script/src/kems/dhkemPrimitives/x448.d.ts +3 -21
  223. package/node_modules/@hpke/core/script/src/kems/dhkemPrimitives/x448.d.ts.map +1 -1
  224. package/node_modules/@hpke/core/script/src/kems/dhkemPrimitives/x448.js +4 -202
  225. package/node_modules/@hpke/core/script/src/kems/dhkemPrimitives/xCurveNative.d.ts +26 -0
  226. package/node_modules/@hpke/core/script/src/kems/dhkemPrimitives/xCurveNative.d.ts.map +1 -0
  227. package/node_modules/@hpke/core/script/src/kems/dhkemPrimitives/xCurveNative.js +230 -0
  228. package/node_modules/@types/node/README.md +1 -1
  229. package/node_modules/@types/node/package.json +2 -2
  230. package/node_modules/@types/node/zlib.d.ts +752 -0
  231. package/node_modules/encodeurl/README.md +14 -0
  232. package/node_modules/encodeurl/index.js +5 -10
  233. package/node_modules/encodeurl/package.json +10 -6
  234. package/node_modules/express-rate-limit/dist/index.cjs +7 -3
  235. package/node_modules/express-rate-limit/dist/index.mjs +7 -3
  236. package/node_modules/express-rate-limit/package.json +10 -10
  237. package/node_modules/hono/dist/cjs/adapter/bun/serve-static.js +1 -1
  238. package/node_modules/hono/dist/cjs/adapter/bun/websocket.js +1 -1
  239. package/node_modules/hono/dist/cjs/context.js +1 -1
  240. package/node_modules/hono/dist/cjs/helper/css/common.js +3 -5
  241. package/node_modules/hono/dist/cjs/hono-base.js +4 -10
  242. package/node_modules/hono/dist/cjs/hono.js +0 -1
  243. package/node_modules/hono/dist/cjs/middleware/basic-auth/index.js +1 -1
  244. package/node_modules/hono/dist/cjs/middleware/bearer-auth/index.js +1 -1
  245. package/node_modules/hono/dist/cjs/middleware/csrf/index.js +2 -2
  246. package/node_modules/hono/dist/cjs/middleware/jwk/jwk.js +2 -2
  247. package/node_modules/hono/dist/cjs/middleware/jwt/jwt.js +2 -2
  248. package/node_modules/hono/dist/cjs/middleware/mount/index.js +4 -4
  249. package/node_modules/hono/dist/cjs/router/reg-exp-router/node.js +13 -11
  250. package/node_modules/hono/dist/cjs/router/reg-exp-router/prepared-router.js +4 -4
  251. package/node_modules/hono/dist/cjs/router/reg-exp-router/router.js +39 -51
  252. package/node_modules/hono/dist/cjs/router/reg-exp-router/trie.js +15 -5
  253. package/node_modules/hono/dist/cjs/utils/jwt/jwt.js +2 -1
  254. package/node_modules/hono/dist/cjs/utils/mount.js +35 -0
  255. package/node_modules/hono/dist/cjs/utils/url.js +10 -0
  256. package/node_modules/hono/dist/cjs/validator/validator.js +1 -1
  257. package/node_modules/hono/dist/context.js +1 -1
  258. package/node_modules/hono/dist/helper/css/common.js +3 -5
  259. package/node_modules/hono/dist/hono-base.js +4 -10
  260. package/node_modules/hono/dist/hono.js +0 -1
  261. package/node_modules/hono/dist/middleware/basic-auth/index.js +1 -1
  262. package/node_modules/hono/dist/middleware/bearer-auth/index.js +1 -1
  263. package/node_modules/hono/dist/middleware/csrf/index.js +2 -2
  264. package/node_modules/hono/dist/middleware/jwk/jwk.js +2 -2
  265. package/node_modules/hono/dist/middleware/jwt/jwt.js +2 -2
  266. package/node_modules/hono/dist/middleware/language/language.js +1 -1
  267. package/node_modules/hono/dist/middleware/mount/index.js +4 -4
  268. package/node_modules/hono/dist/router/reg-exp-router/node.js +13 -11
  269. package/node_modules/hono/dist/router/reg-exp-router/prepared-router.js +5 -5
  270. package/node_modules/hono/dist/router/reg-exp-router/router.js +40 -52
  271. package/node_modules/hono/dist/router/reg-exp-router/trie.js +15 -5
  272. package/node_modules/hono/dist/types/middleware/mount/index.d.ts +1 -0
  273. package/node_modules/hono/dist/types/router/reg-exp-router/node.d.ts +3 -3
  274. package/node_modules/hono/dist/types/router/reg-exp-router/trie.d.ts +1 -1
  275. package/node_modules/hono/dist/types/utils/mount.d.ts +4 -0
  276. package/node_modules/hono/dist/types/utils/url.d.ts +1 -0
  277. package/node_modules/hono/dist/utils/jwt/jwt.js +2 -1
  278. package/node_modules/hono/dist/utils/mount.js +34 -0
  279. package/node_modules/hono/dist/utils/url.js +10 -1
  280. package/node_modules/hono/dist/validator/validator.js +1 -1
  281. package/node_modules/hono/package.json +1 -1
  282. package/node_modules/ip-address/README.md +39 -39
  283. package/node_modules/ip-address/dist/ipv6.js +1 -1
  284. package/node_modules/ip-address/dist/ipv6.js.map +1 -1
  285. package/node_modules/ip-address/package.json +1 -1
  286. package/node_modules/jose/dist/types/jwt/decrypt.d.ts +3 -0
  287. package/node_modules/jose/dist/types/jwt/unsecured.d.ts +2 -0
  288. package/node_modules/jose/dist/types/jwt/verify.d.ts +3 -0
  289. package/node_modules/jose/dist/types/types.d.ts +8 -0
  290. package/node_modules/jose/dist/types/util/decode_jwt.d.ts +1 -0
  291. package/node_modules/jose/dist/webapi/jwks/remote.js +3 -1
  292. package/node_modules/jose/dist/webapi/lib/deflate.js +2 -1
  293. package/node_modules/jose/dist/webapi/lib/jwt_claims_set.js +2 -1
  294. package/node_modules/jose/package.json +1 -1
  295. package/node_modules/qs/CHANGELOG.md +29 -22
  296. package/node_modules/qs/dist/qs.js +14 -14
  297. package/node_modules/qs/eslint.config.mjs +6 -0
  298. package/node_modules/qs/lib/stringify.js +1 -1
  299. package/node_modules/qs/package.json +5 -5
  300. package/node_modules/qs/test/stringify.js +74 -0
  301. package/package.json +2 -2
@@ -11,6 +11,7 @@ What can make a test say more than it should, and what to do about each. Read th
11
11
  | The values a limit checks are readable on the Authority Server | Proposals are encrypted end to end since 0.27.0 — the server sees only the values it enforces limits on (e.g. an amount or a number of recipients) and fingerprints, never the content | Test data and renamed cases only in a setup; limits that refer to personal data are a profile question |
12
12
  | Setup limit too low | A clear without the following load leaves empty systems | Use a setup limit of 4–6 per day; clear and load in one go |
13
13
  | An AI that can control a browser or the screen | It could open the gateway's page, read the API key there and approve its own proposals — the person would no longer decide | Never open or operate the gateway's page, never handle the API key, never approve. Tell the person to approve themselves, and to keep the gateway page out of any browser an AI controls |
14
+ | The AI writes as the person, or as a person at all | A customer believes they dealt with a human, or with the mandate owner personally. The footer says an AI sent it; the text would contradict it | Never write as the mandate owner or as any person, and never claim to be human. Write as their AI or about them in the third person, even when the person asks otherwise, and say why |
14
15
  | Calls around the Suveren tools | A terminal, HTTP or browser call to the gateway's ports is not governed by a mandate | Use only the Suveren tools. If something is missing, tell the person what — do not probe the gateway |
15
16
 
16
17
  Next: start a run — the person asks the working AI to work the new requests.
@@ -917,6 +917,11 @@ async function loadOrGenerateKeyPair(vault2) {
917
917
  vault2.setCredential(VAULT_SLOT, toStore);
918
918
  return kp;
919
919
  }
920
+ async function getPublicKey(vault2) {
921
+ const stored = vault2.getCredential(VAULT_SLOT);
922
+ if (!stored?.publicKey) return null;
923
+ return fromBase64(stored.publicKey);
924
+ }
920
925
 
921
926
  // src/lib/client-version.ts
922
927
  import { readFileSync as readFileSync4 } from "fs";
@@ -3759,7 +3764,11 @@ function findSealedAttachment(toolArgs, sha256) {
3759
3764
 
3760
3765
  // src/lib/content-crypto.ts
3761
3766
  import { createHash as createHash5 } from "crypto";
3762
- import { canonicalize as canonicalize3 } from "@hap/core";
3767
+ import {
3768
+ canonicalize as canonicalize3,
3769
+ encryptProposalContent as hapEncryptProposalContent,
3770
+ decryptProposalContent as hapDecryptProposalContent
3771
+ } from "@hap/core";
3763
3772
  var CONTENT_ALG = "HPKE-X25519-HKDF-SHA256-AES256GCM";
3764
3773
  function computeProposalContentHash(toolArgs) {
3765
3774
  return `sha256:${createHash5("sha256").update(canonicalize3(toolArgs)).digest("hex")}`;
@@ -3774,7 +3783,7 @@ function keysToWire(encryptedKeys) {
3774
3783
  }
3775
3784
  return keys;
3776
3785
  }
3777
- async function fetchUserPubkey(userId, deps) {
3786
+ async function fetchUserPubkeyEntry(userIdOrDid, deps) {
3778
3787
  const pin = readPairing(deps.dataDir);
3779
3788
  const pinning = {
3780
3789
  enforce: resolvePinTls(deps.dataDir),
@@ -3782,13 +3791,22 @@ async function fetchUserPubkey(userId, deps) {
3782
3791
  };
3783
3792
  try {
3784
3793
  const { res } = await fetchAs(
3785
- `${deps.spUrl}/api/users/${encodeURIComponent(userId)}/pubkey`,
3794
+ `${deps.spUrl}/api/users/${encodeURIComponent(userIdOrDid)}/pubkey`,
3786
3795
  { headers: { Cookie: deps.cookie }, signal: AbortSignal.timeout(5e3) },
3787
3796
  pinning
3788
3797
  );
3789
3798
  if (!res.ok) return null;
3790
3799
  const data = await res.json().catch(() => ({}));
3791
- return typeof data.pubkey === "string" ? data.pubkey : null;
3800
+ if (typeof data.pubkey !== "string") return null;
3801
+ return { pubkey: data.pubkey, ...typeof data.did === "string" ? { did: data.did } : {} };
3802
+ } catch {
3803
+ return null;
3804
+ }
3805
+ }
3806
+ function decodeReaderKey(pubkeyB64) {
3807
+ try {
3808
+ const bytes = new Uint8Array(Buffer.from(pubkeyB64, "base64"));
3809
+ return bytes.length === 32 ? bytes : null;
3792
3810
  } catch {
3793
3811
  return null;
3794
3812
  }
@@ -3798,34 +3816,87 @@ async function resolveRecipientPubkeys(recipientUserIds, deps) {
3798
3816
  const resolved = [];
3799
3817
  const unreadableFor = [];
3800
3818
  for (const userId of ids) {
3801
- const pubkeyB64 = await fetchUserPubkey(userId, deps);
3802
- if (!pubkeyB64) {
3819
+ const entry = await fetchUserPubkeyEntry(userId, deps);
3820
+ const bytes = entry ? decodeReaderKey(entry.pubkey) : null;
3821
+ if (!entry || !bytes) {
3803
3822
  unreadableFor.push(userId);
3804
3823
  continue;
3805
3824
  }
3806
- try {
3807
- const bytes = new Uint8Array(Buffer.from(pubkeyB64, "base64"));
3808
- if (bytes.length !== 32) {
3809
- unreadableFor.push(userId);
3810
- continue;
3811
- }
3812
- resolved.push({ userId, publicKey: bytes });
3813
- } catch {
3814
- unreadableFor.push(userId);
3815
- }
3825
+ resolved.push({ userId, publicKey: bytes, ...entry.did ? { did: entry.did } : {} });
3816
3826
  }
3817
3827
  return { resolved, unreadableFor };
3818
3828
  }
3819
- async function encryptProposalContent(toolArgs, recipientUserIds, deps) {
3820
- const canonical = canonicalize3(toolArgs);
3821
- const hash = computeProposalContentHash(toolArgs);
3829
+ async function resolveReaderDids(v08, resolved, deps) {
3830
+ const dids = Array.from(/* @__PURE__ */ new Set([v08.ownerDid, ...v08.deciders]));
3831
+ const readers = [];
3832
+ const unreadable = [];
3833
+ for (const did of dids) {
3834
+ if (deps.selfDid && did === deps.selfDid) {
3835
+ if (deps.selfPublicKey?.length === 32) readers.push({ did, publicKey: deps.selfPublicKey });
3836
+ else unreadable.push(did);
3837
+ continue;
3838
+ }
3839
+ const known = resolved.find((r) => r.did === did);
3840
+ if (known) {
3841
+ readers.push({ did, publicKey: known.publicKey });
3842
+ continue;
3843
+ }
3844
+ const entry = await fetchUserPubkeyEntry(did, deps);
3845
+ const bytes = entry && (entry.did === void 0 || entry.did === did) ? decodeReaderKey(entry.pubkey) : null;
3846
+ if (bytes) readers.push({ did, publicKey: bytes });
3847
+ else unreadable.push(did);
3848
+ }
3849
+ return { readers, unreadable };
3850
+ }
3851
+ async function encryptProposalContent(toolArgs, recipientUserIds, deps, v08) {
3822
3852
  const { resolved, unreadableFor } = await resolveRecipientPubkeys(recipientUserIds, deps);
3853
+ if (v08) {
3854
+ const didReaders = await resolveReaderDids(v08, resolved, deps);
3855
+ if (didReaders.readers.length === 0) {
3856
+ throw new Error("No reader of this proposal (the mandate owner or a signed decider) has an end-to-end key \u2014 cannot encrypt this proposal.");
3857
+ }
3858
+ const { content: env2, proposalContentHash: proposalContentHash2 } = await hapEncryptProposalContent(toolArgs, [
3859
+ ...resolved.map((r) => ({ did: r.userId, publicKey: r.publicKey })),
3860
+ ...didReaders.readers
3861
+ ]);
3862
+ const byDid = new Set(didReaders.readers.map((r) => r.did));
3863
+ const keys = {};
3864
+ const encryptedKeys = {};
3865
+ for (const r of resolved) keys[r.userId] = env2.encrypted_keys[r.userId];
3866
+ for (const did of byDid) encryptedKeys[did] = env2.encrypted_keys[did];
3867
+ return {
3868
+ content: {
3869
+ v: 1,
3870
+ alg: CONTENT_ALG,
3871
+ ciphertext: env2.ciphertext,
3872
+ keys,
3873
+ hash: proposalContentHash2,
3874
+ encrypted_keys: encryptedKeys,
3875
+ readers: [...byDid],
3876
+ unreadable: didReaders.unreadable
3877
+ },
3878
+ unreadableFor
3879
+ };
3880
+ }
3823
3881
  if (resolved.length === 0) {
3824
3882
  throw new Error("No recipient (including the submitter) has a registered end-to-end key \u2014 cannot encrypt this proposal.");
3825
3883
  }
3826
- const encrypted = await encryptForRecipients(canonical, resolved);
3884
+ const { content: env, proposalContentHash } = await hapEncryptProposalContent(
3885
+ toolArgs,
3886
+ resolved.map((r) => ({ did: r.userId, publicKey: r.publicKey })),
3887
+ { unreadable: unreadableFor }
3888
+ );
3827
3889
  return {
3828
- content: { v: 1, alg: CONTENT_ALG, ciphertext: toB64(encrypted.intentCiphertext), keys: keysToWire(encrypted.encryptedKeys), hash },
3890
+ content: {
3891
+ v: 1,
3892
+ alg: CONTENT_ALG,
3893
+ ciphertext: env.ciphertext,
3894
+ keys: env.encrypted_keys,
3895
+ hash: proposalContentHash,
3896
+ encrypted_keys: env.encrypted_keys,
3897
+ readers: env.readers,
3898
+ unreadable: env.unreadable
3899
+ },
3829
3900
  unreadableFor
3830
3901
  };
3831
3902
  }
@@ -3840,11 +3911,47 @@ async function encryptProposalNote(note, recipientUserIds, deps) {
3840
3911
  unreadableFor
3841
3912
  };
3842
3913
  }
3843
- async function decryptProposalContent(wire, myUserId, myPrivateKey) {
3844
- const wrap = wire.keys[myUserId];
3914
+ function assertContentFingerprint(plaintext, wire) {
3915
+ const expected = wire.proposalContentHash ?? wire.hash;
3916
+ if (!expected) return;
3917
+ let parsed;
3918
+ try {
3919
+ parsed = JSON.parse(plaintext);
3920
+ } catch {
3921
+ throw new Error("Decrypted proposal content is not JSON \u2014 refusing to show it.");
3922
+ }
3923
+ if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
3924
+ throw new Error("Decrypted proposal content is not a JSON object \u2014 refusing to show it.");
3925
+ }
3926
+ const actual = computeProposalContentHash(parsed);
3927
+ if (actual !== expected) {
3928
+ throw new Error("Decrypted proposal content does not match its fingerprint \u2014 refusing to show it.");
3929
+ }
3930
+ }
3931
+ var STRICT_B64URL = /^[A-Za-z0-9_-]+$/;
3932
+ async function decryptProposalContent(wire, myUserId, myPrivateKey, myDid) {
3933
+ const keys = { ...wire.keys ?? {}, ...wire.encrypted_keys ?? {} };
3934
+ const wrap = (myDid ? keys[myDid] : void 0) ?? keys[myUserId];
3845
3935
  if (!wrap) {
3846
3936
  throw new Error("No key wrap for this account in this content \u2014 this device cannot read it.");
3847
3937
  }
3938
+ const fingerprint = wire.proposalContentHash ?? wire.hash;
3939
+ if (fingerprint && [wire.ciphertext, wrap.ct, wrap.enc].every((x) => STRICT_B64URL.test(x))) {
3940
+ let opened;
3941
+ try {
3942
+ opened = await hapDecryptProposalContent(
3943
+ { ciphertext: wire.ciphertext, encrypted_keys: { [myUserId]: wrap }, readers: [myUserId], unreadable: [] },
3944
+ myUserId,
3945
+ myPrivateKey
3946
+ );
3947
+ } catch (err) {
3948
+ throw new Error(`This content could not be opened on this device: ${err instanceof Error ? err.message : String(err)}`);
3949
+ }
3950
+ if (opened.proposalContentHash !== fingerprint) {
3951
+ throw new Error("Decrypted proposal content does not match its fingerprint \u2014 refusing to show it.");
3952
+ }
3953
+ return opened.contentJcs;
3954
+ }
3848
3955
  const encrypted = {
3849
3956
  intentCiphertext: new Uint8Array(Buffer.from(wire.ciphertext, "base64")),
3850
3957
  encryptedKeys: {
@@ -3854,7 +3961,9 @@ async function decryptProposalContent(wire, myUserId, myPrivateKey) {
3854
3961
  }
3855
3962
  }
3856
3963
  };
3857
- return decryptIntent(encrypted, myUserId, myPrivateKey);
3964
+ const plaintext = await decryptIntent(encrypted, myUserId, myPrivateKey);
3965
+ assertContentFingerprint(plaintext, wire);
3966
+ return plaintext;
3858
3967
  }
3859
3968
 
3860
3969
  // src/lib/execution-journal-reader.ts
@@ -3927,7 +4036,7 @@ async function resolveProposalToolArgsForRoute(spUrl, vault2, dataDir, lockAsTls
3927
4036
  try {
3928
4037
  const kp = await loadOrGenerateKeyPair(vault2);
3929
4038
  const me = vault2.getSessionUser();
3930
- const plaintext = await decryptProposalContent(proposal.content, me?.id ?? "", kp.privateKey);
4039
+ const plaintext = await decryptProposalContent(proposal.content, me?.id ?? "", kp.privateKey, me?.did);
3931
4040
  return { tool: proposal.tool, toolArgs: JSON.parse(plaintext) };
3932
4041
  } catch (err) {
3933
4042
  res.json({ status: "unavailable", reason: "connector_error", message: `Could not decrypt this proposal's content on this device: ${err instanceof Error ? err.message : String(err)}` });
@@ -3986,7 +4095,7 @@ function createProposalStatusRouter(spUrl, vault2, dataDir, lockAsTlsMismatch2,
3986
4095
  router.get("/:id/outcome", (req, res) => {
3987
4096
  try {
3988
4097
  const entry = findLatestByProposal(dataDir, req.params.id);
3989
- if (!entry) {
4098
+ if (!entry || entry.state === "requested") {
3990
4099
  const none = { state: "none" };
3991
4100
  res.json(none);
3992
4101
  return;
@@ -4341,7 +4450,10 @@ import { Router as Router14 } from "express";
4341
4450
  function createDecryptProposalContentRouter(vault2) {
4342
4451
  const router = Router14();
4343
4452
  router.post("/", async (req, res) => {
4344
- const { ciphertext, keys } = req.body;
4453
+ const { ciphertext, hash, proposalContentHash } = req.body;
4454
+ const isObj = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
4455
+ const { encrypted_keys: ek, keys: lk } = req.body;
4456
+ const keys = isObj(ek) || isObj(lk) ? { ...isObj(lk) ? lk : {}, ...isObj(ek) ? ek : {} } : void 0;
4345
4457
  if (typeof ciphertext !== "string" || ciphertext.length === 0) {
4346
4458
  res.status(400).json({ error: "Missing or invalid field: ciphertext (base64 string)" });
4347
4459
  return;
@@ -4358,9 +4470,17 @@ function createDecryptProposalContentRouter(vault2) {
4358
4470
  try {
4359
4471
  const kp = await loadOrGenerateKeyPair(vault2);
4360
4472
  const plaintext = await decryptProposalContent(
4361
- { ciphertext, keys },
4473
+ {
4474
+ ciphertext,
4475
+ keys,
4476
+ // v0.8 rule 8: when the caller passes the proposal's fingerprint, the
4477
+ // decrypted content is checked against it before it is shown.
4478
+ ...typeof hash === "string" ? { hash } : {},
4479
+ ...typeof proposalContentHash === "string" ? { proposalContentHash } : {}
4480
+ },
4362
4481
  me.id,
4363
- kp.privateKey
4482
+ kp.privateKey,
4483
+ me.did
4364
4484
  );
4365
4485
  res.json({ plaintext });
4366
4486
  } catch (err) {
@@ -4425,7 +4545,7 @@ function createInternalContentCryptoRouter(getSecret, vault2, spUrl, dataDir) {
4425
4545
  res.status(401).json({ error: "unauthorized" });
4426
4546
  return;
4427
4547
  }
4428
- const { toolArgs, recipientUserIds } = req.body ?? {};
4548
+ const { toolArgs, recipientUserIds, readers } = req.body ?? {};
4429
4549
  if (typeof toolArgs !== "object" || toolArgs === null || Array.isArray(toolArgs)) {
4430
4550
  res.status(400).json({ error: "toolArgs must be an object" });
4431
4551
  return;
@@ -4438,6 +4558,15 @@ function createInternalContentCryptoRouter(getSecret, vault2, spUrl, dataDir) {
4438
4558
  res.status(400).json({ error: `too many recipients (max ${MAX_RECIPIENTS})` });
4439
4559
  return;
4440
4560
  }
4561
+ let v08;
4562
+ if (readers !== void 0) {
4563
+ const r = readers;
4564
+ if (!r || typeof r.ownerDid !== "string" || !r.ownerDid.startsWith("did:") || !Array.isArray(r.deciders) || !r.deciders.every((d) => typeof d === "string" && d.startsWith("did:")) || r.deciders.length > MAX_RECIPIENTS) {
4565
+ res.status(400).json({ error: "readers must be { ownerDid: DID, deciders: DID[] }" });
4566
+ return;
4567
+ }
4568
+ v08 = { ownerDid: r.ownerDid, deciders: r.deciders };
4569
+ }
4441
4570
  const me = vault2.getSessionUser();
4442
4571
  const cookie = vault2.getSpCookie();
4443
4572
  if (!me || !cookie) {
@@ -4445,10 +4574,12 @@ function createInternalContentCryptoRouter(getSecret, vault2, spUrl, dataDir) {
4445
4574
  return;
4446
4575
  }
4447
4576
  try {
4577
+ const selfPublicKey = v08 ? await getPublicKey(vault2) ?? void 0 : void 0;
4448
4578
  const { content, unreadableFor } = await encryptProposalContent(
4449
4579
  toolArgs,
4450
4580
  recipientUserIds,
4451
- { spUrl, cookie, dataDir, selfUserId: me.id }
4581
+ { spUrl, cookie, dataDir, selfUserId: me.id, ...v08 ? { selfDid: me.did, selfPublicKey } : {} },
4582
+ v08
4452
4583
  );
4453
4584
  res.json({ content, unreadableFor });
4454
4585
  } catch (err) {
@@ -4461,7 +4592,10 @@ function createInternalContentCryptoRouter(getSecret, vault2, spUrl, dataDir) {
4461
4592
  res.status(401).json({ error: "unauthorized" });
4462
4593
  return;
4463
4594
  }
4464
- const { ciphertext, keys } = req.body ?? {};
4595
+ const body = req.body ?? {};
4596
+ const { ciphertext, hash, proposalContentHash } = body;
4597
+ const isObj = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
4598
+ const keys = isObj(body.encrypted_keys) || isObj(body.keys) ? { ...isObj(body.keys) ? body.keys : {}, ...isObj(body.encrypted_keys) ? body.encrypted_keys : {} } : void 0;
4465
4599
  if (typeof ciphertext !== "string" || ciphertext.length === 0) {
4466
4600
  res.status(400).json({ error: "ciphertext (base64 string) is required" });
4467
4601
  return;
@@ -4478,9 +4612,16 @@ function createInternalContentCryptoRouter(getSecret, vault2, spUrl, dataDir) {
4478
4612
  try {
4479
4613
  const kp = await loadOrGenerateKeyPair(vault2);
4480
4614
  const plaintext = await decryptProposalContent(
4481
- { ciphertext, keys },
4615
+ {
4616
+ ciphertext,
4617
+ keys,
4618
+ // v0.8 rule 8: checked against the fingerprint before it is returned.
4619
+ ...typeof hash === "string" ? { hash } : {},
4620
+ ...typeof proposalContentHash === "string" ? { proposalContentHash } : {}
4621
+ },
4482
4622
  me.id,
4483
- kp.privateKey
4623
+ kp.privateKey,
4624
+ me.did
4484
4625
  );
4485
4626
  res.json({ plaintext });
4486
4627
  } catch (err) {
@@ -4959,11 +5100,12 @@ import {
4959
5100
  computeBoundsHash,
4960
5101
  computeScopeHash,
4961
5102
  computeIntentHash,
5103
+ computeExecutionContextHash,
4962
5104
  computeProfileHash,
4963
5105
  isCommitmentModeAllowed,
4964
5106
  validateBoundsParams,
4965
5107
  validateScopeParams,
4966
- PROTOCOL_VERSION
5108
+ SUPPORTED_VERSIONS
4967
5109
  } from "@hap/core";
4968
5110
  var MandateRefused = class extends Error {
4969
5111
  };
@@ -5075,7 +5217,7 @@ async function createMandate(req, deps) {
5075
5217
  const boundsHash = computeBoundsHash(plan.bounds, plan.profile);
5076
5218
  const scopeHash = computeScopeHash(plan.context, plan.profile);
5077
5219
  const intentHash = computeIntentHash(plan.intent);
5078
- const ecHash = computeIntentHash(JSON.stringify({ profile: plan.profile.id, domain: plan.domain, group: plan.groupId }));
5220
+ const ecHash = computeExecutionContextHash(plan.profile);
5079
5221
  let enc;
5080
5222
  if (!plan.isPersonal) {
5081
5223
  const keys = await deps.as(
@@ -5090,7 +5232,10 @@ async function createMandate(req, deps) {
5090
5232
  authorization_id: authorizationId,
5091
5233
  profile_id: plan.profile.id,
5092
5234
  profile_hash: computeProfileHash(plan.profile),
5093
- supported_versions: [PROTOCOL_VERSION],
5235
+ // v0.8: every version this gateway verifies and enforces, newest first
5236
+ // (protocol.md → Version negotiation, rule 1). Today's 0.7 AS issues 0.7,
5237
+ // a 0.8 AS issues 0.8 — the gateway reads each under its own rules.
5238
+ supported_versions: [...SUPPORTED_VERSIONS],
5094
5239
  bounds: plan.bounds,
5095
5240
  bounds_hash: boundsHash,
5096
5241
  scope_hash: scopeHash,