@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.
- package/content/guides/6-risks.md +1 -0
- package/dist/control-plane/index.mjs +182 -37
- package/dist/mcp-server/http.mjs +357 -71
- package/dist/ui/assets/{index-C-lA_7Lt.js → index-CO-dj98E.js} +27 -27
- package/dist/ui/index.html +1 -1
- package/node_modules/@hap/core/README.md +3 -3
- package/node_modules/@hap/core/dist/index.d.mts +567 -123
- package/node_modules/@hap/core/dist/index.d.ts +567 -123
- package/node_modules/@hap/core/dist/index.js +869 -23
- package/node_modules/@hap/core/dist/index.mjs +829 -22
- package/node_modules/@hap/core/node_modules/@hpke/core/LICENSE +21 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/README.md +263 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/mod.d.ts +11 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/mod.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/mod.js +6 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/package.json +3 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/aeads/aesGcm.d.ts +80 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/aeads/aesGcm.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/aeads/aesGcm.js +167 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/aeads/exportOnly.d.ts +34 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/aeads/exportOnly.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/aeads/exportOnly.js +56 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/cipherSuiteNative.d.ts +145 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/cipherSuiteNative.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/cipherSuiteNative.js +326 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/encryptionContext.d.ts +15 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/encryptionContext.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/encryptionContext.js +68 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/exporterContext.d.ts +19 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/exporterContext.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/exporterContext.js +62 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/aeadParams.d.ts +17 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/aeadParams.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/aeadParams.js +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/cipherSuiteParams.d.ts +13 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/cipherSuiteParams.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/cipherSuiteParams.js +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/encapsulator.d.ts +8 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/encapsulator.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/encapsulator.js +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/encryptionContext.d.ts +40 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/encryptionContext.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/encryptionContext.js +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/exporter.d.ts +17 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/exporter.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/exporter.js +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/keyInfo.d.ts +7 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/keyInfo.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/keyInfo.js +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/responses.d.ts +10 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/responses.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/responses.js +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/kems/dhkemNative.d.ts +26 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/kems/dhkemNative.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/kems/dhkemNative.js +112 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/x25519.d.ts +24 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/x25519.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/x25519.js +214 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/x448.d.ts +24 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/x448.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/x448.js +214 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/kems/dhkemX25519.d.ts +38 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/kems/dhkemX25519.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/kems/dhkemX25519.js +66 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/kems/dhkemX448.d.ts +38 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/kems/dhkemX448.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/kems/dhkemX448.js +66 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/mutex.d.ts +5 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/mutex.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/mutex.js +28 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/native.d.ts +236 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/native.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/native.js +235 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/recipientContext.d.ts +6 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/recipientContext.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/recipientContext.js +38 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/senderContext.d.ts +11 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/senderContext.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/senderContext.js +45 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/utils/emitNotSupported.d.ts +2 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/utils/emitNotSupported.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/utils/emitNotSupported.js +6 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/package.json +46 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/mod.d.ts +11 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/mod.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/mod.js +47 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/package.json +3 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/aeads/aesGcm.d.ts +80 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/aeads/aesGcm.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/aeads/aesGcm.js +183 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/aeads/exportOnly.d.ts +34 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/aeads/exportOnly.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/aeads/exportOnly.js +70 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/cipherSuiteNative.d.ts +145 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/cipherSuiteNative.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/cipherSuiteNative.js +340 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/encryptionContext.d.ts +15 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/encryptionContext.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/encryptionContext.js +82 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/exporterContext.d.ts +19 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/exporterContext.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/exporterContext.js +78 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/aeadParams.d.ts +17 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/aeadParams.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/aeadParams.js +12 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/cipherSuiteParams.d.ts +13 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/cipherSuiteParams.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/cipherSuiteParams.js +12 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/encapsulator.d.ts +8 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/encapsulator.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/encapsulator.js +12 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/encryptionContext.d.ts +40 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/encryptionContext.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/encryptionContext.js +12 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/exporter.d.ts +17 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/exporter.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/exporter.js +12 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/keyInfo.d.ts +7 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/keyInfo.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/keyInfo.js +12 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/responses.d.ts +10 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/responses.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/responses.js +12 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/kems/dhkemNative.d.ts +26 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/kems/dhkemNative.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/kems/dhkemNative.js +128 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/kems/dhkemPrimitives/x25519.d.ts +24 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/kems/dhkemPrimitives/x25519.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/kems/dhkemPrimitives/x25519.js +228 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/kems/dhkemPrimitives/x448.d.ts +24 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/kems/dhkemPrimitives/x448.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/kems/dhkemPrimitives/x448.js +228 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/kems/dhkemX25519.d.ts +38 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/kems/dhkemX25519.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/kems/dhkemX25519.js +80 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/kems/dhkemX448.d.ts +38 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/kems/dhkemX448.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/kems/dhkemX448.js +80 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/mutex.d.ts +5 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/mutex.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/mutex.js +42 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/native.d.ts +236 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/native.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/native.js +255 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/recipientContext.d.ts +6 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/recipientContext.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/recipientContext.js +52 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/senderContext.d.ts +11 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/senderContext.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/senderContext.js +59 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/utils/emitNotSupported.d.ts +2 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/utils/emitNotSupported.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/utils/emitNotSupported.js +19 -0
- package/node_modules/@hap/core/package.json +2 -1
- package/node_modules/@hap/core/src/canonicalize.ts +9 -0
- package/node_modules/@hap/core/src/commitment-modes.ts +21 -9
- package/node_modules/@hap/core/src/errors.ts +24 -8
- package/node_modules/@hap/core/src/gatekeeper.ts +52 -8
- package/node_modules/@hap/core/src/index.ts +5 -1
- package/node_modules/@hap/core/src/issuance.ts +250 -0
- package/node_modules/@hap/core/src/mandate.ts +52 -14
- package/node_modules/@hap/core/src/owner-signature.ts +86 -39
- package/node_modules/@hap/core/src/profile.ts +45 -0
- package/node_modules/@hap/core/src/proposal-content.ts +219 -0
- package/node_modules/@hap/core/src/ticket-projection.ts +167 -0
- package/node_modules/@hap/core/src/ticket.ts +254 -20
- package/node_modules/@hap/core/src/types.ts +33 -5
- package/node_modules/@hap/core/src/verifier-policy.ts +178 -0
- package/node_modules/@hap/core/src/versions.ts +50 -19
- package/node_modules/@hono/node-server/dist/index.cjs +31 -6
- package/node_modules/@hono/node-server/dist/index.mjs +31 -6
- package/node_modules/@hono/node-server/package.json +1 -1
- package/node_modules/@hpke/common/esm/package.json +5 -1
- package/node_modules/@hpke/common/esm/src/curve/montgomery.d.ts +2 -2
- package/node_modules/@hpke/common/esm/src/curve/montgomery.d.ts.map +1 -1
- package/node_modules/@hpke/common/esm/src/curve/montgomery.js +41 -26
- package/node_modules/@hpke/common/esm/src/hash/sha3.d.ts.map +1 -1
- package/node_modules/@hpke/common/esm/src/hash/sha3.js +0 -15
- package/node_modules/@hpke/common/esm/src/kdfs/hkdf.d.ts +2 -1
- package/node_modules/@hpke/common/esm/src/kdfs/hkdf.d.ts.map +1 -1
- package/node_modules/@hpke/common/esm/src/kdfs/hkdf.js +12 -2
- package/node_modules/@hpke/common/esm/src/kems/dhkemPrimitives/xCurve.d.ts.map +1 -1
- package/node_modules/@hpke/common/esm/src/kems/dhkemPrimitives/xCurve.js +14 -3
- package/node_modules/@hpke/common/esm/src/utils/misc.d.ts +6 -0
- package/node_modules/@hpke/common/esm/src/utils/misc.d.ts.map +1 -1
- package/node_modules/@hpke/common/esm/src/utils/misc.js +43 -10
- package/node_modules/@hpke/common/esm/src/utils/noble.d.ts +1 -1
- package/node_modules/@hpke/common/esm/src/utils/noble.d.ts.map +1 -1
- package/node_modules/@hpke/common/esm/src/utils/noble.js +21 -10
- package/node_modules/@hpke/common/package.json +5 -1
- package/node_modules/@hpke/common/script/src/curve/montgomery.d.ts +2 -2
- package/node_modules/@hpke/common/script/src/curve/montgomery.d.ts.map +1 -1
- package/node_modules/@hpke/common/script/src/curve/montgomery.js +40 -25
- package/node_modules/@hpke/common/script/src/hash/sha3.d.ts.map +1 -1
- package/node_modules/@hpke/common/script/src/hash/sha3.js +0 -15
- package/node_modules/@hpke/common/script/src/kdfs/hkdf.d.ts +2 -1
- package/node_modules/@hpke/common/script/src/kdfs/hkdf.d.ts.map +1 -1
- package/node_modules/@hpke/common/script/src/kdfs/hkdf.js +12 -2
- package/node_modules/@hpke/common/script/src/kems/dhkemPrimitives/xCurve.d.ts.map +1 -1
- package/node_modules/@hpke/common/script/src/kems/dhkemPrimitives/xCurve.js +13 -2
- package/node_modules/@hpke/common/script/src/utils/misc.d.ts +6 -0
- package/node_modules/@hpke/common/script/src/utils/misc.d.ts.map +1 -1
- package/node_modules/@hpke/common/script/src/utils/misc.js +43 -9
- package/node_modules/@hpke/common/script/src/utils/noble.d.ts +1 -1
- package/node_modules/@hpke/common/script/src/utils/noble.d.ts.map +1 -1
- package/node_modules/@hpke/common/script/src/utils/noble.js +22 -11
- package/node_modules/@hpke/core/README.md +56 -56
- package/node_modules/@hpke/core/esm/package.json +2 -1
- package/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/x25519.d.ts +3 -21
- package/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/x25519.d.ts.map +1 -1
- package/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/x25519.js +3 -201
- package/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/x448.d.ts +3 -21
- package/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/x448.d.ts.map +1 -1
- package/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/x448.js +3 -201
- package/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/xCurveNative.d.ts +26 -0
- package/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/xCurveNative.d.ts.map +1 -0
- package/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/xCurveNative.js +216 -0
- package/node_modules/@hpke/core/package.json +6 -2
- package/node_modules/@hpke/core/script/src/kems/dhkemPrimitives/x25519.d.ts +3 -21
- package/node_modules/@hpke/core/script/src/kems/dhkemPrimitives/x25519.d.ts.map +1 -1
- package/node_modules/@hpke/core/script/src/kems/dhkemPrimitives/x25519.js +4 -202
- package/node_modules/@hpke/core/script/src/kems/dhkemPrimitives/x448.d.ts +3 -21
- package/node_modules/@hpke/core/script/src/kems/dhkemPrimitives/x448.d.ts.map +1 -1
- package/node_modules/@hpke/core/script/src/kems/dhkemPrimitives/x448.js +4 -202
- package/node_modules/@hpke/core/script/src/kems/dhkemPrimitives/xCurveNative.d.ts +26 -0
- package/node_modules/@hpke/core/script/src/kems/dhkemPrimitives/xCurveNative.d.ts.map +1 -0
- package/node_modules/@hpke/core/script/src/kems/dhkemPrimitives/xCurveNative.js +230 -0
- package/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/node/package.json +2 -2
- package/node_modules/@types/node/zlib.d.ts +752 -0
- package/node_modules/encodeurl/README.md +14 -0
- package/node_modules/encodeurl/index.js +5 -10
- package/node_modules/encodeurl/package.json +10 -6
- package/node_modules/express-rate-limit/dist/index.cjs +7 -3
- package/node_modules/express-rate-limit/dist/index.mjs +7 -3
- package/node_modules/express-rate-limit/package.json +10 -10
- package/node_modules/hono/dist/cjs/adapter/bun/serve-static.js +1 -1
- package/node_modules/hono/dist/cjs/adapter/bun/websocket.js +1 -1
- package/node_modules/hono/dist/cjs/context.js +1 -1
- package/node_modules/hono/dist/cjs/helper/css/common.js +3 -5
- package/node_modules/hono/dist/cjs/hono-base.js +4 -10
- package/node_modules/hono/dist/cjs/hono.js +0 -1
- package/node_modules/hono/dist/cjs/middleware/basic-auth/index.js +1 -1
- package/node_modules/hono/dist/cjs/middleware/bearer-auth/index.js +1 -1
- package/node_modules/hono/dist/cjs/middleware/csrf/index.js +2 -2
- package/node_modules/hono/dist/cjs/middleware/jwk/jwk.js +2 -2
- package/node_modules/hono/dist/cjs/middleware/jwt/jwt.js +2 -2
- package/node_modules/hono/dist/cjs/middleware/mount/index.js +4 -4
- package/node_modules/hono/dist/cjs/router/reg-exp-router/node.js +13 -11
- package/node_modules/hono/dist/cjs/router/reg-exp-router/prepared-router.js +4 -4
- package/node_modules/hono/dist/cjs/router/reg-exp-router/router.js +39 -51
- package/node_modules/hono/dist/cjs/router/reg-exp-router/trie.js +15 -5
- package/node_modules/hono/dist/cjs/utils/jwt/jwt.js +2 -1
- package/node_modules/hono/dist/cjs/utils/mount.js +35 -0
- package/node_modules/hono/dist/cjs/utils/url.js +10 -0
- package/node_modules/hono/dist/cjs/validator/validator.js +1 -1
- package/node_modules/hono/dist/context.js +1 -1
- package/node_modules/hono/dist/helper/css/common.js +3 -5
- package/node_modules/hono/dist/hono-base.js +4 -10
- package/node_modules/hono/dist/hono.js +0 -1
- package/node_modules/hono/dist/middleware/basic-auth/index.js +1 -1
- package/node_modules/hono/dist/middleware/bearer-auth/index.js +1 -1
- package/node_modules/hono/dist/middleware/csrf/index.js +2 -2
- package/node_modules/hono/dist/middleware/jwk/jwk.js +2 -2
- package/node_modules/hono/dist/middleware/jwt/jwt.js +2 -2
- package/node_modules/hono/dist/middleware/language/language.js +1 -1
- package/node_modules/hono/dist/middleware/mount/index.js +4 -4
- package/node_modules/hono/dist/router/reg-exp-router/node.js +13 -11
- package/node_modules/hono/dist/router/reg-exp-router/prepared-router.js +5 -5
- package/node_modules/hono/dist/router/reg-exp-router/router.js +40 -52
- package/node_modules/hono/dist/router/reg-exp-router/trie.js +15 -5
- package/node_modules/hono/dist/types/middleware/mount/index.d.ts +1 -0
- package/node_modules/hono/dist/types/router/reg-exp-router/node.d.ts +3 -3
- package/node_modules/hono/dist/types/router/reg-exp-router/trie.d.ts +1 -1
- package/node_modules/hono/dist/types/utils/mount.d.ts +4 -0
- package/node_modules/hono/dist/types/utils/url.d.ts +1 -0
- package/node_modules/hono/dist/utils/jwt/jwt.js +2 -1
- package/node_modules/hono/dist/utils/mount.js +34 -0
- package/node_modules/hono/dist/utils/url.js +10 -1
- package/node_modules/hono/dist/validator/validator.js +1 -1
- package/node_modules/hono/package.json +1 -1
- package/node_modules/ip-address/README.md +39 -39
- package/node_modules/ip-address/dist/ipv6.js +1 -1
- package/node_modules/ip-address/dist/ipv6.js.map +1 -1
- package/node_modules/ip-address/package.json +1 -1
- package/node_modules/jose/dist/types/jwt/decrypt.d.ts +3 -0
- package/node_modules/jose/dist/types/jwt/unsecured.d.ts +2 -0
- package/node_modules/jose/dist/types/jwt/verify.d.ts +3 -0
- package/node_modules/jose/dist/types/types.d.ts +8 -0
- package/node_modules/jose/dist/types/util/decode_jwt.d.ts +1 -0
- package/node_modules/jose/dist/webapi/jwks/remote.js +3 -1
- package/node_modules/jose/dist/webapi/lib/deflate.js +2 -1
- package/node_modules/jose/dist/webapi/lib/jwt_claims_set.js +2 -1
- package/node_modules/jose/package.json +1 -1
- package/node_modules/qs/CHANGELOG.md +29 -22
- package/node_modules/qs/dist/qs.js +14 -14
- package/node_modules/qs/eslint.config.mjs +6 -0
- package/node_modules/qs/lib/stringify.js +1 -1
- package/node_modules/qs/package.json +5 -5
- package/node_modules/qs/test/stringify.js +74 -0
- 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 {
|
|
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
|
|
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(
|
|
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
|
-
|
|
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
|
|
3802
|
-
|
|
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
|
-
|
|
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
|
|
3820
|
-
const
|
|
3821
|
-
const
|
|
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
|
|
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: {
|
|
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
|
-
|
|
3844
|
-
const
|
|
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
|
-
|
|
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,
|
|
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
|
-
{
|
|
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
|
|
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
|
-
{
|
|
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
|
-
|
|
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 =
|
|
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
|
-
|
|
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,
|