@kya-os/mcp-i-cloudflare 1.17.0 → 1.18.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/README.md +273 -54
- package/dist/adapter.d.ts +3 -17
- package/dist/adapter.d.ts.map +1 -1
- package/dist/adapter.js +39 -477
- package/dist/adapter.js.map +1 -1
- package/dist/agent.d.ts +59 -35
- package/dist/agent.d.ts.map +1 -1
- package/dist/agent.js +386 -404
- package/dist/agent.js.map +1 -1
- package/dist/app.d.ts.map +1 -1
- package/dist/app.js +150 -94
- package/dist/app.js.map +1 -1
- package/dist/audit/deployment-binding.d.ts +16 -16
- package/dist/authority-outcome.d.ts +110 -0
- package/dist/authority-outcome.d.ts.map +1 -0
- package/dist/authority-outcome.js +154 -0
- package/dist/authority-outcome.js.map +1 -0
- package/dist/config.d.ts +8 -77
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +0 -83
- package/dist/config.js.map +1 -1
- package/dist/delegation-http/bearer-retry.d.ts +84 -32
- package/dist/delegation-http/bearer-retry.d.ts.map +1 -1
- package/dist/delegation-http/bearer-retry.js +124 -139
- package/dist/delegation-http/bearer-retry.js.map +1 -1
- package/dist/delegation-http/connect-gate.d.ts +47 -0
- package/dist/delegation-http/connect-gate.d.ts.map +1 -0
- package/dist/delegation-http/connect-gate.js +104 -0
- package/dist/delegation-http/connect-gate.js.map +1 -0
- package/dist/delegation-http/constants.d.ts +4 -49
- package/dist/delegation-http/constants.d.ts.map +1 -1
- package/dist/delegation-http/constants.js +4 -58
- package/dist/delegation-http/constants.js.map +1 -1
- package/dist/delegation-http/issuer-binding.d.ts +26 -0
- package/dist/delegation-http/issuer-binding.d.ts.map +1 -0
- package/dist/delegation-http/issuer-binding.js +51 -0
- package/dist/delegation-http/issuer-binding.js.map +1 -0
- package/dist/delegation-http/lazy-auth-gate.d.ts +88 -0
- package/dist/delegation-http/lazy-auth-gate.d.ts.map +1 -0
- package/dist/delegation-http/lazy-auth-gate.js +203 -0
- package/dist/delegation-http/lazy-auth-gate.js.map +1 -0
- package/dist/delegation-http/native-challenge.d.ts +52 -0
- package/dist/delegation-http/native-challenge.d.ts.map +1 -0
- package/dist/delegation-http/native-challenge.js +124 -0
- package/dist/delegation-http/native-challenge.js.map +1 -0
- package/dist/delegation-http/native-consent-redirect.d.ts +21 -0
- package/dist/delegation-http/native-consent-redirect.d.ts.map +1 -0
- package/dist/delegation-http/native-consent-redirect.js +43 -0
- package/dist/delegation-http/native-consent-redirect.js.map +1 -0
- package/dist/delegation-http/native-http.d.ts +1 -86
- package/dist/delegation-http/native-http.d.ts.map +1 -1
- package/dist/delegation-http/native-http.js +2 -130
- package/dist/delegation-http/native-http.js.map +1 -1
- package/dist/delegation-http/native-oauth-state-do.d.ts +13 -35
- package/dist/delegation-http/native-oauth-state-do.d.ts.map +1 -1
- package/dist/delegation-http/native-oauth-state-do.js +10 -165
- package/dist/delegation-http/native-oauth-state-do.js.map +1 -1
- package/dist/delegation-http/protected-resource.d.ts +37 -0
- package/dist/delegation-http/protected-resource.d.ts.map +1 -0
- package/dist/delegation-http/protected-resource.js +43 -0
- package/dist/delegation-http/protected-resource.js.map +1 -0
- package/dist/delegation-http/request-proof.d.ts +20 -0
- package/dist/delegation-http/request-proof.d.ts.map +1 -0
- package/dist/delegation-http/request-proof.js +29 -0
- package/dist/delegation-http/request-proof.js.map +1 -0
- package/dist/delegation-http/sid.d.ts +4 -12
- package/dist/delegation-http/sid.d.ts.map +1 -1
- package/dist/delegation-http/sid.js +4 -19
- package/dist/delegation-http/sid.js.map +1 -1
- package/dist/delegation-http/well-known-capability.d.ts +8 -12
- package/dist/delegation-http/well-known-capability.d.ts.map +1 -1
- package/dist/delegation-http/well-known-capability.js +9 -18
- package/dist/delegation-http/well-known-capability.js.map +1 -1
- package/dist/helpers/env-mapper.d.ts.map +1 -1
- package/dist/helpers/env-mapper.js +7 -29
- package/dist/helpers/env-mapper.js.map +1 -1
- package/dist/index.d.ts +2 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -8
- package/dist/index.js.map +1 -1
- package/dist/proof-generator.d.ts +24 -17
- package/dist/proof-generator.d.ts.map +1 -1
- package/dist/proof-generator.js +42 -56
- package/dist/proof-generator.js.map +1 -1
- package/dist/runtime/amount-limit-refusal.d.ts +3 -0
- package/dist/runtime/amount-limit-refusal.d.ts.map +1 -0
- package/dist/runtime/amount-limit-refusal.js +7 -0
- package/dist/runtime/amount-limit-refusal.js.map +1 -0
- package/dist/runtime/oauth-handler.d.ts +1 -1
- package/dist/runtime/oauth-handler.d.ts.map +1 -1
- package/dist/runtime/oauth-handler.js +31 -34
- package/dist/runtime/oauth-handler.js.map +1 -1
- package/dist/runtime.d.ts +34 -10
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +65 -16
- package/dist/runtime.js.map +1 -1
- package/dist/security/admission-refusal.d.ts +3 -3
- package/dist/security/admission-refusal.d.ts.map +1 -1
- package/dist/security/admission-refusal.js +14 -6
- package/dist/security/admission-refusal.js.map +1 -1
- package/dist/security/holder-binding.d.ts +34 -0
- package/dist/security/holder-binding.d.ts.map +1 -0
- package/dist/security/holder-binding.js +75 -0
- package/dist/security/holder-binding.js.map +1 -0
- package/dist/security/mcp-admission.d.ts +29 -1
- package/dist/security/mcp-admission.d.ts.map +1 -1
- package/dist/security/mcp-admission.js +78 -12
- package/dist/security/mcp-admission.js.map +1 -1
- package/dist/security/native-holder-admission.d.ts +39 -0
- package/dist/security/native-holder-admission.d.ts.map +1 -0
- package/dist/security/native-holder-admission.js +65 -0
- package/dist/security/native-holder-admission.js.map +1 -0
- package/dist/security/outcome-proof.d.ts +39 -0
- package/dist/security/outcome-proof.d.ts.map +1 -0
- package/dist/security/outcome-proof.js +54 -0
- package/dist/security/outcome-proof.js.map +1 -0
- package/dist/security/request-nonce-store.d.ts +43 -0
- package/dist/security/request-nonce-store.d.ts.map +1 -0
- package/dist/security/request-nonce-store.js +129 -0
- package/dist/security/request-nonce-store.js.map +1 -0
- package/dist/security/routed-request.d.ts +41 -0
- package/dist/security/routed-request.d.ts.map +1 -0
- package/dist/security/routed-request.js +86 -0
- package/dist/security/routed-request.js.map +1 -0
- package/dist/security/sign-in-amr.d.ts +23 -0
- package/dist/security/sign-in-amr.d.ts.map +1 -0
- package/dist/security/sign-in-amr.js +44 -0
- package/dist/security/sign-in-amr.js.map +1 -0
- package/dist/services/approval-route.d.ts +3 -2
- package/dist/services/approval-route.d.ts.map +1 -1
- package/dist/services/approval-route.js.map +1 -1
- package/dist/services/checkpoint-decision.d.ts +56 -0
- package/dist/services/checkpoint-decision.d.ts.map +1 -0
- package/dist/services/checkpoint-decision.js +109 -0
- package/dist/services/checkpoint-decision.js.map +1 -0
- package/dist/services/consent-page-renderer.d.ts.map +1 -1
- package/dist/services/consent-page-renderer.js +2 -3
- package/dist/services/consent-page-renderer.js.map +1 -1
- package/dist/services/consent.service.d.ts +11 -49
- package/dist/services/consent.service.d.ts.map +1 -1
- package/dist/services/consent.service.js +81 -307
- package/dist/services/consent.service.js.map +1 -1
- package/dist/services/credential-auth.handler.d.ts.map +1 -1
- package/dist/services/credential-auth.handler.js +2 -8
- package/dist/services/credential-auth.handler.js.map +1 -1
- package/dist/services/delegation-authority.d.ts +53 -0
- package/dist/services/delegation-authority.d.ts.map +1 -0
- package/dist/services/delegation-authority.js +130 -0
- package/dist/services/delegation-authority.js.map +1 -0
- package/dist/services/delegation-trust.d.ts +35 -64
- package/dist/services/delegation-trust.d.ts.map +1 -1
- package/dist/services/delegation-trust.js +98 -279
- package/dist/services/delegation-trust.js.map +1 -1
- package/dist/services/delegation.service.d.ts +83 -105
- package/dist/services/delegation.service.d.ts.map +1 -1
- package/dist/services/delegation.service.js +166 -518
- package/dist/services/delegation.service.js.map +1 -1
- package/dist/services/idp-token-storage.d.ts +32 -12
- package/dist/services/idp-token-storage.d.ts.map +1 -1
- package/dist/services/idp-token-storage.js +79 -36
- package/dist/services/idp-token-storage.js.map +1 -1
- package/dist/services/issuer-keys.d.ts +55 -0
- package/dist/services/issuer-keys.d.ts.map +1 -0
- package/dist/services/issuer-keys.js +184 -0
- package/dist/services/issuer-keys.js.map +1 -0
- package/dist/services/oauth-security.service.d.ts +17 -1
- package/dist/services/oauth-security.service.d.ts.map +1 -1
- package/dist/services/oauth-security.service.js +29 -10
- package/dist/services/oauth-security.service.js.map +1 -1
- package/dist/services/proof.service.d.ts +10 -0
- package/dist/services/proof.service.d.ts.map +1 -1
- package/dist/services/proof.service.js +28 -6
- package/dist/services/proof.service.js.map +1 -1
- package/dist/services/resource-audience.d.ts +12 -9
- package/dist/services/resource-audience.d.ts.map +1 -1
- package/dist/services/resource-audience.js +12 -9
- package/dist/services/resource-audience.js.map +1 -1
- package/dist/services/unenforceable-tool-protection.d.ts +32 -0
- package/dist/services/unenforceable-tool-protection.d.ts.map +1 -0
- package/dist/services/unenforceable-tool-protection.js +90 -0
- package/dist/services/unenforceable-tool-protection.js.map +1 -0
- package/dist/services/upstream-fetch.d.ts +14 -0
- package/dist/services/upstream-fetch.d.ts.map +1 -0
- package/dist/services/upstream-fetch.js +56 -0
- package/dist/services/upstream-fetch.js.map +1 -0
- package/dist/types.d.ts +5 -18
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/oauth-profile.d.ts +19 -0
- package/dist/utils/oauth-profile.d.ts.map +1 -1
- package/dist/utils/oauth-profile.js +54 -1
- package/dist/utils/oauth-profile.js.map +1 -1
- package/dist/utils/tool-security-schemes.d.ts +65 -0
- package/dist/utils/tool-security-schemes.d.ts.map +1 -0
- package/dist/utils/tool-security-schemes.js +168 -0
- package/dist/utils/tool-security-schemes.js.map +1 -0
- package/package.json +5 -6
- package/dist/delegation-http/anchor-do.d.ts +0 -84
- package/dist/delegation-http/anchor-do.d.ts.map +0 -1
- package/dist/delegation-http/anchor-do.js +0 -412
- package/dist/delegation-http/anchor-do.js.map +0 -1
- package/dist/delegation-http/anchor-registration-validate.d.ts +0 -61
- package/dist/delegation-http/anchor-registration-validate.d.ts.map +0 -1
- package/dist/delegation-http/anchor-registration-validate.js +0 -191
- package/dist/delegation-http/anchor-registration-validate.js.map +0 -1
- package/dist/delegation-http/anchor-registration.d.ts +0 -62
- package/dist/delegation-http/anchor-registration.d.ts.map +0 -1
- package/dist/delegation-http/anchor-registration.js +0 -337
- package/dist/delegation-http/anchor-registration.js.map +0 -1
- package/dist/delegation-http/anchor-routing.d.ts +0 -20
- package/dist/delegation-http/anchor-routing.d.ts.map +0 -1
- package/dist/delegation-http/anchor-routing.js +0 -27
- package/dist/delegation-http/anchor-routing.js.map +0 -1
- package/dist/delegation-http/challenge-middleware.d.ts +0 -28
- package/dist/delegation-http/challenge-middleware.d.ts.map +0 -1
- package/dist/delegation-http/challenge-middleware.js +0 -190
- package/dist/delegation-http/challenge-middleware.js.map +0 -1
- package/dist/delegation-http/challenge.d.ts +0 -102
- package/dist/delegation-http/challenge.d.ts.map +0 -1
- package/dist/delegation-http/challenge.js +0 -223
- package/dist/delegation-http/challenge.js.map +0 -1
- package/dist/delegation-http/consent-anchor-bridge.d.ts +0 -70
- package/dist/delegation-http/consent-anchor-bridge.d.ts.map +0 -1
- package/dist/delegation-http/consent-anchor-bridge.js +0 -1130
- package/dist/delegation-http/consent-anchor-bridge.js.map +0 -1
- package/dist/delegation-http/consent-preparation-page.d.ts +0 -18
- package/dist/delegation-http/consent-preparation-page.d.ts.map +0 -1
- package/dist/delegation-http/consent-preparation-page.js +0 -172
- package/dist/delegation-http/consent-preparation-page.js.map +0 -1
- package/dist/delegation-http/credential-consent.d.ts +0 -149
- package/dist/delegation-http/credential-consent.d.ts.map +0 -1
- package/dist/delegation-http/credential-consent.js +0 -338
- package/dist/delegation-http/credential-consent.js.map +0 -1
- package/dist/delegation-http/native-capabilities.d.ts +0 -4
- package/dist/delegation-http/native-capabilities.d.ts.map +0 -1
- package/dist/delegation-http/native-capabilities.js +0 -53
- package/dist/delegation-http/native-capabilities.js.map +0 -1
- package/dist/delegation-http/native-oauth-state.d.ts +0 -28
- package/dist/delegation-http/native-oauth-state.d.ts.map +0 -1
- package/dist/delegation-http/native-oauth-state.js +0 -146
- package/dist/delegation-http/native-oauth-state.js.map +0 -1
- package/dist/delegation-http/native-oauth.d.ts +0 -26
- package/dist/delegation-http/native-oauth.d.ts.map +0 -1
- package/dist/delegation-http/native-oauth.js +0 -393
- package/dist/delegation-http/native-oauth.js.map +0 -1
- package/dist/delegation-http/native-pickup.d.ts +0 -20
- package/dist/delegation-http/native-pickup.d.ts.map +0 -1
- package/dist/delegation-http/native-pickup.js +0 -227
- package/dist/delegation-http/native-pickup.js.map +0 -1
- package/dist/delegation-http/pickup-routes.d.ts +0 -43
- package/dist/delegation-http/pickup-routes.d.ts.map +0 -1
- package/dist/delegation-http/pickup-routes.js +0 -166
- package/dist/delegation-http/pickup-routes.js.map +0 -1
- package/dist/delegation-http/register.d.ts +0 -26
- package/dist/delegation-http/register.d.ts.map +0 -1
- package/dist/delegation-http/register.js +0 -95
- package/dist/delegation-http/register.js.map +0 -1
- package/dist/delegation-http/registrar-auth.d.ts +0 -24
- package/dist/delegation-http/registrar-auth.d.ts.map +0 -1
- package/dist/delegation-http/registrar-auth.js +0 -61
- package/dist/delegation-http/registrar-auth.js.map +0 -1
- package/dist/delegation-http/remote-issuer.d.ts +0 -52
- package/dist/delegation-http/remote-issuer.d.ts.map +0 -1
- package/dist/delegation-http/remote-issuer.js +0 -324
- package/dist/delegation-http/remote-issuer.js.map +0 -1
- package/dist/delegation-http/types.d.ts +0 -116
- package/dist/delegation-http/types.d.ts.map +0 -1
- package/dist/delegation-http/types.js +0 -11
- package/dist/delegation-http/types.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credential-auth.handler.d.ts","sourceRoot":"","sources":["../../src/services/credential-auth.handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AAEzE;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,uCAAuC;IACvC,OAAO,EAAE,OAAO,CAAC;IACjB,gEAAgE;IAChE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iDAAiD;IACjD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oDAAoD;IACpD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2DAA2D;IAC3D,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,6CAA6C;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,+BAA+B;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,6EAA6E;IAC7E,sBAAsB,CAAC,EAAE,IAAI,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC;;;;;;OAMG;IACH,YAAY,CACV,QAAQ,EAAE,wBAAwB,EAClC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAClC,OAAO,CAAC,oBAAoB,CAAC,CAAC;CAClC;AAED;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C,8CAA8C;IAC9C,KAAK,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;IAC/B,+CAA+C;IAC/C,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;CACpD;AAED;;;;;GAKG;AACH,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,2BAA2B,GAClC,sBAAsB,
|
|
1
|
+
{"version":3,"file":"credential-auth.handler.d.ts","sourceRoot":"","sources":["../../src/services/credential-auth.handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AAEzE;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,uCAAuC;IACvC,OAAO,EAAE,OAAO,CAAC;IACjB,gEAAgE;IAChE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iDAAiD;IACjD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oDAAoD;IACpD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2DAA2D;IAC3D,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,6CAA6C;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,+BAA+B;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,6EAA6E;IAC7E,sBAAsB,CAAC,EAAE,IAAI,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC;;;;;;OAMG;IACH,YAAY,CACV,QAAQ,EAAE,wBAAwB,EAClC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAClC,OAAO,CAAC,oBAAoB,CAAC,CAAC;CAClC;AAED;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C,8CAA8C;IAC9C,KAAK,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;IAC/B,+CAA+C;IAC/C,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;CACpD;AAED;;;;;GAKG;AACH,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,2BAA2B,GAClC,sBAAsB,CAoSxB;AAED;;;;;;;;;;GAUG;AACH,iBAAS,cAAc,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAiBtE;AAGD,OAAO,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -90,17 +90,11 @@ export function createCredentialAuthHandler(config) {
|
|
|
90
90
|
}
|
|
91
91
|
// 2. Call auth endpoint
|
|
92
92
|
try {
|
|
93
|
-
//
|
|
94
|
-
|
|
95
|
-
for (const [key, value] of Object.entries(requestBody)) {
|
|
96
|
-
debugBody[key] = key.toLowerCase().includes("password")
|
|
97
|
-
? `***${value.length} chars***`
|
|
98
|
-
: value;
|
|
99
|
-
}
|
|
93
|
+
// Field names only: the values carry the username or email, and
|
|
94
|
+
// the password.
|
|
100
95
|
logger("[CredentialAuthHandler] Calling auth endpoint", {
|
|
101
96
|
endpoint: provider.authEndpoint,
|
|
102
97
|
bodyKeys: Object.keys(requestBody),
|
|
103
|
-
body: debugBody,
|
|
104
98
|
});
|
|
105
99
|
const response = await config.fetch(provider.authEndpoint, {
|
|
106
100
|
method: "POST",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credential-auth.handler.js","sourceRoot":"","sources":["../../src/services/credential-auth.handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAqDH;;;;;GAKG;AACH,MAAM,UAAU,2BAA2B,CACzC,MAAmC;IAEnC,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,IAAI,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;IAE3C;;;;;;OAMG;IACH,SAAS,sBAAsB,CAC7B,WAAmC,EACnC,SAAiB;QAEjB,oBAAoB;QACpB,IAAI,WAAW,CAAC,SAAS,CAAC,KAAK,SAAS;YAAE,OAAO,WAAW,CAAC,SAAS,CAAC,CAAC;QAExE,MAAM,UAAU,GAAG,SAAS,CAAC,WAAW,EAAE,CAAC;QAE3C,wBAAwB;QACxB,MAAM,eAAe,GAAG;YACtB,UAAU;YACV,OAAO;YACP,YAAY;YACZ,UAAU;YACV,OAAO;YACP,MAAM;YACN,QAAQ;SACA,CAAC;QAEX,wBAAwB;QACxB,MAAM,eAAe,GAAG,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,CAAU,CAAC;QAEvE,IACE,eAAe,CAAC,QAAQ,CAAC,UAA8C,CAAC,EACxE,CAAC;YACD,4CAA4C;YAC5C,OAAO,CACL,WAAW,CAAC,QAAQ;gBACpB,WAAW,CAAC,KAAK;gBACjB,WAAW,CAAC,UAAU;gBACtB,WAAW,CAAC,QAAQ;gBACpB,WAAW,CAAC,KAAK;gBACjB,WAAW,CAAC,IAAI;g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BAAM,CAAC;oBACN,gCAAgC;oBAChC,WAAW,CAAC,YAAY,CAAC,GAAG,QAAQ,CAAC;gBACvC,CAAC;YACH,CAAC;YAED,wBAAwB;YACxB,IAAI,CAAC;gBACH,
|
|
1
|
+
{"version":3,"file":"credential-auth.handler.js","sourceRoot":"","sources":["../../src/services/credential-auth.handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAqDH;;;;;GAKG;AACH,MAAM,UAAU,2BAA2B,CACzC,MAAmC;IAEnC,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,IAAI,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;IAE3C;;;;;;OAMG;IACH,SAAS,sBAAsB,CAC7B,WAAmC,EACnC,SAAiB;QAEjB,oBAAoB;QACpB,IAAI,WAAW,CAAC,SAAS,CAAC,KAAK,SAAS;YAAE,OAAO,WAAW,CAAC,SAAS,CAAC,CAAC;QAExE,MAAM,UAAU,GAAG,SAAS,CAAC,WAAW,EAAE,CAAC;QAE3C,wBAAwB;QACxB,MAAM,eAAe,GAAG;YACtB,UAAU;YACV,OAAO;YACP,YAAY;YACZ,UAAU;YACV,OAAO;YACP,MAAM;YACN,QAAQ;SACA,CAAC;QAEX,wBAAwB;QACxB,MAAM,eAAe,GAAG,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,CAAU,CAAC;QAEvE,IACE,eAAe,CAAC,QAAQ,CAAC,UAA8C,CAAC,EACxE,CAAC;YACD,4CAA4C;YAC5C,OAAO,CACL,WAAW,CAAC,QAAQ;gBACpB,WAAW,CAAC,KAAK;gBACjB,WAAW,CAAC,UAAU;gBACtB,WAAW,CAAC,QAAQ;gBACpB,WAAW,CAAC,KAAK;gBACjB,WAAW,CAAC,IAAI;gBAChB,WAAW,CAAC,MAAM,CACnB,CAAC;QACJ,CAAC;QAED,IACE,eAAe,CAAC,QAAQ,CAAC,UAA8C,CAAC,EACxE,CAAC;YACD,OAAO,CACL,WAAW,CAAC,Q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,IAAI,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC9C,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AACjE,CAAC;AAED,oCAAoC;AACpC,OAAO,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The runtime's delegation verifier, answered locally.
|
|
3
|
+
*
|
|
4
|
+
* `MCPIRuntimeBase` asks its injected verifier (`verifyDelegation`) whether a
|
|
5
|
+
* protected tool call's delegation is good. This verifier answers from the
|
|
6
|
+
* credential itself (`DelegationService.verifyLocally`), checks the call's
|
|
7
|
+
* required scopes against what the issuer signed, then consults the optional
|
|
8
|
+
* Checkpoint decision hook. Checkpoint's verify endpoint is never the
|
|
9
|
+
* authority: it is asked only once local verification has passed, and it can
|
|
10
|
+
* refuse only for a stateful reason (see ./checkpoint-decision).
|
|
11
|
+
*
|
|
12
|
+
* It extends `AccessControlApiService` so the runtime and the proof service
|
|
13
|
+
* keep one injected client: proof submission and configuration fetches still
|
|
14
|
+
* go to Checkpoint with the deployment's API key.
|
|
15
|
+
*/
|
|
16
|
+
import { AccessControlApiService, type AccessControlApiServiceConfig } from "@kya-os/mcp-i-runtime";
|
|
17
|
+
import type { VerifyDelegationAPIResponse, VerifyDelegationRequest } from "@kya-os/contracts/checkpoint-api";
|
|
18
|
+
import { type DIDResolver } from "@kya-os/mcp";
|
|
19
|
+
import type { CloudflareEnv } from "../types";
|
|
20
|
+
/**
|
|
21
|
+
* Where a tool call collects the scopes of a presented grant the verifier
|
|
22
|
+
* found genuine but too narrow for the call. The call's needs_authorization
|
|
23
|
+
* challenge names them with the required scopes, so the new grant keeps what
|
|
24
|
+
* the old one held (MCP scope challenge handling).
|
|
25
|
+
*/
|
|
26
|
+
export interface NarrowGrant {
|
|
27
|
+
scopes?: readonly string[];
|
|
28
|
+
}
|
|
29
|
+
/** Run `fn` with `slot` collecting the narrow grant of the call it makes. */
|
|
30
|
+
export declare function collectNarrowGrant<T>(slot: NarrowGrant, fn: () => T): T;
|
|
31
|
+
/** Record a verified grant's scopes as too narrow; a no-op outside a call. */
|
|
32
|
+
export declare function noteNarrowGrant(scopes: readonly string[]): void;
|
|
33
|
+
export declare class LocalDelegationAuthority extends AccessControlApiService {
|
|
34
|
+
private readonly env;
|
|
35
|
+
private readonly didResolver?;
|
|
36
|
+
/**
|
|
37
|
+
* @param env - Deployment configuration: trust, resources, the Checkpoint
|
|
38
|
+
* hook. It alone decides which issuers are trusted.
|
|
39
|
+
* @param checkpoint - The Checkpoint client configuration (proofs, hook)
|
|
40
|
+
* @param didResolver - DID resolution seam; defaults to the shared resolver
|
|
41
|
+
*/
|
|
42
|
+
constructor(env: CloudflareEnv, checkpoint: AccessControlApiServiceConfig, didResolver?: DIDResolver | undefined);
|
|
43
|
+
/**
|
|
44
|
+
* Verify the presented delegation locally, check the required scopes, then
|
|
45
|
+
* ask the optional decision hook. The answer has the Checkpoint response
|
|
46
|
+
* shape the runtime expects.
|
|
47
|
+
*/
|
|
48
|
+
verifyDelegation(request: VerifyDelegationRequest, context?: {
|
|
49
|
+
delegationToken?: string;
|
|
50
|
+
credentialJwt?: string;
|
|
51
|
+
}): Promise<VerifyDelegationAPIResponse>;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=delegation-authority.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delegation-authority.d.ts","sourceRoot":"","sources":["../../src/services/delegation-authority.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EACL,uBAAuB,EACvB,KAAK,6BAA6B,EAGnC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAEV,2BAA2B,EAC3B,uBAAuB,EACxB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAGL,KAAK,WAAW,EACjB,MAAM,aAAa,CAAC;AAGrB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAU9C;;;;;GAKG;AACH,MAAM,WAAW,WAAW;IAC1B,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC5B;AAID,6EAA6E;AAC7E,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,CAEvE;AAED,8EAA8E;AAC9E,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,CAG/D;AA4CD,qBAAa,wBAAyB,SAAQ,uBAAuB;IAQjE,OAAO,CAAC,QAAQ,CAAC,GAAG;IAEpB,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC;IAT/B;;;;;OAKG;gBAEgB,GAAG,EAAE,aAAa,EACnC,UAAU,EAAE,6BAA6B,EACxB,WAAW,CAAC,EAAE,WAAW,YAAA;IAK5C;;;;OAIG;IACY,gBAAgB,CAC7B,OAAO,EAAE,uBAAuB,EAChC,OAAO,CAAC,EAAE;QAAE,eAAe,CAAC,EAAE,MAAM,CAAC;QAAC,aAAa,CAAC,EAAE,MAAM,CAAA;KAAE,GAC7D,OAAO,CAAC,2BAA2B,CAAC;CA+DxC"}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The runtime's delegation verifier, answered locally.
|
|
3
|
+
*
|
|
4
|
+
* `MCPIRuntimeBase` asks its injected verifier (`verifyDelegation`) whether a
|
|
5
|
+
* protected tool call's delegation is good. This verifier answers from the
|
|
6
|
+
* credential itself (`DelegationService.verifyLocally`), checks the call's
|
|
7
|
+
* required scopes against what the issuer signed, then consults the optional
|
|
8
|
+
* Checkpoint decision hook. Checkpoint's verify endpoint is never the
|
|
9
|
+
* authority: it is asked only once local verification has passed, and it can
|
|
10
|
+
* refuse only for a stateful reason (see ./checkpoint-decision).
|
|
11
|
+
*
|
|
12
|
+
* It extends `AccessControlApiService` so the runtime and the proof service
|
|
13
|
+
* keep one injected client: proof submission and configuration fetches still
|
|
14
|
+
* go to Checkpoint with the deployment's API key.
|
|
15
|
+
*/
|
|
16
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
17
|
+
import { AccessControlApiService, namesRequiredScope, TOOL_PROTECTION_UNENFORCEABLE, } from "@kya-os/mcp-i-runtime";
|
|
18
|
+
import { scopeSatisfies, } from "@kya-os/mcp";
|
|
19
|
+
import { getMcpRequestHolder } from "../security/mcp-admission";
|
|
20
|
+
import { getRoutedHost } from "../security/routed-request";
|
|
21
|
+
import { askCheckpointDecision, } from "./checkpoint-decision";
|
|
22
|
+
import { createDeploymentDelegationService, } from "./delegation.service";
|
|
23
|
+
const narrowGrants = new AsyncLocalStorage();
|
|
24
|
+
/** Run `fn` with `slot` collecting the narrow grant of the call it makes. */
|
|
25
|
+
export function collectNarrowGrant(slot, fn) {
|
|
26
|
+
return narrowGrants.run(slot, fn);
|
|
27
|
+
}
|
|
28
|
+
/** Record a verified grant's scopes as too narrow; a no-op outside a call. */
|
|
29
|
+
export function noteNarrowGrant(scopes) {
|
|
30
|
+
const slot = narrowGrants.getStore();
|
|
31
|
+
if (slot)
|
|
32
|
+
slot.scopes = Object.freeze([...scopes]);
|
|
33
|
+
}
|
|
34
|
+
const UUID_PATTERN = /^(?:urn:uuid:)?([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})$/i;
|
|
35
|
+
/** The delegation's UUID (the id Checkpoint records), from a bare or `urn:uuid:` id. */
|
|
36
|
+
function delegationUuid(id) {
|
|
37
|
+
return id ? UUID_PATTERN.exec(id)?.[1] : undefined;
|
|
38
|
+
}
|
|
39
|
+
function refused(code, message) {
|
|
40
|
+
return {
|
|
41
|
+
success: true,
|
|
42
|
+
data: { valid: false, reason: code, error: { code, message } },
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* What the runtime reads from an accepted grant, taken from the verified
|
|
47
|
+
* credential. Only what the issuer signed is reported, plus the sign-in
|
|
48
|
+
* method when Checkpoint's decision vouched for it. Fields the credential
|
|
49
|
+
* does not carry (a user, a sign-in method) are left out rather than
|
|
50
|
+
* invented; the cast is there only because Checkpoint's record type marks
|
|
51
|
+
* them required.
|
|
52
|
+
*/
|
|
53
|
+
function acceptedCredential(local, scopes, facts) {
|
|
54
|
+
const issuedAt = local.issuedAt ?? Math.floor(Date.now() / 1000);
|
|
55
|
+
const credential = {
|
|
56
|
+
agent_did: local.agentDid,
|
|
57
|
+
...(local.userDid ? { user_did: local.userDid } : {}),
|
|
58
|
+
...(local.userIdentifier ? { user_identifier: local.userIdentifier } : {}),
|
|
59
|
+
scopes,
|
|
60
|
+
...(local.constraints ? { constraints: local.constraints } : {}),
|
|
61
|
+
issued_at: issuedAt,
|
|
62
|
+
created_at: issuedAt,
|
|
63
|
+
...(facts.authorization ? { authorization: facts.authorization } : {}),
|
|
64
|
+
};
|
|
65
|
+
return credential;
|
|
66
|
+
}
|
|
67
|
+
export class LocalDelegationAuthority extends AccessControlApiService {
|
|
68
|
+
env;
|
|
69
|
+
didResolver;
|
|
70
|
+
/**
|
|
71
|
+
* @param env - Deployment configuration: trust, resources, the Checkpoint
|
|
72
|
+
* hook. It alone decides which issuers are trusted.
|
|
73
|
+
* @param checkpoint - The Checkpoint client configuration (proofs, hook)
|
|
74
|
+
* @param didResolver - DID resolution seam; defaults to the shared resolver
|
|
75
|
+
*/
|
|
76
|
+
constructor(env, checkpoint, didResolver) {
|
|
77
|
+
super(checkpoint);
|
|
78
|
+
this.env = env;
|
|
79
|
+
this.didResolver = didResolver;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Verify the presented delegation locally, check the required scopes, then
|
|
83
|
+
* ask the optional decision hook. The answer has the Checkpoint response
|
|
84
|
+
* shape the runtime expects.
|
|
85
|
+
*/
|
|
86
|
+
async verifyDelegation(request, context) {
|
|
87
|
+
// A legacy consent proof is a credential too, verified the same way.
|
|
88
|
+
const token = request.delegation_token ??
|
|
89
|
+
context?.delegationToken ??
|
|
90
|
+
request.credential_jwt ??
|
|
91
|
+
context?.credentialJwt;
|
|
92
|
+
if (!token)
|
|
93
|
+
return refused("delegation_not_found", "No delegation was presented");
|
|
94
|
+
// The audience is did:web:<the host this call was routed for>
|
|
95
|
+
// (security/routed-request); no routed host, no acceptance. A
|
|
96
|
+
// holder-bound credential needs the holder admission proved for this call.
|
|
97
|
+
const local = await createDeploymentDelegationService(this.env, getRoutedHost(), this.didResolver).verifyLocally(token, { holderDid: getMcpRequestHolder()?.did });
|
|
98
|
+
if (!local.valid || !local.agentDid || !local.credential)
|
|
99
|
+
return refused(local.code ?? "invalid_token", local.error ?? "Delegation refused");
|
|
100
|
+
const required = request.scopes ?? [];
|
|
101
|
+
// No required scope, nothing to check the grant against: refused, never
|
|
102
|
+
// accepted as satisfied. The runtime refuses such a tool before asking.
|
|
103
|
+
if (!namesRequiredScope(required))
|
|
104
|
+
return refused(TOOL_PROTECTION_UNENFORCEABLE, "The call names no required scope to check the delegation against");
|
|
105
|
+
const credential = local.credential;
|
|
106
|
+
if (!required.every((scope) => scopeSatisfies(scope, credential).satisfied)) {
|
|
107
|
+
noteNarrowGrant(local.scopes ?? []);
|
|
108
|
+
return refused("insufficient_scopes", "Delegation does not grant all required scopes");
|
|
109
|
+
}
|
|
110
|
+
const decision = await askCheckpointDecision(this.env, {
|
|
111
|
+
token,
|
|
112
|
+
agentDid: local.agentDid,
|
|
113
|
+
scopes: required,
|
|
114
|
+
userDid: local.userDid,
|
|
115
|
+
});
|
|
116
|
+
if (decision && !decision.allowed)
|
|
117
|
+
return refused(decision.code, "Checkpoint refused the delegation");
|
|
118
|
+
const grantScopes = [...new Set([...(local.scopes ?? []), ...required])];
|
|
119
|
+
const delegationId = delegationUuid(local.delegationId);
|
|
120
|
+
return {
|
|
121
|
+
success: true,
|
|
122
|
+
data: {
|
|
123
|
+
valid: true,
|
|
124
|
+
...(delegationId ? { delegation_id: delegationId } : {}),
|
|
125
|
+
credential: acceptedCredential(local, grantScopes, decision ?? {}),
|
|
126
|
+
},
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
//# sourceMappingURL=delegation-authority.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delegation-authority.js","sourceRoot":"","sources":["../../src/services/delegation-authority.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EACL,uBAAuB,EAEvB,kBAAkB,EAClB,6BAA6B,GAC9B,MAAM,uBAAuB,CAAC;AAM/B,OAAO,EACL,cAAc,GAGf,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D,OAAO,EACL,qBAAqB,GAEtB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,iCAAiC,GAElC,MAAM,sBAAsB,CAAC;AAY9B,MAAM,YAAY,GAAG,IAAI,iBAAiB,EAAe,CAAC;AAE1D,6EAA6E;AAC7E,MAAM,UAAU,kBAAkB,CAAI,IAAiB,EAAE,EAAW;IAClE,OAAO,YAAY,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;AACpC,CAAC;AAED,8EAA8E;AAC9E,MAAM,UAAU,eAAe,CAAC,MAAyB;IACvD,MAAM,IAAI,GAAG,YAAY,CAAC,QAAQ,EAAE,CAAC;IACrC,IAAI,IAAI;QAAE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC;AACrD,CAAC;AAED,MAAM,YAAY,GAChB,iFAAiF,CAAC;AAEpF,wFAAwF;AACxF,SAAS,cAA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
-
* audience they must name,
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* audience they must name, and whether their status entry is clear.
|
|
6
|
+
* `DelegationService` applies it before any verdict is reached; nothing it
|
|
7
|
+
* decides is ever delegated to Checkpoint.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* -
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
9
|
+
* Trusted issuers (the org that owns this resource), from the deployment's
|
|
10
|
+
* environment only:
|
|
11
|
+
* - the native issuer binding's org DID (`MCPI_NATIVE_HTTP_ISSUER_CONFIG`);
|
|
12
|
+
* - `KYA_OS_TRUSTED_DELEGATION_ISSUERS`, for a worker without a binding.
|
|
13
|
+
* `options.trustedIssuers` lets a caller restate an issuer it already holds
|
|
14
|
+
* (the edge's bearer check passes the binding's); nothing in the runtime
|
|
15
|
+
* configuration adds one. Neither the worker's identity
|
|
16
|
+
* (`MCP_IDENTITY_AGENT_DID`) nor any of its resource DIDs is ever an issuer:
|
|
17
|
+
* authority comes from the org.
|
|
18
18
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
19
|
+
* Audience: the resource the request was routed for (./resource-audience).
|
|
20
|
+
* `aud` must be exactly `did:web:<the routed host>`, listed in
|
|
21
|
+
* `KYA_OS_RESOURCE_DIDS`, and so must the inner
|
|
22
|
+
* `delegation.constraints.audience` when present. The routed host is passed
|
|
23
|
+
* in by the caller from what the edge delivered: the request URL in the
|
|
24
|
+
* worker, the worker-set `X-MCP-Original-Origin` in the Durable Object.
|
|
25
|
+
* Never the org DID; unset, empty or malformed configuration, an unlisted
|
|
26
|
+
* host or no routed host accepts nothing.
|
|
22
27
|
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* expected `aud` is `did:web:<the request's own Host>`, and it must be in that
|
|
27
|
-
* list: a token for one host is refused at another. The host comes from the
|
|
28
|
-
* request URL the edge delivered (WfP dispatch forwards the original request),
|
|
29
|
-
* never from a forwarding header. Never the org DID, the worker's own identity
|
|
30
|
-
* or a project id. Unset, empty or malformed configuration accepts nothing.
|
|
28
|
+
* Status: every credential carries a status entry. The list it points at is
|
|
29
|
+
* fetched from that pointer, its signature verified against the issuer's DID
|
|
30
|
+
* document, and any failure is "unresolvable", never "clear".
|
|
31
31
|
*/
|
|
32
|
-
import { type
|
|
32
|
+
import { type DIDResolver } from "@kya-os/mcp";
|
|
33
33
|
import type { CloudflareEnv } from "../types";
|
|
34
34
|
import { type AudienceVerdict, type ResourceRefusal } from "./resource-audience";
|
|
35
35
|
/** Trust inputs a caller holds beyond the environment (e.g. a native issuer). */
|
|
@@ -37,9 +37,10 @@ export interface DelegationTrustOptions {
|
|
|
37
37
|
/** Issuer DIDs to pin in addition to the environment-derived set. */
|
|
38
38
|
trustedIssuers?: readonly (string | undefined)[];
|
|
39
39
|
/**
|
|
40
|
-
* The host this request was routed for
|
|
41
|
-
*
|
|
42
|
-
*
|
|
40
|
+
* The host this request was routed for, from what the edge delivered: the
|
|
41
|
+
* request URL's host in the worker, the worker-set `X-MCP-Original-Origin`
|
|
42
|
+
* in the Durable Object. Never a client-controllable forwarding header.
|
|
43
|
+
* Without it no `aud` is accepted.
|
|
43
44
|
*/
|
|
44
45
|
routedHost?: string;
|
|
45
46
|
}
|
|
@@ -49,14 +50,6 @@ export interface DelegationTrust {
|
|
|
49
50
|
readonly resourceDid?: string;
|
|
50
51
|
/** Why `resourceDid` is unset: every credential is refused. */
|
|
51
52
|
readonly resourceRefusal?: ResourceRefusal;
|
|
52
|
-
/** The worker's own identity: a pinned issuer, never an audience. */
|
|
53
|
-
readonly ownDid?: string;
|
|
54
|
-
/** Origin whose `/.well-known/did.json` names the Checkpoint platform signer. */
|
|
55
|
-
readonly checkpointOrigin?: string;
|
|
56
|
-
}
|
|
57
|
-
/** DID resolution plus the configured Checkpoint origin's own DID document. */
|
|
58
|
-
export interface DelegationDidResolver extends DIDResolver {
|
|
59
|
-
checkpointIdentity(origin: string): Promise<DIDDocument | null>;
|
|
60
53
|
}
|
|
61
54
|
export type { AudienceVerdict, ResourceRefusal };
|
|
62
55
|
export type StatusVerdict = "clear" | "revoked" | "unresolvable";
|
|
@@ -70,29 +63,6 @@ export declare function resolveDelegationTrust(env: CloudflareEnv, options?: Del
|
|
|
70
63
|
export declare function credentialHandle(payload: Record<string, unknown>): string | undefined;
|
|
71
64
|
/** RFC 7519 §4.1.3: `aud` must name this request's resource (./resource-audience). */
|
|
72
65
|
export declare function audienceVerdict(aud: unknown, trust: DelegationTrust): AudienceVerdict;
|
|
73
|
-
/**
|
|
74
|
-
* did:key resolves locally and did:web through `@kya-os/mcp`'s resolver; every
|
|
75
|
-
* fetch refuses redirects, times out and is size-capped. Successful documents
|
|
76
|
-
* are cached for five minutes per resolver; a failed Checkpoint discovery for
|
|
77
|
-
* thirty seconds, so a degraded origin is not refetched for every token.
|
|
78
|
-
*/
|
|
79
|
-
export declare function createDelegationDidResolver(fetchUpstream?: (url: string) => Promise<Response>): DelegationDidResolver;
|
|
80
|
-
/** One resolver per isolate, so DID documents stay cached across requests. */
|
|
81
|
-
export declare function sharedDelegationDidResolver(): DelegationDidResolver;
|
|
82
|
-
/**
|
|
83
|
-
* Ed25519 keys the document authorizes for assertions (`assertionMethod`),
|
|
84
|
-
* narrowed to `kid` when the token names one. A did:key has exactly one key,
|
|
85
|
-
* so only its DID part has to match.
|
|
86
|
-
*/
|
|
87
|
-
export declare function assertionKeys(doc: DIDDocument, kid?: string): Uint8Array[];
|
|
88
|
-
/** Ed25519 signature check against any of `keys`. */
|
|
89
|
-
export declare function verifiesWithAnyKey(signingInput: string, signature: string, keys: readonly Uint8Array[]): Promise<boolean>;
|
|
90
|
-
/**
|
|
91
|
-
* Whether `issuerDid` is the Checkpoint platform signer: the did:key the
|
|
92
|
-
* configured Checkpoint origin's DID document lists in `alsoKnownAs` AND
|
|
93
|
-
* publishes as one of its own assertion keys.
|
|
94
|
-
*/
|
|
95
|
-
export declare function isCheckpointPlatformIssuer(issuerDid: string, trust: DelegationTrust, resolver: DelegationDidResolver): Promise<boolean>;
|
|
96
66
|
/**
|
|
97
67
|
* The status entries a VC-JWT carries: the W3C `vc.credentialStatus` and the
|
|
98
68
|
* draft-kya-http-02 top-level `credentialStatus`. Returns null when either is
|
|
@@ -100,11 +70,12 @@ export declare function isCheckpointPlatformIssuer(issuerDid: string, trust: Del
|
|
|
100
70
|
*/
|
|
101
71
|
export declare function credentialStatusEntries(payload: Record<string, unknown>): unknown[] | null;
|
|
102
72
|
/**
|
|
103
|
-
* Read one revocation entry
|
|
104
|
-
*
|
|
105
|
-
*
|
|
73
|
+
* Read one revocation entry of a credential `issuerDid` signed, fail closed.
|
|
74
|
+
* The list is fetched from the entry's own `statusListCredential` pointer and
|
|
75
|
+
* must be signed by `issuerDid`, verified against its DID document. An entry
|
|
76
|
+
* the native profile would not issue (`validNativeStatus`), an unreachable,
|
|
77
|
+
* unsigned, foreign or malformed list, a purpose mismatch, or an
|
|
78
|
+
* out-of-range index is "unresolvable", never "clear".
|
|
106
79
|
*/
|
|
107
|
-
export declare function checkCredentialStatusEntry(entry: unknown, fetchUpstream?: (url: string) => Promise<Response>): Promise<StatusVerdict>;
|
|
108
|
-
/** "1"/"true" opts a development worker into unchecked legacy tokens. */
|
|
109
|
-
export declare function insecureDevTokensEnabled(env: CloudflareEnv): boolean;
|
|
80
|
+
export declare function checkCredentialStatusEntry(entry: unknown, issuerDid: string, resolver?: DIDResolver, fetchUpstream?: (url: string) => Promise<Response>): Promise<StatusVerdict>;
|
|
110
81
|
//# sourceMappingURL=delegation-trust.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delegation-trust.d.ts","sourceRoot":"","sources":["../../src/services/delegation-trust.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAGH,OAAO,
|
|
1
|
+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