@suveren/gateway 0.7.4 → 0.8.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.
- package/content/integrations/mollie.json +103 -28
- package/dist/control-plane/index.mjs +248 -58
- package/dist/mcp-server/http.mjs +577 -124
- package/dist/ui/assets/index-BFnSVa9N.js +110 -0
- package/dist/ui/assets/{index-CkWaRck1.css → index-BYVb_0oG.css} +1 -1
- package/dist/ui/index.html +2 -2
- package/node_modules/@hap/core/dist/index.d.mts +285 -13
- package/node_modules/@hap/core/dist/index.d.ts +285 -13
- package/node_modules/@hap/core/dist/index.js +281 -13
- package/node_modules/@hap/core/dist/index.mjs +266 -12
- package/node_modules/@hap/core/package.json +4 -2
- package/node_modules/@hap/core/src/did-key.ts +126 -0
- package/node_modules/@hap/core/src/frame.ts +115 -14
- package/node_modules/@hap/core/src/gatekeeper.ts +26 -0
- package/node_modules/@hap/core/src/identity.ts +21 -5
- package/node_modules/@hap/core/src/index.ts +3 -0
- package/node_modules/@hap/core/src/mandate.ts +207 -0
- package/node_modules/@hap/core/src/receipt.ts +74 -0
- package/node_modules/@hap/core/src/types.ts +87 -5
- package/node_modules/@modelcontextprotocol/sdk/node_modules/negotiator/lib/accept.js +54 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/negotiator/lib/charset.js +10 -34
- package/node_modules/@modelcontextprotocol/sdk/node_modules/negotiator/lib/encoding.js +9 -30
- package/node_modules/@modelcontextprotocol/sdk/node_modules/negotiator/lib/language.js +15 -36
- package/node_modules/@modelcontextprotocol/sdk/node_modules/negotiator/lib/mediaType.js +16 -134
- package/node_modules/@modelcontextprotocol/sdk/node_modules/negotiator/node_modules/content-type/LICENSE +22 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/negotiator/node_modules/content-type/README.md +71 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/negotiator/node_modules/content-type/dist/index.d.ts +46 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/negotiator/node_modules/content-type/dist/index.js +176 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/negotiator/node_modules/content-type/dist/index.js.map +1 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/negotiator/node_modules/content-type/package.json +52 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/negotiator/package.json +16 -10
- package/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/node/buffer.buffer.d.ts +10 -5
- package/node_modules/@types/node/crypto.d.ts +2 -4
- package/node_modules/@types/node/dgram.d.ts +119 -4
- package/node_modules/@types/node/ffi.d.ts +1 -1
- package/node_modules/@types/node/fs/promises.d.ts +61 -65
- package/node_modules/@types/node/fs.d.ts +86 -76
- package/node_modules/@types/node/http.d.ts +17 -1
- package/node_modules/@types/node/http2.d.ts +12 -4
- package/node_modules/@types/node/index.d.ts +1 -0
- package/node_modules/@types/node/inspector.d.ts +2 -1
- package/node_modules/@types/node/net.d.ts +108 -16
- package/node_modules/@types/node/package.json +2 -2
- package/node_modules/@types/node/process.d.ts +52 -0
- package/node_modules/@types/node/quic.d.ts +246 -38
- package/node_modules/@types/node/sqlite.d.ts +6 -2
- package/node_modules/@types/node/stream/iter.d.ts +4 -4
- package/node_modules/@types/node/test.d.ts +36 -0
- package/node_modules/@types/node/tls.d.ts +24 -0
- package/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +5 -0
- package/node_modules/@types/node/ts5.6/index.d.ts +1 -0
- package/node_modules/@types/node/ts5.7/index.d.ts +1 -0
- package/node_modules/@types/node/tty.d.ts +4 -3
- package/node_modules/@types/node/vfs.d.ts +210 -0
- package/node_modules/@types/node/vm.d.ts +1 -1
- package/node_modules/express-rate-limit/dist/index.cjs +6 -3
- package/node_modules/express-rate-limit/dist/index.d.cts +11 -0
- package/node_modules/express-rate-limit/dist/index.d.mts +11 -0
- package/node_modules/express-rate-limit/dist/index.d.ts +11 -0
- package/node_modules/express-rate-limit/dist/index.mjs +6 -3
- package/node_modules/express-rate-limit/{license.md → license} +7 -6
- package/node_modules/express-rate-limit/package.json +5 -5
- package/node_modules/express-rate-limit/readme.md +1 -0
- package/node_modules/fast-uri/index.js +215 -47
- package/node_modules/fast-uri/lib/schemes.js +9 -4
- package/node_modules/fast-uri/lib/utils.js +396 -92
- package/node_modules/fast-uri/package.json +1 -1
- package/node_modules/fast-uri/test/component-safe-serialization.test.js +163 -0
- package/node_modules/fast-uri/test/equal.test.js +31 -3
- package/node_modules/fast-uri/test/fixtures/uri-js-parse.json +2 -0
- package/node_modules/fast-uri/test/ipv6-canonical.test.js +34 -0
- package/node_modules/fast-uri/test/ipv6-validation.test.js +124 -0
- package/node_modules/fast-uri/test/malformed-percent.test.js +77 -0
- package/node_modules/fast-uri/test/malformed-urn.test.js +61 -0
- package/node_modules/fast-uri/test/parse.test.js +7 -3
- package/node_modules/fast-uri/test/query-fragment-normalization.test.js +33 -0
- package/node_modules/fast-uri/test/reserved-path-normalization.test.js +109 -0
- package/node_modules/fast-uri/test/scheme-validation.test.js +124 -0
- package/node_modules/fast-uri/test/security-normalization.test.js +101 -0
- package/node_modules/fast-uri/test/security.test.js +75 -3
- package/node_modules/fast-uri/test/urn-full-input.test.js +29 -0
- package/node_modules/fast-uri/test/websocket-query-preservation.test.js +24 -0
- package/node_modules/hono/dist/cjs/client/client.js +25 -11
- package/node_modules/hono/dist/cjs/client/utils.js +4 -1
- package/node_modules/hono/dist/cjs/context.js +4 -0
- package/node_modules/hono/dist/cjs/helper/accepts/accepts.js +36 -2
- package/node_modules/hono/dist/cjs/helper/ssg/ssg.js +1 -1
- package/node_modules/hono/dist/cjs/helper/ssg/utils.js +30 -10
- package/node_modules/hono/dist/cjs/jsx/dom/render.js +2 -0
- package/node_modules/hono/dist/cjs/middleware/cache/index.js +1 -1
- package/node_modules/hono/dist/cjs/middleware/cors/index.js +1 -1
- package/node_modules/hono/dist/cjs/middleware/csrf/index.js +1 -1
- package/node_modules/hono/dist/cjs/middleware/etag/digest.js +1 -1
- package/node_modules/hono/dist/cjs/middleware/etag/index.js +3 -3
- package/node_modules/hono/dist/cjs/middleware/pretty-json/index.js +3 -1
- package/node_modules/hono/dist/cjs/request.js +8 -4
- package/node_modules/hono/dist/cjs/router/linear-router/router.js +7 -2
- package/node_modules/hono/dist/cjs/router/pattern-router/router.js +3 -9
- package/node_modules/hono/dist/cjs/router/reg-exp-router/node.js +10 -3
- package/node_modules/hono/dist/cjs/router/reg-exp-router/router.js +47 -83
- package/node_modules/hono/dist/cjs/router/reg-exp-router/trie.js +2 -1
- package/node_modules/hono/dist/cjs/router/trie-router/node.js +46 -69
- package/node_modules/hono/dist/cjs/router/trie-router/router.js +3 -11
- package/node_modules/hono/dist/cjs/router/utils.js +27 -0
- package/node_modules/hono/dist/cjs/utils/body.js +15 -3
- package/node_modules/hono/dist/cjs/utils/cookie.js +1 -1
- package/node_modules/hono/dist/cjs/utils/ipaddr.js +5 -3
- package/node_modules/hono/dist/cjs/utils/stream.js +7 -1
- package/node_modules/hono/dist/cjs/utils/url.js +9 -1
- package/node_modules/hono/dist/client/client.js +25 -11
- package/node_modules/hono/dist/client/utils.js +4 -1
- package/node_modules/hono/dist/context.js +4 -0
- package/node_modules/hono/dist/helper/accepts/accepts.js +36 -2
- package/node_modules/hono/dist/helper/ssg/ssg.js +1 -1
- package/node_modules/hono/dist/helper/ssg/utils.js +30 -10
- package/node_modules/hono/dist/jsx/dom/render.js +2 -0
- package/node_modules/hono/dist/middleware/cache/index.js +1 -1
- package/node_modules/hono/dist/middleware/cors/index.js +1 -1
- package/node_modules/hono/dist/middleware/csrf/index.js +1 -1
- package/node_modules/hono/dist/middleware/etag/digest.js +1 -1
- package/node_modules/hono/dist/middleware/etag/index.js +3 -3
- package/node_modules/hono/dist/middleware/pretty-json/index.js +3 -1
- package/node_modules/hono/dist/request.js +8 -4
- package/node_modules/hono/dist/router/linear-router/router.js +7 -2
- package/node_modules/hono/dist/router/pattern-router/router.js +3 -9
- package/node_modules/hono/dist/router/reg-exp-router/node.js +6 -2
- package/node_modules/hono/dist/router/reg-exp-router/router.js +53 -84
- package/node_modules/hono/dist/router/reg-exp-router/trie.js +2 -1
- package/node_modules/hono/dist/router/trie-router/node.js +46 -69
- package/node_modules/hono/dist/router/trie-router/router.js +3 -11
- package/node_modules/hono/dist/router/utils.js +5 -0
- package/node_modules/hono/dist/types/context.d.ts +4 -0
- package/node_modules/hono/dist/types/router/reg-exp-router/node.d.ts +3 -0
- package/node_modules/hono/dist/types/router/trie-router/node.d.ts +1 -2
- package/node_modules/hono/dist/types/router/trie-router/router.d.ts +0 -1
- package/node_modules/hono/dist/types/router/utils.d.ts +1 -0
- package/node_modules/hono/dist/types/utils/url.d.ts +4 -0
- package/node_modules/hono/dist/utils/body.js +15 -3
- package/node_modules/hono/dist/utils/cookie.js +1 -1
- package/node_modules/hono/dist/utils/ipaddr.js +5 -3
- package/node_modules/hono/dist/utils/stream.js +7 -1
- package/node_modules/hono/dist/utils/url.js +9 -1
- package/node_modules/hono/package.json +1 -1
- package/node_modules/ip-address/README.md +92 -82
- package/node_modules/ip-address/dist/common.d.ts +20 -0
- package/node_modules/ip-address/dist/common.js +36 -0
- package/node_modules/ip-address/dist/common.js.map +1 -1
- package/node_modules/ip-address/dist/ipv4.d.ts +50 -0
- package/node_modules/ip-address/dist/ipv4.js +75 -0
- package/node_modules/ip-address/dist/ipv4.js.map +1 -1
- package/node_modules/ip-address/dist/ipv6.d.ts +79 -10
- package/node_modules/ip-address/dist/ipv6.js +120 -30
- package/node_modules/ip-address/dist/ipv6.js.map +1 -1
- package/node_modules/ip-address/dist/v4/constants.d.ts +12 -0
- package/node_modules/ip-address/dist/v4/constants.js +40 -1
- package/node_modules/ip-address/dist/v4/constants.js.map +1 -1
- package/node_modules/ip-address/dist/v6/constants.d.ts +14 -0
- package/node_modules/ip-address/dist/v6/constants.js +47 -1
- package/node_modules/ip-address/dist/v6/constants.js.map +1 -1
- package/node_modules/ip-address/package.json +1 -1
- package/node_modules/is-plain-object/README.md +39 -95
- package/node_modules/is-plain-object/dist/is-plain-object.js +0 -2
- package/node_modules/is-plain-object/is-plain-object.d.ts +6 -1
- package/node_modules/is-plain-object/package.json +8 -34
- package/node_modules/jose/dist/types/jwe/compact/decrypt.d.ts +7 -16
- package/node_modules/jose/dist/types/jwe/compact/encrypt.d.ts +10 -20
- package/node_modules/jose/dist/types/jwe/flattened/decrypt.d.ts +7 -16
- package/node_modules/jose/dist/types/jwe/flattened/encrypt.d.ts +16 -38
- package/node_modules/jose/dist/types/jwe/general/decrypt.d.ts +7 -16
- package/node_modules/jose/dist/types/jwe/general/encrypt.d.ts +19 -38
- package/node_modules/jose/dist/types/jwk/embedded.d.ts +3 -8
- package/node_modules/jose/dist/types/jwk/thumbprint.d.ts +5 -5
- package/node_modules/jose/dist/types/jwks/local.d.ts +6 -10
- package/node_modules/jose/dist/types/jwks/remote.d.ts +17 -28
- package/node_modules/jose/dist/types/jws/compact/sign.d.ts +5 -10
- package/node_modules/jose/dist/types/jws/compact/verify.d.ts +9 -18
- package/node_modules/jose/dist/types/jws/flattened/sign.d.ts +7 -16
- package/node_modules/jose/dist/types/jws/flattened/verify.d.ts +9 -18
- package/node_modules/jose/dist/types/jws/general/sign.d.ts +11 -21
- package/node_modules/jose/dist/types/jws/general/verify.d.ts +12 -21
- package/node_modules/jose/dist/types/jwt/decrypt.d.ts +10 -20
- package/node_modules/jose/dist/types/jwt/encrypt.d.ts +17 -29
- package/node_modules/jose/dist/types/jwt/sign.d.ts +12 -19
- package/node_modules/jose/dist/types/jwt/unsecured.d.ts +17 -28
- package/node_modules/jose/dist/types/jwt/verify.d.ts +9 -19
- package/node_modules/jose/dist/types/key/export.d.ts +4 -4
- package/node_modules/jose/dist/types/key/generate_key_pair.d.ts +6 -8
- package/node_modules/jose/dist/types/key/generate_secret.d.ts +4 -11
- package/node_modules/jose/dist/types/key/import.d.ts +10 -17
- package/node_modules/jose/dist/types/types.d.ts +48 -86
- package/node_modules/jose/dist/types/util/base64url.d.ts +2 -2
- package/node_modules/jose/dist/types/util/decode_jwt.d.ts +3 -10
- package/node_modules/jose/dist/types/util/decode_protected_header.d.ts +4 -4
- package/node_modules/jose/dist/types/util/errors.d.ts +26 -53
- package/node_modules/jose/dist/webapi/index.js +70 -32
- package/node_modules/jose/dist/webapi/jwe/compact/decrypt.js +7 -8
- package/node_modules/jose/dist/webapi/jwe/compact/encrypt.js +42 -26
- package/node_modules/jose/dist/webapi/jwe/flattened/decrypt.js +14 -10
- package/node_modules/jose/dist/webapi/jwe/flattened/encrypt.js +53 -71
- package/node_modules/jose/dist/webapi/jwe/general/decrypt.js +38 -49
- package/node_modules/jose/dist/webapi/jwe/general/encrypt.js +121 -158
- package/node_modules/jose/dist/webapi/jwk/embedded.js +30 -18
- package/node_modules/jose/dist/webapi/jwk/thumbprint.js +54 -64
- package/node_modules/jose/dist/webapi/jwks/local.js +49 -74
- package/node_modules/jose/dist/webapi/jwks/remote.js +91 -160
- package/node_modules/jose/dist/webapi/jws/compact/sign.js +21 -20
- package/node_modules/jose/dist/webapi/jws/compact/verify.js +7 -8
- package/node_modules/jose/dist/webapi/jws/flattened/sign.js +29 -30
- package/node_modules/jose/dist/webapi/jws/flattened/verify.js +21 -23
- package/node_modules/jose/dist/webapi/jws/general/sign.js +61 -70
- package/node_modules/jose/dist/webapi/jws/general/verify.js +47 -41
- package/node_modules/jose/dist/webapi/jwt/decrypt.js +13 -22
- package/node_modules/jose/dist/webapi/jwt/encrypt.js +58 -100
- package/node_modules/jose/dist/webapi/jwt/sign.js +18 -50
- package/node_modules/jose/dist/webapi/jwt/unsecured.js +34 -63
- package/node_modules/jose/dist/webapi/jwt/verify.js +12 -14
- package/node_modules/jose/dist/webapi/key/export.js +32 -37
- package/node_modules/jose/dist/webapi/key/generate_key_pair.js +40 -44
- package/node_modules/jose/dist/webapi/key/generate_secret.js +35 -39
- package/node_modules/jose/dist/webapi/key/import.js +52 -52
- package/node_modules/jose/dist/webapi/lib/asn1.js +130 -164
- package/node_modules/jose/dist/webapi/lib/base64.js +18 -20
- package/node_modules/jose/dist/webapi/lib/buffer_utils.js +34 -38
- package/node_modules/jose/dist/webapi/lib/content_encryption.js +79 -123
- package/node_modules/jose/dist/webapi/lib/crypto_key.js +24 -25
- package/node_modules/jose/dist/webapi/lib/deflate.js +46 -40
- package/node_modules/jose/dist/webapi/lib/helpers.js +40 -37
- package/node_modules/jose/dist/webapi/lib/invalid_key_input.js +10 -24
- package/node_modules/jose/dist/webapi/lib/is_key_like.js +17 -15
- package/node_modules/jose/dist/webapi/lib/jwe_algorithms.js +106 -93
- package/node_modules/jose/dist/webapi/lib/jwe_decrypt.js +210 -176
- package/node_modules/jose/dist/webapi/lib/jwe_encrypt.js +105 -107
- package/node_modules/jose/dist/webapi/lib/jwk_metadata.js +19 -0
- package/node_modules/jose/dist/webapi/lib/jwk_to_key.js +9 -16
- package/node_modules/jose/dist/webapi/lib/jws_algorithms.js +62 -61
- package/node_modules/jose/dist/webapi/lib/jws_sign.js +58 -72
- package/node_modules/jose/dist/webapi/lib/jws_verify.js +90 -103
- package/node_modules/jose/dist/webapi/lib/jwt_claims_set.js +134 -185
- package/node_modules/jose/dist/webapi/lib/key.js +84 -121
- package/node_modules/jose/dist/webapi/lib/key_algorithm.js +13 -8
- package/node_modules/jose/dist/webapi/lib/key_descriptor.js +8 -6
- package/node_modules/jose/dist/webapi/lib/key_management.js +200 -225
- package/node_modules/jose/dist/webapi/lib/key_options.js +8 -0
- package/node_modules/jose/dist/webapi/lib/options.js +57 -44
- package/node_modules/jose/dist/webapi/lib/signing.js +18 -22
- package/node_modules/jose/dist/webapi/lib/type_checks.js +28 -33
- package/node_modules/jose/dist/webapi/util/base64url.js +26 -35
- package/node_modules/jose/dist/webapi/util/decode_jwt.js +32 -31
- package/node_modules/jose/dist/webapi/util/decode_protected_header.js +18 -23
- package/node_modules/jose/dist/webapi/util/errors.js +94 -84
- package/node_modules/jose/package.json +17 -81
- package/package.json +2 -2
- package/profiles/calendar/0.5.profile.json +190 -0
- package/profiles/charge/0.5.profile.json +210 -0
- package/profiles/customers/0.7.profile.json +157 -0
- package/profiles/deploy/0.9.profile.json +176 -0
- package/profiles/email/0.6.profile.json +208 -0
- package/profiles/index.json +9 -1
- package/profiles/publish/0.5.profile.json +186 -0
- package/profiles/purchase/0.5.profile.json +231 -0
- package/profiles/records/0.5.profile.json +117 -0
- package/dist/ui/assets/index-0Q2eNytX.js +0 -110
- package/node_modules/@modelcontextprotocol/sdk/node_modules/negotiator/HISTORY.md +0 -114
|
@@ -30,9 +30,13 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
|
+
CanonicalValueError: () => CanonicalValueError,
|
|
33
34
|
ContentBindingError: () => ContentBindingError,
|
|
35
|
+
MandateError: () => MandateError,
|
|
36
|
+
approvalSigningBytes: () => approvalSigningBytes,
|
|
34
37
|
attestationId: () => attestationId,
|
|
35
38
|
bindingAppliesTo: () => bindingAppliesTo,
|
|
39
|
+
buildMandateProjection: () => buildMandateProjection,
|
|
36
40
|
canonicalBounds: () => canonicalBounds,
|
|
37
41
|
canonicalContext: () => canonicalContext,
|
|
38
42
|
canonicalFrame: () => canonicalFrame,
|
|
@@ -49,28 +53,38 @@ __export(index_exports, {
|
|
|
49
53
|
computeIntentHash: () => computeIntentHash,
|
|
50
54
|
contentCanonicalBytes: () => contentCanonicalBytes,
|
|
51
55
|
decodeAttestationBlob: () => decodeAttestationBlob,
|
|
56
|
+
decodeDidKey: () => decodeDidKey,
|
|
52
57
|
deriveIdentityLine: () => deriveIdentityLine,
|
|
53
58
|
encodeAttestationBlob: () => encodeAttestationBlob,
|
|
59
|
+
encodeDidKey: () => encodeDidKey,
|
|
54
60
|
frameHash: () => frameHash,
|
|
55
61
|
getAllProfiles: () => getAllProfiles,
|
|
56
62
|
getProfile: () => getProfile,
|
|
57
63
|
intentDisclosureCanonicalBytes: () => intentDisclosureCanonicalBytes,
|
|
58
64
|
isFieldBinding: () => isFieldBinding,
|
|
65
|
+
isKeyBearingDid: () => isKeyBearingDid,
|
|
59
66
|
isV4Attestation: () => isV4Attestation,
|
|
60
67
|
listProfiles: () => listProfiles,
|
|
68
|
+
mandateSigningBytes: () => mandateSigningBytes,
|
|
61
69
|
registerProfile: () => registerProfile,
|
|
62
70
|
selectBoundFields: () => selectBoundFields,
|
|
71
|
+
signApproval: () => signApproval,
|
|
72
|
+
signMandateProjection: () => signMandateProjection,
|
|
63
73
|
validateBoundsParams: () => validateBoundsParams,
|
|
64
74
|
validateContextParams: () => validateContextParams,
|
|
65
75
|
validateFrameParams: () => validateFrameParams,
|
|
66
76
|
validateSubject: () => validateSubject,
|
|
67
77
|
verify: () => verify,
|
|
78
|
+
verifyApproval: () => verifyApproval,
|
|
68
79
|
verifyAttestation: () => verifyAttestation,
|
|
69
80
|
verifyAttestationSignature: () => verifyAttestationSignature,
|
|
70
81
|
verifyAttestationV4: () => verifyAttestationV4,
|
|
71
82
|
verifyBoundsHash: () => verifyBoundsHash,
|
|
72
83
|
verifyContextHash: () => verifyContextHash,
|
|
73
|
-
verifyFrameHash: () => verifyFrameHash
|
|
84
|
+
verifyFrameHash: () => verifyFrameHash,
|
|
85
|
+
verifyOwnerMandate: () => verifyOwnerMandate,
|
|
86
|
+
verifyOwnerMandates: () => verifyOwnerMandates,
|
|
87
|
+
verifyReceiptSignature: () => verifyReceiptSignature
|
|
74
88
|
});
|
|
75
89
|
module.exports = __toCommonJS(index_exports);
|
|
76
90
|
|
|
@@ -227,9 +241,9 @@ function computeIntentDisclosureHash(intentCiphertext, approversFrozen) {
|
|
|
227
241
|
}
|
|
228
242
|
|
|
229
243
|
// src/identity.ts
|
|
230
|
-
function validateSubject(subject) {
|
|
244
|
+
function validateSubject(subject, opts) {
|
|
231
245
|
const errors = [];
|
|
232
|
-
const { did, assurance, method, trust_root, verifier, disclose
|
|
246
|
+
const { did, assurance, method, trust_root, verifier, disclose } = subject;
|
|
233
247
|
if (!did) errors.push("subject.did is required");
|
|
234
248
|
if (assurance === "low") {
|
|
235
249
|
if (method !== "self_declared") errors.push(`low assurance requires method "self_declared", got "${method}"`);
|
|
@@ -242,7 +256,10 @@ function validateSubject(subject) {
|
|
|
242
256
|
} else if (method === "eudi") {
|
|
243
257
|
if (trust_root !== "external") errors.push('eudi requires trust_root "external"');
|
|
244
258
|
if (!verifier) errors.push("eudi requires a verifier");
|
|
245
|
-
if (
|
|
259
|
+
if (opts?.ownerMandates !== void 0) {
|
|
260
|
+
const entry = opts.ownerMandates.find((m) => m.did === did && m.binding === "eudi");
|
|
261
|
+
if (!entry) errors.push('eudi requires an owner_mandates entry with binding "eudi" for this DID');
|
|
262
|
+
}
|
|
246
263
|
} else {
|
|
247
264
|
errors.push(`high assurance requires method "as_vouched" or "eudi", got "${method}"`);
|
|
248
265
|
}
|
|
@@ -360,15 +377,51 @@ function validateContextParams(params, profile) {
|
|
|
360
377
|
}
|
|
361
378
|
return { valid: errors.length === 0, errors };
|
|
362
379
|
}
|
|
380
|
+
var CanonicalValueError = class extends Error {
|
|
381
|
+
code;
|
|
382
|
+
field;
|
|
383
|
+
constructor(code, field, message) {
|
|
384
|
+
super(message);
|
|
385
|
+
this.name = "CanonicalValueError";
|
|
386
|
+
this.code = code;
|
|
387
|
+
this.field = field;
|
|
388
|
+
}
|
|
389
|
+
};
|
|
390
|
+
function percentEncodeCanonicalValue(raw) {
|
|
391
|
+
const bytes = new TextEncoder().encode(raw);
|
|
392
|
+
let out = "";
|
|
393
|
+
for (const b of bytes) {
|
|
394
|
+
if (b === 61 || b === 37 || b < 32 || b > 126) {
|
|
395
|
+
out += "%" + b.toString(16).toUpperCase().padStart(2, "0");
|
|
396
|
+
} else {
|
|
397
|
+
out += String.fromCharCode(b);
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
return out;
|
|
401
|
+
}
|
|
402
|
+
function canonicalRecords(params, keyOrder, code) {
|
|
403
|
+
const lines = [];
|
|
404
|
+
for (const key of keyOrder) {
|
|
405
|
+
const value = params[key];
|
|
406
|
+
if (value === void 0 || value === null) continue;
|
|
407
|
+
const raw = String(value);
|
|
408
|
+
if (raw.includes("\n") || raw.includes("\r")) {
|
|
409
|
+
throw new CanonicalValueError(
|
|
410
|
+
code,
|
|
411
|
+
key,
|
|
412
|
+
`Value for "${key}" contains a raw newline or carriage return. Refusing: a hash over stripped or normalized input would not represent what was authorized.`
|
|
413
|
+
);
|
|
414
|
+
}
|
|
415
|
+
lines.push(`${key}=${percentEncodeCanonicalValue(raw)}`);
|
|
416
|
+
}
|
|
417
|
+
return lines.join("\n");
|
|
418
|
+
}
|
|
363
419
|
function canonicalBounds(params, profile) {
|
|
364
420
|
const validation = validateBoundsParams(params, profile);
|
|
365
421
|
if (!validation.valid) {
|
|
366
422
|
throw new Error(`Invalid bounds parameters: ${validation.errors.join("; ")}`);
|
|
367
423
|
}
|
|
368
|
-
|
|
369
|
-
(key) => `${key}=${String(params[key])}`
|
|
370
|
-
);
|
|
371
|
-
return lines.join("\n");
|
|
424
|
+
return canonicalRecords(params, profile.boundsSchema.keyOrder, "BOUNDS_INVALID_VALUE");
|
|
372
425
|
}
|
|
373
426
|
function canonicalContext(params, profile) {
|
|
374
427
|
if (!profile.contextSchema || Object.keys(profile.contextSchema.fields).length === 0) {
|
|
@@ -378,10 +431,7 @@ function canonicalContext(params, profile) {
|
|
|
378
431
|
if (!validation.valid) {
|
|
379
432
|
throw new Error(`Invalid context parameters: ${validation.errors.join("; ")}`);
|
|
380
433
|
}
|
|
381
|
-
|
|
382
|
-
(key) => `${key}=${String(params[key])}`
|
|
383
|
-
);
|
|
384
|
-
return lines.join("\n");
|
|
434
|
+
return canonicalRecords(params, profile.contextSchema.keyOrder, "CONTEXT_INVALID_VALUE");
|
|
385
435
|
}
|
|
386
436
|
function computeBoundsHash(params, profile) {
|
|
387
437
|
const canonical = canonicalBounds(params, profile);
|
|
@@ -511,7 +561,17 @@ async function verify(request, publicKeyHex, now = Math.floor(Date.now() / 1e3),
|
|
|
511
561
|
return verifyV3(request, profile, publicKeyHex, now, executionLog, errors);
|
|
512
562
|
}
|
|
513
563
|
}
|
|
564
|
+
function noAttestationSupplied(request) {
|
|
565
|
+
return !Array.isArray(request.attestations) || request.attestations.length === 0;
|
|
566
|
+
}
|
|
567
|
+
function noAttestationResult() {
|
|
568
|
+
return {
|
|
569
|
+
approved: false,
|
|
570
|
+
errors: [{ code: "MALFORMED_ATTESTATION", message: "No attestation supplied \u2014 nothing to verify" }]
|
|
571
|
+
};
|
|
572
|
+
}
|
|
514
573
|
async function verifyV3(request, profile, publicKeyHex, now, executionLog, errors) {
|
|
574
|
+
if (noAttestationSupplied(request)) return noAttestationResult();
|
|
515
575
|
let expectedFrameHash;
|
|
516
576
|
try {
|
|
517
577
|
expectedFrameHash = computeFrameHash(request.frame, profile);
|
|
@@ -572,6 +632,7 @@ async function verifyV3(request, profile, publicKeyHex, now, executionLog, error
|
|
|
572
632
|
return { approved: true };
|
|
573
633
|
}
|
|
574
634
|
async function verifyV4(request, profile, publicKeyHex, now, executionLog) {
|
|
635
|
+
if (noAttestationSupplied(request)) return noAttestationResult();
|
|
575
636
|
const errors = [];
|
|
576
637
|
const bounds = request.frame;
|
|
577
638
|
const context = request.context;
|
|
@@ -945,11 +1006,208 @@ function resolveCumulativeFields(request, profile, executionLog, now) {
|
|
|
945
1006
|
}
|
|
946
1007
|
return errors;
|
|
947
1008
|
}
|
|
1009
|
+
|
|
1010
|
+
// src/did-key.ts
|
|
1011
|
+
var B58_ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
|
|
1012
|
+
var B58_MAP = {};
|
|
1013
|
+
for (let i = 0; i < B58_ALPHABET.length; i++) B58_MAP[B58_ALPHABET[i]] = i;
|
|
1014
|
+
var ED25519_MULTICODEC = Uint8Array.from([237, 1]);
|
|
1015
|
+
var ED25519_KEY_BYTES = 32;
|
|
1016
|
+
function base58btcEncode(bytes) {
|
|
1017
|
+
let zeros = 0;
|
|
1018
|
+
while (zeros < bytes.length && bytes[zeros] === 0) zeros++;
|
|
1019
|
+
const digits = [];
|
|
1020
|
+
for (let i = zeros; i < bytes.length; i++) {
|
|
1021
|
+
let carry = bytes[i];
|
|
1022
|
+
for (let j = 0; j < digits.length; j++) {
|
|
1023
|
+
carry += digits[j] * 256;
|
|
1024
|
+
digits[j] = carry % 58;
|
|
1025
|
+
carry = carry / 58 | 0;
|
|
1026
|
+
}
|
|
1027
|
+
while (carry > 0) {
|
|
1028
|
+
digits.push(carry % 58);
|
|
1029
|
+
carry = carry / 58 | 0;
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
let out = "1".repeat(zeros);
|
|
1033
|
+
for (let i = digits.length - 1; i >= 0; i--) out += B58_ALPHABET[digits[i]];
|
|
1034
|
+
return out;
|
|
1035
|
+
}
|
|
1036
|
+
function base58btcDecode(s) {
|
|
1037
|
+
let zeros = 0;
|
|
1038
|
+
while (zeros < s.length && s[zeros] === "1") zeros++;
|
|
1039
|
+
const bytes = [];
|
|
1040
|
+
for (let i = zeros; i < s.length; i++) {
|
|
1041
|
+
const val = B58_MAP[s[i]];
|
|
1042
|
+
if (val === void 0) throw new Error(`invalid base58 character "${s[i]}"`);
|
|
1043
|
+
let carry = val;
|
|
1044
|
+
for (let j = 0; j < bytes.length; j++) {
|
|
1045
|
+
carry += bytes[j] * 58;
|
|
1046
|
+
bytes[j] = carry & 255;
|
|
1047
|
+
carry >>= 8;
|
|
1048
|
+
}
|
|
1049
|
+
while (carry > 0) {
|
|
1050
|
+
bytes.push(carry & 255);
|
|
1051
|
+
carry >>= 8;
|
|
1052
|
+
}
|
|
1053
|
+
}
|
|
1054
|
+
const out = new Uint8Array(zeros + bytes.length);
|
|
1055
|
+
for (let i = 0; i < bytes.length; i++) out[zeros + i] = bytes[bytes.length - 1 - i];
|
|
1056
|
+
return out;
|
|
1057
|
+
}
|
|
1058
|
+
function encodeDidKey(publicKey) {
|
|
1059
|
+
if (publicKey.length !== ED25519_KEY_BYTES) {
|
|
1060
|
+
throw new Error(`INVALID_KEY: expected ${ED25519_KEY_BYTES} bytes, got ${publicKey.length}`);
|
|
1061
|
+
}
|
|
1062
|
+
const prefixed = new Uint8Array(ED25519_MULTICODEC.length + publicKey.length);
|
|
1063
|
+
prefixed.set(ED25519_MULTICODEC, 0);
|
|
1064
|
+
prefixed.set(publicKey, ED25519_MULTICODEC.length);
|
|
1065
|
+
return `did:key:z${base58btcEncode(prefixed)}`;
|
|
1066
|
+
}
|
|
1067
|
+
function decodeDidKey(did) {
|
|
1068
|
+
if (!did.startsWith("did:key:z")) {
|
|
1069
|
+
throw new Error(`NOT_KEY_BEARING: ${JSON.stringify(did)} is not a base58btc did:key`);
|
|
1070
|
+
}
|
|
1071
|
+
let decoded;
|
|
1072
|
+
try {
|
|
1073
|
+
decoded = base58btcDecode(did.slice("did:key:z".length));
|
|
1074
|
+
} catch (err) {
|
|
1075
|
+
throw new Error(`NOT_KEY_BEARING: ${err.message}`);
|
|
1076
|
+
}
|
|
1077
|
+
if (decoded.length !== ED25519_MULTICODEC.length + ED25519_KEY_BYTES || decoded[0] !== ED25519_MULTICODEC[0] || decoded[1] !== ED25519_MULTICODEC[1]) {
|
|
1078
|
+
throw new Error("NOT_KEY_BEARING: not an ed25519-pub multicodec payload");
|
|
1079
|
+
}
|
|
1080
|
+
return decoded.slice(ED25519_MULTICODEC.length);
|
|
1081
|
+
}
|
|
1082
|
+
function isKeyBearingDid(did) {
|
|
1083
|
+
try {
|
|
1084
|
+
decodeDidKey(did);
|
|
1085
|
+
return true;
|
|
1086
|
+
} catch {
|
|
1087
|
+
return false;
|
|
1088
|
+
}
|
|
1089
|
+
}
|
|
1090
|
+
|
|
1091
|
+
// src/mandate.ts
|
|
1092
|
+
var ed2 = __toESM(require("@noble/ed25519"));
|
|
1093
|
+
var MandateError = class extends Error {
|
|
1094
|
+
constructor(code, message) {
|
|
1095
|
+
super(`${code}: ${message}`);
|
|
1096
|
+
this.code = code;
|
|
1097
|
+
this.name = "MandateError";
|
|
1098
|
+
}
|
|
1099
|
+
};
|
|
1100
|
+
function buildMandateProjection(payload, entry) {
|
|
1101
|
+
const { profile_id, bounds_hash, context_hash, execution_context_hash, gate_content_hashes, commitment_mode, expires_at } = payload;
|
|
1102
|
+
if (!bounds_hash || !context_hash || !commitment_mode) {
|
|
1103
|
+
throw new MandateError("MALFORMED_ATTESTATION", "mandate projection requires bounds_hash, context_hash and commitment_mode");
|
|
1104
|
+
}
|
|
1105
|
+
const projection = {
|
|
1106
|
+
typ: "HAP-mandate",
|
|
1107
|
+
version: "0.6",
|
|
1108
|
+
profile_id,
|
|
1109
|
+
owner_did: entry.did,
|
|
1110
|
+
bounds_hash,
|
|
1111
|
+
context_hash,
|
|
1112
|
+
execution_context_hash,
|
|
1113
|
+
gate_content_hashes,
|
|
1114
|
+
commitment_mode,
|
|
1115
|
+
expires_at,
|
|
1116
|
+
nonce: entry.nonce
|
|
1117
|
+
};
|
|
1118
|
+
if (payload.intent_disclosure_hash !== void 0) {
|
|
1119
|
+
projection.intent_disclosure_hash = payload.intent_disclosure_hash;
|
|
1120
|
+
}
|
|
1121
|
+
return projection;
|
|
1122
|
+
}
|
|
1123
|
+
function mandateSigningBytes(projection) {
|
|
1124
|
+
return new TextEncoder().encode(canonicalize(projection));
|
|
1125
|
+
}
|
|
1126
|
+
function approvalSigningBytes(approval) {
|
|
1127
|
+
return new TextEncoder().encode(canonicalize(approval));
|
|
1128
|
+
}
|
|
1129
|
+
function base64urlToBytes(s) {
|
|
1130
|
+
const base64 = s.replace(/-/g, "+").replace(/_/g, "/");
|
|
1131
|
+
const padding = base64.length % 4 === 0 ? "" : "=".repeat(4 - base64.length % 4);
|
|
1132
|
+
return new Uint8Array(Buffer.from(base64 + padding, "base64"));
|
|
1133
|
+
}
|
|
1134
|
+
function bytesToBase64url(bytes) {
|
|
1135
|
+
return Buffer.from(bytes).toString("base64").replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
1136
|
+
}
|
|
1137
|
+
async function signMandateProjection(projection, privateKey) {
|
|
1138
|
+
const sig = await ed2.signAsync(mandateSigningBytes(projection), privateKey);
|
|
1139
|
+
return bytesToBase64url(sig);
|
|
1140
|
+
}
|
|
1141
|
+
async function signApproval(approval, privateKey) {
|
|
1142
|
+
const sig = await ed2.signAsync(approvalSigningBytes(approval), privateKey);
|
|
1143
|
+
return bytesToBase64url(sig);
|
|
1144
|
+
}
|
|
1145
|
+
async function verifyOwnerMandate(attestation, entry) {
|
|
1146
|
+
const owners = attestation.payload.resolved_owners ?? [];
|
|
1147
|
+
if (!owners.includes(entry.did)) {
|
|
1148
|
+
throw new MandateError("OWNER_NOT_RESOLVED", `signing DID ${entry.did} is not in resolved_owners`);
|
|
1149
|
+
}
|
|
1150
|
+
if (entry.alg !== "EdDSA") {
|
|
1151
|
+
throw new MandateError("MANDATE_SIGNATURE_INVALID", `alg ${entry.alg} disagrees with the DID's key type (DID is authoritative)`);
|
|
1152
|
+
}
|
|
1153
|
+
let publicKey;
|
|
1154
|
+
try {
|
|
1155
|
+
publicKey = decodeDidKey(entry.did);
|
|
1156
|
+
} catch (err) {
|
|
1157
|
+
throw new MandateError("NOT_KEY_BEARING", err.message);
|
|
1158
|
+
}
|
|
1159
|
+
const projection = buildMandateProjection(attestation.payload, entry);
|
|
1160
|
+
const ok = await ed2.verifyAsync(base64urlToBytes(entry.signature), mandateSigningBytes(projection), publicKey);
|
|
1161
|
+
if (!ok) {
|
|
1162
|
+
throw new MandateError("MANDATE_SIGNATURE_INVALID", `owner mandate signature by ${entry.did} does not verify`);
|
|
1163
|
+
}
|
|
1164
|
+
}
|
|
1165
|
+
async function verifyOwnerMandates(attestation) {
|
|
1166
|
+
const entries = attestation.payload.owner_mandates ?? [];
|
|
1167
|
+
for (const entry of entries) {
|
|
1168
|
+
await verifyOwnerMandate(attestation, entry);
|
|
1169
|
+
}
|
|
1170
|
+
return entries;
|
|
1171
|
+
}
|
|
1172
|
+
async function verifyApproval(approval, signature, signerDid) {
|
|
1173
|
+
let publicKey;
|
|
1174
|
+
try {
|
|
1175
|
+
publicKey = decodeDidKey(signerDid);
|
|
1176
|
+
} catch (err) {
|
|
1177
|
+
throw new MandateError("NOT_KEY_BEARING", err.message);
|
|
1178
|
+
}
|
|
1179
|
+
const ok = await ed2.verifyAsync(base64urlToBytes(signature), approvalSigningBytes(approval), publicKey);
|
|
1180
|
+
if (!ok) {
|
|
1181
|
+
throw new MandateError("APPROVAL_SIGNATURE_INVALID", `approval signature by ${signerDid} does not verify`);
|
|
1182
|
+
}
|
|
1183
|
+
}
|
|
1184
|
+
|
|
1185
|
+
// src/receipt.ts
|
|
1186
|
+
var ed3 = __toESM(require("@noble/ed25519"));
|
|
1187
|
+
async function verifyReceiptSignature(receipt, publicKeyHex) {
|
|
1188
|
+
const { signature, ...unsigned } = receipt;
|
|
1189
|
+
if (!signature) {
|
|
1190
|
+
throw new Error("INVALID_SIGNATURE: receipt carries no signature");
|
|
1191
|
+
}
|
|
1192
|
+
const bytes = new TextEncoder().encode(canonicalize(unsigned));
|
|
1193
|
+
const base64 = signature.replace(/-/g, "+").replace(/_/g, "/");
|
|
1194
|
+
const padding = base64.length % 4 === 0 ? "" : "=".repeat(4 - base64.length % 4);
|
|
1195
|
+
const sigBytes = new Uint8Array(Buffer.from(base64 + padding, "base64"));
|
|
1196
|
+
const publicKeyBytes = new Uint8Array(Buffer.from(publicKeyHex, "hex"));
|
|
1197
|
+
const ok = await ed3.verifyAsync(sigBytes, bytes, publicKeyBytes).catch(() => false);
|
|
1198
|
+
if (!ok) {
|
|
1199
|
+
throw new Error("INVALID_SIGNATURE: receipt signature verification failed");
|
|
1200
|
+
}
|
|
1201
|
+
}
|
|
948
1202
|
// Annotate the CommonJS export names for ESM import in node:
|
|
949
1203
|
0 && (module.exports = {
|
|
1204
|
+
CanonicalValueError,
|
|
950
1205
|
ContentBindingError,
|
|
1206
|
+
MandateError,
|
|
1207
|
+
approvalSigningBytes,
|
|
951
1208
|
attestationId,
|
|
952
1209
|
bindingAppliesTo,
|
|
1210
|
+
buildMandateProjection,
|
|
953
1211
|
canonicalBounds,
|
|
954
1212
|
canonicalContext,
|
|
955
1213
|
canonicalFrame,
|
|
@@ -966,26 +1224,36 @@ function resolveCumulativeFields(request, profile, executionLog, now) {
|
|
|
966
1224
|
computeIntentHash,
|
|
967
1225
|
contentCanonicalBytes,
|
|
968
1226
|
decodeAttestationBlob,
|
|
1227
|
+
decodeDidKey,
|
|
969
1228
|
deriveIdentityLine,
|
|
970
1229
|
encodeAttestationBlob,
|
|
1230
|
+
encodeDidKey,
|
|
971
1231
|
frameHash,
|
|
972
1232
|
getAllProfiles,
|
|
973
1233
|
getProfile,
|
|
974
1234
|
intentDisclosureCanonicalBytes,
|
|
975
1235
|
isFieldBinding,
|
|
1236
|
+
isKeyBearingDid,
|
|
976
1237
|
isV4Attestation,
|
|
977
1238
|
listProfiles,
|
|
1239
|
+
mandateSigningBytes,
|
|
978
1240
|
registerProfile,
|
|
979
1241
|
selectBoundFields,
|
|
1242
|
+
signApproval,
|
|
1243
|
+
signMandateProjection,
|
|
980
1244
|
validateBoundsParams,
|
|
981
1245
|
validateContextParams,
|
|
982
1246
|
validateFrameParams,
|
|
983
1247
|
validateSubject,
|
|
984
1248
|
verify,
|
|
1249
|
+
verifyApproval,
|
|
985
1250
|
verifyAttestation,
|
|
986
1251
|
verifyAttestationSignature,
|
|
987
1252
|
verifyAttestationV4,
|
|
988
1253
|
verifyBoundsHash,
|
|
989
1254
|
verifyContextHash,
|
|
990
|
-
verifyFrameHash
|
|
1255
|
+
verifyFrameHash,
|
|
1256
|
+
verifyOwnerMandate,
|
|
1257
|
+
verifyOwnerMandates,
|
|
1258
|
+
verifyReceiptSignature
|
|
991
1259
|
});
|