@kya-os/checkpoint-shared 1.9.0 → 1.11.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/CHANGELOG.md +113 -0
- package/README.md +1 -1
- package/dist/base64url-BbVG8f-v.js +65 -0
- package/dist/base64url-D2MvsR20.mjs +49 -0
- package/dist/base64url-D2MvsR20.mjs.map +1 -0
- package/dist/beacon-forward-secret/index.d.mts +4 -0
- package/dist/beacon-forward-secret/index.d.mts.map +1 -0
- package/dist/beacon-forward-secret/index.d.ts +4 -0
- package/dist/beacon-forward-secret/index.d.ts.map +1 -0
- package/dist/beacon-forward-secret/index.js +15 -0
- package/dist/beacon-forward-secret/index.mjs +15 -0
- package/dist/beacon-forward-secret/index.mjs.map +1 -0
- package/dist/beacon-types/index.d.mts +53 -1
- package/dist/beacon-types/index.d.mts.map +1 -1
- package/dist/beacon-types/index.d.ts +53 -1
- package/dist/beacon-types/index.d.ts.map +1 -1
- package/dist/beacon-types/index.js +86 -1
- package/dist/beacon-types/index.mjs +77 -2
- package/dist/beacon-types/index.mjs.map +1 -1
- package/dist/{browser-posture-5fPrsxx7.d.mts → browser-posture-WPk0kl9u.d.mts} +18 -1
- package/dist/browser-posture-WPk0kl9u.d.mts.map +1 -0
- package/dist/{browser-posture-CCR1kh5e.d.ts → browser-posture-_y6BcdXw.d.ts} +18 -1
- package/dist/browser-posture-_y6BcdXw.d.ts.map +1 -0
- package/dist/browser-posture-cookie.mjs.map +1 -1
- package/dist/browser-posture-proof-verifier.js +136 -5
- package/dist/browser-posture-proof-verifier.mjs +134 -2
- package/dist/browser-posture-proof-verifier.mjs.map +1 -0
- package/dist/browser-posture-proof.d.mts +1 -1
- package/dist/browser-posture-proof.d.ts +1 -1
- package/dist/browser-posture-proof.js +1 -1
- package/dist/browser-posture-proof.mjs +1 -1
- package/dist/browser-posture-report.d.mts +17 -0
- package/dist/browser-posture-report.d.mts.map +1 -1
- package/dist/browser-posture-report.d.ts +17 -0
- package/dist/browser-posture-report.d.ts.map +1 -1
- package/dist/browser-posture.d.mts +1 -1
- package/dist/browser-posture.d.ts +1 -1
- package/dist/browser-posture.js +53 -5
- package/dist/browser-posture.mjs +53 -5
- package/dist/browser-posture.mjs.map +1 -1
- package/dist/browser.d.mts +10 -0
- package/dist/browser.d.mts.map +1 -1
- package/dist/browser.d.ts +10 -0
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +1 -1
- package/dist/browser.mjs +1 -1
- package/dist/browser.mjs.map +1 -1
- package/dist/canonical-signer/index.d.mts.map +1 -1
- package/dist/canonical-signer/index.d.ts.map +1 -1
- package/dist/canonical-signer/index.js +0 -4
- package/dist/canonical-signer/index.mjs +0 -4
- package/dist/canonical-signer/index.mjs.map +1 -1
- package/dist/{client-ip-B7w-uHfS.d.ts → client-ip-8KneiMK0.d.mts} +12 -2
- package/dist/{client-ip-B7w-uHfS.d.mts.map → client-ip-8KneiMK0.d.mts.map} +1 -1
- package/dist/{client-ip-B7w-uHfS.d.mts → client-ip-8KneiMK0.d.ts} +12 -2
- package/dist/{client-ip-B7w-uHfS.d.ts.map → client-ip-8KneiMK0.d.ts.map} +1 -1
- package/dist/{client-ip-B8wFzJ5f.js → client-ip-BEmLC4I4.js} +71 -0
- package/dist/{client-ip-DIJyr6px.mjs → client-ip-DlHx7GGh.mjs} +61 -2
- package/dist/client-ip-DlHx7GGh.mjs.map +1 -0
- package/dist/client-ip.d.mts +2 -2
- package/dist/client-ip.d.ts +2 -2
- package/dist/client-ip.js +3 -1
- package/dist/client-ip.mjs +2 -2
- package/dist/deploy/index.d.mts +1 -0
- package/dist/deploy/index.d.mts.map +1 -1
- package/dist/deploy/index.d.ts +1 -0
- package/dist/deploy/index.d.ts.map +1 -1
- package/dist/deploy/index.js +14 -2
- package/dist/deploy/index.mjs +14 -2
- package/dist/deploy/index.mjs.map +1 -1
- package/dist/{detection-reason-mapping-CQexNvR7.d.ts → detection-reason-mapping-BemDaDED.d.mts} +5 -2
- package/dist/detection-reason-mapping-BemDaDED.d.mts.map +1 -0
- package/dist/{detection-reason-mapping-CQexNvR7.d.mts → detection-reason-mapping-BemDaDED.d.ts} +5 -2
- package/dist/detection-reason-mapping-BemDaDED.d.ts.map +1 -0
- package/dist/{detection-reason-mapping-B9RSkOs8.js → detection-reason-mapping-BxYaQ8kb.js} +33 -8
- package/dist/{detection-reason-mapping-BGymWIPl.mjs → detection-reason-mapping-j-7bXsVb.mjs} +29 -10
- package/dist/detection-reason-mapping-j-7bXsVb.mjs.map +1 -0
- package/dist/errors/index.d.mts +4 -0
- package/dist/errors/index.d.mts.map +1 -1
- package/dist/errors/index.d.ts +4 -0
- package/dist/errors/index.d.ts.map +1 -1
- package/dist/errors/index.js +24 -8
- package/dist/errors/index.mjs +24 -8
- package/dist/errors/index.mjs.map +1 -1
- package/dist/{fetcher-D2vjr7jB.d.mts → fetcher-CTKz07jg.d.mts} +13 -3
- package/dist/fetcher-CTKz07jg.d.mts.map +1 -0
- package/dist/{fetcher-C8qvwdnA.d.ts → fetcher-DCr920hx.d.ts} +13 -3
- package/dist/fetcher-DCr920hx.d.ts.map +1 -0
- package/dist/gateway-client-ip.js +1 -1
- package/dist/gateway-client-ip.mjs +1 -1
- package/dist/host-adapter/index.d.mts +1 -1
- package/dist/host-adapter/index.d.ts +1 -1
- package/dist/identity-cookie/index.d.mts +14 -0
- package/dist/identity-cookie/index.d.mts.map +1 -0
- package/dist/identity-cookie/index.d.ts +14 -0
- package/dist/identity-cookie/index.d.ts.map +1 -0
- package/dist/identity-cookie/index.js +45 -0
- package/dist/identity-cookie/index.mjs +43 -0
- package/dist/identity-cookie/index.mjs.map +1 -0
- package/dist/{index-DnFsmr_o.d.ts → index-Cdv_FH0H.d.ts} +2 -2
- package/dist/{index-DnFsmr_o.d.ts.map → index-Cdv_FH0H.d.ts.map} +1 -1
- package/dist/{index-rvw5Bz-r.d.mts → index-DL_dmQBY.d.mts} +2 -2
- package/dist/{index-rvw5Bz-r.d.mts.map → index-DL_dmQBY.d.mts.map} +1 -1
- package/dist/index.d.mts +641 -169
- package/dist/index.d.mts.map +1 -1
- package/dist/index.d.ts +641 -169
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +819 -210
- package/dist/index.mjs +765 -200
- package/dist/index.mjs.map +1 -1
- package/dist/kya-http.d.mts +2 -2
- package/dist/kya-http.d.ts +2 -2
- package/dist/kya-http.js +7 -2
- package/dist/kya-http.mjs +2 -2
- package/dist/mcpi/dashboard-config/index.mjs.map +1 -1
- package/dist/patterns-CdTh7LU2.d.mts +35 -0
- package/dist/patterns-CdTh7LU2.d.mts.map +1 -0
- package/dist/patterns-CdTh7LU2.d.ts +35 -0
- package/dist/patterns-CdTh7LU2.d.ts.map +1 -0
- package/dist/{patterns-CiMpbdAF.js → patterns-CnNxRnaK.js} +3 -130
- package/dist/{patterns-D4OAsNQY.mjs → patterns-CpRk9R3M.mjs} +5 -96
- package/dist/patterns-CpRk9R3M.mjs.map +1 -0
- package/dist/patterns.d.mts +2 -2
- package/dist/patterns.d.ts +2 -2
- package/dist/patterns.js +1 -7
- package/dist/patterns.mjs +2 -2
- package/dist/policy/fetcher.d.mts +2 -2
- package/dist/policy/fetcher.d.ts +2 -2
- package/dist/policy/fetcher.js +100 -8
- package/dist/policy/fetcher.mjs +99 -9
- package/dist/policy/fetcher.mjs.map +1 -1
- package/dist/policy/schemas.d.mts +1 -1
- package/dist/policy/schemas.d.ts +1 -1
- package/dist/proxy-assertion-mapping-BVwXVSMZ.mjs +81 -0
- package/dist/proxy-assertion-mapping-BVwXVSMZ.mjs.map +1 -0
- package/dist/proxy-assertion-mapping-BxhENrcY.d.mts +70 -0
- package/dist/proxy-assertion-mapping-BxhENrcY.d.mts.map +1 -0
- package/dist/proxy-assertion-mapping-D64AyZfG.js +85 -0
- package/dist/proxy-assertion-mapping-DhAynFqG.d.ts +70 -0
- package/dist/proxy-assertion-mapping-DhAynFqG.d.ts.map +1 -0
- package/dist/proxy-assertions.d.mts +2 -0
- package/dist/proxy-assertions.d.ts +2 -0
- package/dist/proxy-assertions.js +4 -0
- package/dist/proxy-assertions.mjs +3 -0
- package/dist/reason-codes.d.mts +2 -2
- package/dist/reason-codes.d.ts +2 -2
- package/dist/reason-codes.js +3 -2
- package/dist/reason-codes.mjs +2 -2
- package/dist/{registered-sid-D6KCaT1E.d.ts → registered-sid-BgDhdj2l.d.mts} +24 -2
- package/dist/registered-sid-BgDhdj2l.d.mts.map +1 -0
- package/dist/{registered-sid-D6KCaT1E.d.mts → registered-sid-BgDhdj2l.d.ts} +24 -2
- package/dist/registered-sid-BgDhdj2l.d.ts.map +1 -0
- package/dist/{registered-sid-DVGTSH0L.js → registered-sid-DG1tSSvl.js} +162 -4
- package/dist/{registered-sid-26hNxp6t.mjs → registered-sid-D__xiDPu.mjs} +134 -6
- package/dist/registered-sid-D__xiDPu.mjs.map +1 -0
- package/dist/{schemas-m-GqyfyO.d.mts → schemas-BhC88D1-.d.mts} +5 -5
- package/dist/{schemas-m-GqyfyO.d.mts.map → schemas-BhC88D1-.d.mts.map} +1 -1
- package/dist/{schemas-CGKHzcMV.d.ts → schemas-DZa1ouGs.d.ts} +5 -5
- package/dist/{schemas-CGKHzcMV.d.ts.map → schemas-DZa1ouGs.d.ts.map} +1 -1
- package/dist/signals/index.d.mts.map +1 -1
- package/dist/signals/index.d.ts.map +1 -1
- package/dist/signals/index.js +4 -0
- package/dist/signals/index.mjs +4 -0
- package/dist/signals/index.mjs.map +1 -1
- package/dist/timezone-country-B6PkDyNP.d.mts +15 -0
- package/dist/timezone-country-B6PkDyNP.d.mts.map +1 -0
- package/dist/timezone-country-B6PkDyNP.d.ts +15 -0
- package/dist/timezone-country-B6PkDyNP.d.ts.map +1 -0
- package/dist/timezone-country-CROxU2Tl.js +505 -0
- package/dist/timezone-country-CrrnkOdy.mjs +489 -0
- package/dist/timezone-country-CrrnkOdy.mjs.map +1 -0
- package/dist/timezone-country.d.mts +2 -0
- package/dist/timezone-country.d.ts +2 -0
- package/dist/timezone-country.js +6 -0
- package/dist/timezone-country.mjs +3 -0
- package/dist/tool-protection/index.mjs.map +1 -1
- package/fixtures/detection/cloudflare-alias-parity.json +383 -0
- package/fixtures/detection/reason-codes.json +3 -1
- package/fixtures/detection/signal-exposure-example.json +1 -1
- package/fixtures/iana-tzdata/backward +375 -0
- package/fixtures/iana-tzdata/renamed-zones.json +21 -0
- package/fixtures/iana-tzdata/version +1 -0
- package/fixtures/iana-tzdata/zone.tab +448 -0
- package/fixtures/workbench/management-session.v1.json +20 -0
- package/fixtures/workbench/model-credentials.v1.json +8 -0
- package/fixtures/workbench/task-grant.v1.json +37 -0
- package/package.json +25 -3
- package/src/data/compiled/merged-rules.json +9 -7
- package/dist/browser-posture-5fPrsxx7.d.mts.map +0 -1
- package/dist/browser-posture-CCR1kh5e.d.ts.map +0 -1
- package/dist/browser-posture-proof-verifier-DvsOmFrM.js +0 -202
- package/dist/browser-posture-proof-verifier-I0HP2Ics.mjs +0 -180
- package/dist/browser-posture-proof-verifier-I0HP2Ics.mjs.map +0 -1
- package/dist/client-ip-DIJyr6px.mjs.map +0 -1
- package/dist/detection-reason-mapping-BGymWIPl.mjs.map +0 -1
- package/dist/detection-reason-mapping-CQexNvR7.d.mts.map +0 -1
- package/dist/detection-reason-mapping-CQexNvR7.d.ts.map +0 -1
- package/dist/fetcher-C8qvwdnA.d.ts.map +0 -1
- package/dist/fetcher-D2vjr7jB.d.mts.map +0 -1
- package/dist/patterns-Bp40cwh2.d.mts +0 -110
- package/dist/patterns-Bp40cwh2.d.mts.map +0 -1
- package/dist/patterns-Bp40cwh2.d.ts +0 -110
- package/dist/patterns-Bp40cwh2.d.ts.map +0 -1
- package/dist/patterns-D4OAsNQY.mjs.map +0 -1
- package/dist/registered-sid-26hNxp6t.mjs.map +0 -1
- package/dist/registered-sid-D6KCaT1E.d.mts.map +0 -1
- package/dist/registered-sid-D6KCaT1E.d.ts.map +0 -1
package/dist/kya-http.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { n as KYA_HTTP_ERROR_STATUS, r as KyaHttpErrorCode, t as KYA_HTTP_ERROR } from "./kya-http-error-codes-C14E4gi3.mjs";
|
|
2
|
-
import {
|
|
3
|
-
export { ANONYMOUS_PRINCIPAL_DID, DELEGATION_PROOF_HEADERS, KYA_HTTP_ERROR, KYA_HTTP_ERROR_STATUS, KYA_OS_HANDSHAKE_METHODS, KYA_OS_WIRE_METHODS, KyaHttpErrorCode, REGISTERED_SID_MAX_LENGTH, SID_ATTRIBUTABLE_RESULT, isKyaOsHandshakeMethod, isKyaOsWireMethod, normalizeHandshakeMethod, normalizeWireMethod, requestCarriesDelegationProof, requestPresentedCredential };
|
|
2
|
+
import { C as isKyaOsWireMethod, S as isKyaOsHandshakeMethod, T as normalizeWireMethod, a as BodyReadOptions, c as KYA_SIGNED_BODY_MAX_BYTES, d as requestCarriesDelegationProof, f as requestDeclaresBody, g as KYA_OS_WIRE_METHODS, h as KYA_OS_HANDSHAKE_METHODS, i as relayedRequestTarget, l as readBodyBounded, m as requestPresentsKyaSignature, n as SID_ATTRIBUTABLE_RESULT, o as BoundedBody, p as requestPresentedCredential, r as ANONYMOUS_PRINCIPAL_DID, s as DeadlineBoundedBody, t as REGISTERED_SID_MAX_LENGTH, u as DELEGATION_PROOF_HEADERS, w as normalizeHandshakeMethod } from "./registered-sid-BgDhdj2l.mjs";
|
|
3
|
+
export { ANONYMOUS_PRINCIPAL_DID, BodyReadOptions, BoundedBody, DELEGATION_PROOF_HEADERS, DeadlineBoundedBody, KYA_HTTP_ERROR, KYA_HTTP_ERROR_STATUS, KYA_OS_HANDSHAKE_METHODS, KYA_OS_WIRE_METHODS, KYA_SIGNED_BODY_MAX_BYTES, KyaHttpErrorCode, REGISTERED_SID_MAX_LENGTH, SID_ATTRIBUTABLE_RESULT, isKyaOsHandshakeMethod, isKyaOsWireMethod, normalizeHandshakeMethod, normalizeWireMethod, readBodyBounded, relayedRequestTarget, requestCarriesDelegationProof, requestDeclaresBody, requestPresentedCredential, requestPresentsKyaSignature };
|
package/dist/kya-http.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { n as KYA_HTTP_ERROR_STATUS, r as KyaHttpErrorCode, t as KYA_HTTP_ERROR } from "./kya-http-error-codes-C14E4gi3.js";
|
|
2
|
-
import {
|
|
3
|
-
export { ANONYMOUS_PRINCIPAL_DID, DELEGATION_PROOF_HEADERS, KYA_HTTP_ERROR, KYA_HTTP_ERROR_STATUS, KYA_OS_HANDSHAKE_METHODS, KYA_OS_WIRE_METHODS, KyaHttpErrorCode, REGISTERED_SID_MAX_LENGTH, SID_ATTRIBUTABLE_RESULT, isKyaOsHandshakeMethod, isKyaOsWireMethod, normalizeHandshakeMethod, normalizeWireMethod, requestCarriesDelegationProof, requestPresentedCredential };
|
|
2
|
+
import { C as isKyaOsWireMethod, S as isKyaOsHandshakeMethod, T as normalizeWireMethod, a as BodyReadOptions, c as KYA_SIGNED_BODY_MAX_BYTES, d as requestCarriesDelegationProof, f as requestDeclaresBody, g as KYA_OS_WIRE_METHODS, h as KYA_OS_HANDSHAKE_METHODS, i as relayedRequestTarget, l as readBodyBounded, m as requestPresentsKyaSignature, n as SID_ATTRIBUTABLE_RESULT, o as BoundedBody, p as requestPresentedCredential, r as ANONYMOUS_PRINCIPAL_DID, s as DeadlineBoundedBody, t as REGISTERED_SID_MAX_LENGTH, u as DELEGATION_PROOF_HEADERS, w as normalizeHandshakeMethod } from "./registered-sid-BgDhdj2l.js";
|
|
3
|
+
export { ANONYMOUS_PRINCIPAL_DID, BodyReadOptions, BoundedBody, DELEGATION_PROOF_HEADERS, DeadlineBoundedBody, KYA_HTTP_ERROR, KYA_HTTP_ERROR_STATUS, KYA_OS_HANDSHAKE_METHODS, KYA_OS_WIRE_METHODS, KYA_SIGNED_BODY_MAX_BYTES, KyaHttpErrorCode, REGISTERED_SID_MAX_LENGTH, SID_ATTRIBUTABLE_RESULT, isKyaOsHandshakeMethod, isKyaOsWireMethod, normalizeHandshakeMethod, normalizeWireMethod, readBodyBounded, relayedRequestTarget, requestCarriesDelegationProof, requestDeclaresBody, requestPresentedCredential, requestPresentsKyaSignature };
|
package/dist/kya-http.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_verification = require('./verification-BAw9N8Pt.js');
|
|
3
3
|
const require_kya_http_error_codes = require('./kya-http-error-codes-B4rUmUEI.js');
|
|
4
|
-
const require_registered_sid = require('./registered-sid-
|
|
4
|
+
const require_registered_sid = require('./registered-sid-DG1tSSvl.js');
|
|
5
5
|
|
|
6
6
|
exports.ANONYMOUS_PRINCIPAL_DID = require_registered_sid.ANONYMOUS_PRINCIPAL_DID;
|
|
7
7
|
exports.DELEGATION_PROOF_HEADERS = require_registered_sid.DELEGATION_PROOF_HEADERS;
|
|
@@ -9,11 +9,16 @@ exports.KYA_HTTP_ERROR = require_kya_http_error_codes.KYA_HTTP_ERROR;
|
|
|
9
9
|
exports.KYA_HTTP_ERROR_STATUS = require_kya_http_error_codes.KYA_HTTP_ERROR_STATUS;
|
|
10
10
|
exports.KYA_OS_HANDSHAKE_METHODS = require_verification.KYA_OS_HANDSHAKE_METHODS;
|
|
11
11
|
exports.KYA_OS_WIRE_METHODS = require_verification.KYA_OS_WIRE_METHODS;
|
|
12
|
+
exports.KYA_SIGNED_BODY_MAX_BYTES = require_registered_sid.KYA_SIGNED_BODY_MAX_BYTES;
|
|
12
13
|
exports.REGISTERED_SID_MAX_LENGTH = require_registered_sid.REGISTERED_SID_MAX_LENGTH;
|
|
13
14
|
exports.SID_ATTRIBUTABLE_RESULT = require_registered_sid.SID_ATTRIBUTABLE_RESULT;
|
|
14
15
|
exports.isKyaOsHandshakeMethod = require_verification.isKyaOsHandshakeMethod;
|
|
15
16
|
exports.isKyaOsWireMethod = require_verification.isKyaOsWireMethod;
|
|
16
17
|
exports.normalizeHandshakeMethod = require_verification.normalizeHandshakeMethod;
|
|
17
18
|
exports.normalizeWireMethod = require_verification.normalizeWireMethod;
|
|
19
|
+
exports.readBodyBounded = require_registered_sid.readBodyBounded;
|
|
20
|
+
exports.relayedRequestTarget = require_registered_sid.relayedRequestTarget;
|
|
18
21
|
exports.requestCarriesDelegationProof = require_registered_sid.requestCarriesDelegationProof;
|
|
19
|
-
exports.
|
|
22
|
+
exports.requestDeclaresBody = require_registered_sid.requestDeclaresBody;
|
|
23
|
+
exports.requestPresentedCredential = require_registered_sid.requestPresentedCredential;
|
|
24
|
+
exports.requestPresentsKyaSignature = require_registered_sid.requestPresentsKyaSignature;
|
package/dist/kya-http.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { c as isKyaOsWireMethod, l as normalizeHandshakeMethod, n as KYA_OS_WIRE_METHODS, s as isKyaOsHandshakeMethod, t as KYA_OS_HANDSHAKE_METHODS, u as normalizeWireMethod } from "./verification-Cvvv86TT.mjs";
|
|
2
2
|
import { n as KYA_HTTP_ERROR_STATUS, t as KYA_HTTP_ERROR } from "./kya-http-error-codes-DSBrxNry.mjs";
|
|
3
|
-
import { a as requestCarriesDelegationProof, i as
|
|
3
|
+
import { a as KYA_SIGNED_BODY_MAX_BYTES, c as requestCarriesDelegationProof, d as requestPresentsKyaSignature, i as relayedRequestTarget, l as requestDeclaresBody, n as SID_ATTRIBUTABLE_RESULT, o as readBodyBounded, r as ANONYMOUS_PRINCIPAL_DID, s as DELEGATION_PROOF_HEADERS, t as REGISTERED_SID_MAX_LENGTH, u as requestPresentedCredential } from "./registered-sid-D__xiDPu.mjs";
|
|
4
4
|
|
|
5
|
-
export { ANONYMOUS_PRINCIPAL_DID, DELEGATION_PROOF_HEADERS, KYA_HTTP_ERROR, KYA_HTTP_ERROR_STATUS, KYA_OS_HANDSHAKE_METHODS, KYA_OS_WIRE_METHODS, REGISTERED_SID_MAX_LENGTH, SID_ATTRIBUTABLE_RESULT, isKyaOsHandshakeMethod, isKyaOsWireMethod, normalizeHandshakeMethod, normalizeWireMethod, requestCarriesDelegationProof, requestPresentedCredential };
|
|
5
|
+
export { ANONYMOUS_PRINCIPAL_DID, DELEGATION_PROOF_HEADERS, KYA_HTTP_ERROR, KYA_HTTP_ERROR_STATUS, KYA_OS_HANDSHAKE_METHODS, KYA_OS_WIRE_METHODS, KYA_SIGNED_BODY_MAX_BYTES, REGISTERED_SID_MAX_LENGTH, SID_ATTRIBUTABLE_RESULT, isKyaOsHandshakeMethod, isKyaOsWireMethod, normalizeHandshakeMethod, normalizeWireMethod, readBodyBounded, relayedRequestTarget, requestCarriesDelegationProof, requestDeclaresBody, requestPresentedCredential, requestPresentsKyaSignature };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../../src/tool-protection/index.ts","../../../src/mcpi/dashboard-config/schemas.ts","../../../src/mcpi/dashboard-config/default-config.ts"],"sourcesContent":["/**\n * KYA-OS Tool Protection Specification\n *\n * Core types for tool protection with delegation requirements.\n *\n * Consent Flow: type='none' → 2 screens, others → 3 screens (Auth→Consent→Success).\n * DelegationCredential (VC) is created when user confirms on Consent Screen.\n *\n * Ported into checkpoint-shared from `@kya-os/contracts/tool-protection` as part\n * of the E6 / C-series decommission (#2914 / #2917): checkpoint owns its product\n * types now that the DIF `@kya-os/mcp` core is protocol-only. The single external\n * dependency (`envVarNameSchema` from the contracts `vault` module) is inlined\n * below so this module pulls nothing from `@kya-os/contracts`.\n *\n * @module @kya-os/checkpoint-shared/tool-protection\n */\n\nimport { z } from 'zod';\n\nexport {\n defaultRequiredScopes,\n executeScopeFor,\n MAX_DEFAULT_SCOPE_LENGTH,\n type ToolScopeSources,\n} from './default-required-scopes';\n\n/**\n * Pattern for valid environment variable names (e.g., X_API_KEY, OPENAI_KEY).\n * Inlined from the former `@kya-os/contracts/vault` `ENV_VAR_PATTERN`.\n */\nconst ENV_VAR_PATTERN = /^[A-Z][A-Z0-9_]*$/;\n\n/**\n * Validates an env var name used by the `apikey` authorization requirement.\n * Inlined from the former `@kya-os/contracts/vault` `envVarNameSchema`.\n */\nconst envVarNameSchema = z\n .string()\n .regex(ENV_VAR_PATTERN, 'Must be a valid env var name (e.g., X_API_KEY)')\n .max(255);\n\n/**\n * Authorization Requirement - what auth is needed BEFORE consent screen.\n *\n * Types: none (2 screens), oauth/password/mdl/idv (3 screens), verifiable_credential (future).\n * The VC output is always a DelegationCredential created on consent confirmation.\n */\nexport type AuthorizationRequirement =\n | {\n /**\n * @deprecated Use 'oauth2' instead. Will be removed in v2.0.0.\n */\n type: 'oauth';\n provider: string; // \"github\", \"google\", etc.\n requiredScopes?: string[]; // Provider-specific scopes\n }\n | {\n /** OAuth 2.0 provider authentication (canonical) */\n type: 'oauth2';\n provider: string; // \"github\", \"google\", etc.\n requiredScopes?: string[]; // Provider-specific scopes\n }\n | {\n type: 'password';\n provider: string; // Credential provider ID (e.g., \"hardwareworld\", \"custom\")\n }\n | {\n type: 'mdl';\n issuer: string; // MDL issuer DID or identifier\n credentialType?: string; // Specific MDL credential type\n }\n | {\n type: 'idv';\n provider: string; // IDV provider name\n verificationLevel?: 'basic' | 'enhanced' | 'loa3';\n }\n | {\n /** Require user to present an existing VC */\n type: 'verifiable_credential';\n credentialType: string;\n issuer?: string;\n }\n | {\n /**\n * @deprecated Use 'verifiable_credential' instead. Will be removed in v2.0.0.\n * This is an alias for 'verifiable_credential' for backward compatibility.\n */\n type: 'credential';\n credentialType: string;\n issuer?: string;\n }\n | {\n /** WebAuthn/Passkey authentication */\n type: 'webauthn';\n rpId?: string; // Relying Party ID\n userVerification?: 'required' | 'preferred' | 'discouraged';\n }\n | {\n /** Sign-In with Ethereum (EIP-4361) */\n type: 'siwe';\n chainId?: number; // Ethereum chain ID (1 = mainnet, 137 = polygon, etc.)\n domain?: string; // Domain for SIWE message\n }\n | {\n /** API Key from per-user vault */\n type: 'apikey';\n envVarNames: string[]; // Env var names to resolve from vault (e.g., ['X_API_KEY'])\n headerMapping: Record<string, string>; // Map env var → HTTP header (e.g., { X_API_KEY: 'X-API-Key' })\n }\n | {\n type: 'none'; // Just consent checkbox, no external auth\n };\n\n/** Canonical authorization type values for type safety */\nexport const AUTHORIZATION_TYPES = {\n /** @deprecated Use OAUTH2 instead. Will be removed in v2.0.0. */\n OAUTH: 'oauth',\n /** OAuth 2.0 provider authentication (canonical) */\n OAUTH2: 'oauth2',\n PASSWORD: 'password',\n MDL: 'mdl',\n IDV: 'idv',\n VERIFIABLE_CREDENTIAL: 'verifiable_credential',\n /** WebAuthn/Passkey authentication */\n WEBAUTHN: 'webauthn',\n /** Sign-In with Ethereum (EIP-4361) */\n SIWE: 'siwe',\n /** API Key from per-user vault */\n APIKEY: 'apikey',\n NONE: 'none',\n} as const;\n\nexport type AuthorizationType = (typeof AUTHORIZATION_TYPES)[keyof typeof AUTHORIZATION_TYPES];\n\n/**\n * Tool Protection Definition\n *\n * Defines the protection requirements for a tool as per KYA-OS spec.\n * This is the canonical definition that all implementations must follow.\n */\nexport interface ToolProtection {\n /**\n * Whether this tool requires explicit delegation from the user\n */\n requiresDelegation: boolean;\n\n /**\n * The scopes required to execute this tool\n * Format: \"resource:action\" (e.g., \"files:read\", \"payment:send\")\n */\n requiredScopes: string[];\n\n /**\n * Risk level classification for the tool\n * Used to determine appropriate authorization flows\n */\n riskLevel?: 'low' | 'medium' | 'high' | 'critical';\n\n /**\n * OAuth provider name for this tool (Phase 2+)\n * If specified, this tool will use the specified OAuth provider.\n * If not specified, provider will be resolved via fallback strategies.\n * @example \"github\", \"google\", \"microsoft\"\n * @deprecated Use `authorization` field instead. Will be removed in Phase 3.\n */\n oauthProvider?: string;\n\n /**\n * Authorization requirement for this tool\n * If requiresDelegation=true, authorization must be specified (or inferred from legacy fields)\n */\n authorization?: AuthorizationRequirement;\n}\n\n/**\n * Tool Protection Map\n *\n * A mapping of tool names to their protection configurations.\n * This is how tool protections are typically stored and transmitted.\n */\nexport type ToolProtectionMap = Record<string, ToolProtection>;\n\n/**\n * Partial tool protection for updates (all fields optional)\n * Use this when accepting partial updates to tool protection settings\n */\nexport type PartialToolProtection = Partial<ToolProtection>;\n\n/**\n * Tool protection with explicit optional fields\n * Useful when TypeScript's Partial<T> doesn't preserve optional property access\n * Supports explicit null values to clear fields\n */\nexport type ToolProtectionUpdate = {\n requiresDelegation?: boolean;\n requiredScopes?: string[];\n riskLevel?: 'low' | 'medium' | 'high' | 'critical';\n oauthProvider?: string | null; // null explicitly clears the field\n authorization?: AuthorizationRequirement | null; // null explicitly clears the field\n};\n\n/**\n * Tool Protection Response\n *\n * The response format when querying for tool protections.\n * Used by tool protection services and APIs.\n */\nexport interface ToolProtectionResponse {\n /**\n * The tool protections keyed by tool name\n */\n toolProtections: ToolProtectionMap;\n\n /**\n * Optional metadata about the response\n */\n metadata?: {\n /**\n * When this configuration was last updated\n */\n lastUpdated?: string;\n\n /**\n * Version of the configuration\n */\n version?: string;\n\n /**\n * Source of the configuration\n */\n source?: string;\n };\n}\n\n/**\n * Delegation Required Error Data\n *\n * The standardized error data returned when a tool requires delegation\n * but none was provided. This is part of the KYA-OS error protocol.\n */\nexport interface DelegationRequiredErrorData {\n /**\n * The name of the tool that requires delegation\n */\n toolName: string;\n\n /**\n * The scopes required for this tool\n */\n requiredScopes: string[];\n\n /**\n * URL where the user can provide consent/delegation\n */\n consentUrl?: string;\n\n /**\n * Alternative field for consent URL (for compatibility)\n */\n authorizationUrl?: string;\n\n /**\n * Additional context about why delegation is required\n */\n reason?: string;\n}\n\n/**\n * Auth Required Error Data\n *\n * Machine-readable error returned when a tool requires per-user auth\n * (vault secret, OAuth, credential) but none is configured and no\n * static env fallback exists. MCP clients use this to present\n * actionable guidance (e.g., \"Add your PulseMCP API key\" with a link).\n *\n * Closes VAULT-11\n */\nexport interface AuthRequiredErrorData {\n /** Discriminator — always \"auth_required\" */\n error: 'auth_required';\n\n /** Which auth mechanism is missing */\n type: 'apikey' | 'oauth' | 'credential';\n\n /** For apikey: which env vars are missing */\n envVarNames?: string[];\n\n /** Dashboard URL where the user can configure the missing auth */\n configUrl: string;\n\n /** Human-readable fallback message */\n message: string;\n}\n\nexport const AuthRequiredErrorDataSchema = z.object({\n error: z.literal('auth_required'),\n type: z.enum(['apikey', 'oauth', 'credential']),\n envVarNames: z.array(z.string()).optional(),\n configUrl: z.string(),\n message: z.string(),\n});\n\n/**\n * Error class thrown when required auth is missing and no fallback exists.\n *\n * Caught by the tool-call handler in agent.ts and serialized as a\n * machine-readable MCP tool result so clients can present actionable UI.\n */\nexport class AuthRequiredError extends Error {\n public readonly type: AuthRequiredErrorData['type'];\n public readonly envVarNames?: string[];\n public readonly configUrl: string;\n\n constructor(opts: {\n type: AuthRequiredErrorData['type'];\n envVarNames?: string[];\n configUrl: string;\n message?: string;\n }) {\n const message =\n opts.message ??\n (opts.type === 'apikey' && opts.envVarNames?.length\n ? `API key required: configure ${opts.envVarNames.join(', ')} in your project settings.`\n : 'Authentication required to use this tool.');\n super(message);\n this.name = 'AuthRequiredError';\n this.type = opts.type;\n this.envVarNames = opts.envVarNames;\n this.configUrl = opts.configUrl;\n }\n\n /** Serialize to the wire format MCP clients expect */\n toJSON(): AuthRequiredErrorData {\n return {\n error: 'auth_required',\n type: this.type,\n ...(this.envVarNames && { envVarNames: this.envVarNames }),\n configUrl: this.configUrl,\n message: this.message,\n };\n }\n}\n\n/**\n * Legacy tool protection format (pre-authorization field)\n * Used during migration period to support both old and new formats\n */\nexport type LegacyToolProtection = Omit<ToolProtection, 'authorization'> & {\n oauthProvider?: string;\n};\n\n/**\n * Union type for both legacy and new formats\n * Useful during migration period when accepting tool protection input\n */\nexport type ToolProtectionInput = ToolProtection | LegacyToolProtection;\n\n/**\n * Zod Schemas for Validation\n */\n\nexport const AuthorizationRequirementSchema = z.discriminatedUnion('type', [\n // Deprecated: 'oauth' is an alias for 'oauth2'\n // Will be removed in v2.0.0. Use 'oauth2' instead.\n z.object({\n type: z.literal('oauth'),\n provider: z.string(),\n requiredScopes: z.array(z.string()).optional(),\n }),\n // OAuth 2.0 provider authentication (canonical)\n z.object({\n type: z.literal('oauth2'),\n provider: z.string(),\n requiredScopes: z.array(z.string()).optional(),\n }),\n z.object({\n type: z.literal('password'),\n provider: z.string(),\n }),\n z.object({\n type: z.literal('mdl'),\n issuer: z.string(),\n credentialType: z.string().optional(),\n }),\n z.object({\n type: z.literal('idv'),\n provider: z.string(),\n verificationLevel: z.enum(['basic', 'enhanced', 'loa3']).optional(),\n }),\n z.object({\n type: z.literal('verifiable_credential'),\n credentialType: z.string(),\n issuer: z.string().optional(),\n }),\n // Deprecated: 'credential' is an alias for 'verifiable_credential'\n // Will be removed in v2.0.0. Use 'verifiable_credential' instead.\n z.object({\n type: z.literal('credential'),\n credentialType: z.string(),\n issuer: z.string().optional(),\n }),\n // WebAuthn/Passkey authentication\n z.object({\n type: z.literal('webauthn'),\n rpId: z.string().optional(),\n userVerification: z.enum(['required', 'preferred', 'discouraged']).optional(),\n }),\n // Sign-In with Ethereum (EIP-4361)\n z.object({\n type: z.literal('siwe'),\n chainId: z.number().optional(),\n domain: z.string().optional(),\n }),\n // API Key from per-user vault\n z.object({\n type: z.literal('apikey'),\n envVarNames: z.array(envVarNameSchema).min(1),\n headerMapping: z.record(z.string(), z.string()),\n }),\n z.object({\n type: z.literal('none'),\n }),\n]);\n\nexport const ToolProtectionSchema = z.object({\n requiresDelegation: z.boolean(),\n requiredScopes: z.array(z.string()),\n riskLevel: z.enum(['low', 'medium', 'high', 'critical']).optional(),\n oauthProvider: z.string().optional(), // Phase 2: Tool-specific OAuth provider\n authorization: AuthorizationRequirementSchema.optional(),\n});\n\nexport const ToolProtectionMapSchema = z.record(z.string(), ToolProtectionSchema);\n\nexport const ToolProtectionResponseSchema = z.object({\n toolProtections: ToolProtectionMapSchema,\n metadata: z\n .object({\n lastUpdated: z.string().optional(),\n version: z.string().optional(),\n source: z.string().optional(),\n })\n .optional(),\n});\n\nexport const DelegationRequiredErrorDataSchema = z.object({\n toolName: z.string(),\n requiredScopes: z.array(z.string()),\n consentUrl: z.string().optional(),\n authorizationUrl: z.string().optional(),\n reason: z.string().optional(),\n});\n\n/**\n * Type Guards\n */\n\nexport function isToolProtection(obj: unknown): obj is ToolProtection {\n return ToolProtectionSchema.safeParse(obj).success;\n}\n\nexport function isToolProtectionMap(obj: unknown): obj is ToolProtectionMap {\n return ToolProtectionMapSchema.safeParse(obj).success;\n}\n\nexport function isToolProtectionResponse(obj: unknown): obj is ToolProtectionResponse {\n return ToolProtectionResponseSchema.safeParse(obj).success;\n}\n\nexport function isDelegationRequiredErrorData(obj: unknown): obj is DelegationRequiredErrorData {\n return DelegationRequiredErrorDataSchema.safeParse(obj).success;\n}\n\n/**\n * Type guard to check if an object is a valid AuthorizationRequirement\n */\nexport function isAuthorizationRequirement(obj: unknown): obj is AuthorizationRequirement {\n return AuthorizationRequirementSchema.safeParse(obj).success;\n}\n\n/**\n * Type guard to check if a ToolProtection has OAuth authorization\n * Checks for both 'oauth' (deprecated) and 'oauth2' (canonical)\n */\nexport function hasOAuthAuthorization(\n protection: ToolProtection\n): protection is ToolProtection & { authorization: { type: 'oauth' | 'oauth2' } } {\n return protection.authorization?.type === 'oauth' || protection.authorization?.type === 'oauth2';\n}\n\n/**\n * Type guard to check if a ToolProtection has password authorization\n */\nexport function hasPasswordAuthorization(\n protection: ToolProtection\n): protection is ToolProtection & { authorization: { type: 'password' } } {\n return protection.authorization?.type === 'password';\n}\n\n/**\n * Type guard to check if a ToolProtection requires a Verifiable Credential\n *\n * Note: Also returns true for deprecated 'credential' type (normalized to verifiable_credential)\n */\nexport function hasVerifiableCredentialAuthorization(\n protection: ToolProtection\n): protection is ToolProtection & {\n authorization: { type: 'verifiable_credential' | 'credential' };\n} {\n return (\n protection.authorization?.type === 'verifiable_credential' ||\n protection.authorization?.type === 'credential'\n );\n}\n\n/**\n * Type guard to check if a ToolProtection has API Key (vault) authorization\n */\nexport function hasApiKeyAuthorization(\n protection: ToolProtection\n): protection is ToolProtection & { authorization: { type: 'apikey' } } {\n return protection.authorization?.type === 'apikey';\n}\n\n/**\n * Validation Functions\n */\n\nexport function validateToolProtection(obj: unknown): ToolProtection {\n return ToolProtectionSchema.parse(obj);\n}\n\nexport function validateToolProtectionMap(obj: unknown): ToolProtectionMap {\n return ToolProtectionMapSchema.parse(obj);\n}\n\nexport function validateToolProtectionResponse(obj: unknown): ToolProtectionResponse {\n return ToolProtectionResponseSchema.parse(obj);\n}\n\nexport function validateDelegationRequiredErrorData(obj: unknown): DelegationRequiredErrorData {\n return DelegationRequiredErrorDataSchema.parse(obj);\n}\n\n/**\n * Utility Functions\n */\n\n/**\n * Check if a tool requires delegation\n */\nexport function toolRequiresDelegation(toolName: string, protections: ToolProtectionMap): boolean {\n const protection = protections[toolName];\n return protection?.requiresDelegation ?? false;\n}\n\n/**\n * Get required scopes for a tool\n */\nexport function getToolRequiredScopes(toolName: string, protections: ToolProtectionMap): string[] {\n const protection = protections[toolName];\n return protection?.requiredScopes ?? [];\n}\n\n/**\n * Get risk level for a tool\n */\nexport function getToolRiskLevel(\n toolName: string,\n protections: ToolProtectionMap\n): ToolProtection['riskLevel'] | undefined {\n return protections[toolName]?.riskLevel;\n}\n\n/**\n * Create a delegation required error\n */\nexport function createDelegationRequiredError(\n toolName: string,\n requiredScopes: string[],\n consentUrl?: string\n): DelegationRequiredErrorData {\n return {\n toolName,\n requiredScopes,\n consentUrl,\n authorizationUrl: consentUrl, // Include both for compatibility\n };\n}\n\n/**\n * Normalize tool protection configuration\n * Migrates legacy oauthProvider field to authorization object\n *\n * - Migrates `oauthProvider` → `authorization: { type: 'oauth', provider: ... }`\n * - Ensures `authorization` field is present when `requiresDelegation=true`\n * - Returns fully normalized ToolProtection object\n *\n * @param raw - Raw tool protection data (may have legacy fields or be partial)\n * @returns Normalized ToolProtection object\n *\n * // TODO: Remove normalizeToolProtection() when all tools migrated\n */\nexport function normalizeToolProtection(\n raw: ToolProtection | PartialToolProtection\n): ToolProtection {\n // Ensure we have required fields (provide defaults for partial input)\n const normalized: ToolProtection = {\n requiresDelegation: raw.requiresDelegation ?? false,\n requiredScopes: raw.requiredScopes ?? [],\n ...(raw.riskLevel && { riskLevel: raw.riskLevel }),\n ...(raw.oauthProvider && { oauthProvider: raw.oauthProvider }),\n };\n\n // If authorization is already present, use it\n if (raw.authorization) {\n normalized.authorization = raw.authorization;\n return normalized;\n }\n\n // Migrate oauthProvider to authorization\n if (raw.oauthProvider) {\n normalized.authorization = {\n type: 'oauth',\n provider: raw.oauthProvider,\n };\n // Keep oauthProvider for backward compatibility\n return normalized;\n }\n\n // Default for requiresDelegation=true without specific auth: type='none' (consent only)\n // But ONLY if authorization is missing entirely\n if (normalized.requiresDelegation && !normalized.authorization && !normalized.oauthProvider) {\n // We don't automatically set type='none' here to allow\n // ProviderResolver to do its scope inference fallback logic.\n // The fallback logic will eventually be moved into an AuthorizationService.\n return normalized;\n }\n\n return normalized;\n}\n\n// =============================================================================\n// CONSENT PROVIDER TYPES - Records what auth method was USED (not required)\n// =============================================================================\n\n/** Consent provider types - stored in delegation metadata to track auth method used */\nexport const CONSENT_PROVIDER_TYPES = {\n /** Consent-only mode - no authentication, just clickwrap agreement */\n NONE: 'none',\n /** OAuth2 provider authentication */\n OAUTH2: 'oauth2',\n /** Password-based authentication (email/password, username/password) */\n PASSWORD: 'password',\n /** @deprecated Use PASSWORD instead. Alias for backward compatibility */\n CREDENTIAL: 'credential',\n /** Email magic link authentication */\n MAGIC_LINK: 'magic_link',\n /** One-time password (SMS/email code) */\n OTP: 'otp',\n} as const;\n\nexport type ConsentProviderType =\n (typeof CONSENT_PROVIDER_TYPES)[keyof typeof CONSENT_PROVIDER_TYPES];\n\n/**\n * Determine consent provider type based on available identity information\n *\n * This is the single source of truth for consent provider type determination.\n *\n * @param hasOAuthIdentity - Whether OAuth identity is available\n * @param isPasswordFlow - Whether this is a password/credential flow\n * @param isMagicLinkFlow - Whether this is a magic link flow\n * @param isOtpFlow - Whether this is an OTP flow\n * @returns The consent provider type\n */\nexport function determineConsentProviderType(\n hasOAuthIdentity: boolean,\n isPasswordFlow: boolean = false,\n isMagicLinkFlow: boolean = false,\n isOtpFlow: boolean = false\n): ConsentProviderType {\n if (isPasswordFlow) {\n return CONSENT_PROVIDER_TYPES.PASSWORD;\n }\n if (isMagicLinkFlow) {\n return CONSENT_PROVIDER_TYPES.MAGIC_LINK;\n }\n if (isOtpFlow) {\n return CONSENT_PROVIDER_TYPES.OTP;\n }\n if (hasOAuthIdentity) {\n return CONSENT_PROVIDER_TYPES.OAUTH2;\n }\n return CONSENT_PROVIDER_TYPES.NONE;\n}\n\n/**\n * Get a human-readable label for an authorization requirement type\n */\nexport function getAuthorizationTypeLabel(auth: AuthorizationRequirement): string {\n switch (auth.type) {\n case 'oauth':\n case 'oauth2':\n return auth.provider\n ? auth.provider.charAt(0).toUpperCase() + auth.provider.slice(1)\n : 'OAuth Provider';\n case 'password':\n return 'Password Authentication';\n case 'mdl':\n return \"Mobile Driver's License\";\n case 'idv':\n return 'Identity Verification';\n case 'verifiable_credential':\n return auth.credentialType || 'Verifiable Credential';\n case 'credential':\n // Deprecated: treat as verifiable_credential\n return auth.credentialType || 'Verifiable Credential';\n case 'webauthn':\n return 'Passkey / WebAuthn';\n case 'siwe':\n return 'Sign-In with Ethereum';\n case 'apikey':\n return 'API Key (Vault)';\n case 'none':\n return 'Consent Only';\n default: {\n // Closed union — this default is unreachable for well-typed input.\n return 'Unknown';\n }\n }\n}\n\n/**\n * Get a unique key for an authorization requirement (for React keys, caching, etc.)\n */\nexport function getAuthorizationTypeKey(auth: AuthorizationRequirement): string {\n switch (auth.type) {\n case 'oauth':\n // Keep original key format for backward compatibility with existing cache entries\n // Handle undefined provider gracefully (may come from loose API response types)\n return auth.provider ? `oauth:${auth.provider}` : 'oauth';\n case 'oauth2':\n return auth.provider ? `oauth2:${auth.provider}` : 'oauth2';\n case 'password':\n return auth.provider ? `password:${auth.provider}` : 'password';\n case 'mdl':\n // Keep trailing colon for backward compatibility with existing cache entries\n return `mdl:${auth.issuer || 'unknown'}:${auth.credentialType || ''}`;\n case 'idv':\n // Keep trailing colon for backward compatibility with existing cache entries\n return `idv:${auth.provider || 'unknown'}:${auth.verificationLevel || ''}`;\n case 'verifiable_credential':\n return `vc:${auth.issuer || 'any'}:${auth.credentialType || 'unknown'}`;\n case 'credential':\n // Deprecated: treat as verifiable_credential\n return `vc:${auth.issuer || 'any'}:${auth.credentialType || 'unknown'}`;\n case 'webauthn':\n return `webauthn:${auth.rpId || 'default'}`;\n case 'siwe':\n return `siwe:${auth.chainId || 1}:${auth.domain || 'any'}`;\n case 'apikey':\n return `apikey:${[...auth.envVarNames].sort().join(',')}`;\n case 'none':\n return 'none';\n default: {\n // Closed union — this default is unreachable for well-typed input.\n return 'unknown';\n }\n }\n}\n\n/**\n * Normalize authorization requirement type\n *\n * Normalizes deprecated types to their canonical equivalents:\n * - 'oauth' → 'oauth2'\n * - 'credential' → 'verifiable_credential'\n *\n * This function should be called at runtime boundaries when processing\n * authorization requirements.\n *\n * @param auth - Authorization requirement (may contain deprecated types)\n * @param options - Normalization options\n * @returns Normalized authorization requirement\n *\n * @example\n * ```typescript\n * const normalized = normalizeAuthorizationType(\n * { type: 'oauth', provider: 'github' },\n * { warn: true }\n * );\n * // Returns: { type: 'oauth2', provider: 'github' }\n * // Logs: DEPRECATION warning\n * ```\n */\nexport function normalizeAuthorizationType(\n auth: AuthorizationRequirement,\n options: { warn?: boolean; logger?: (message: string) => void } = {}\n): AuthorizationRequirement {\n const { warn = true, logger = console.warn } = options;\n\n // Normalize 'oauth' to 'oauth2'\n if (auth.type === 'oauth') {\n if (warn) {\n logger(\n `DEPRECATION: Authorization type 'oauth' is deprecated and will be removed in v2.0.0. ` +\n `Please update to 'oauth2'. ` +\n `See https://github.com/modelcontextprotocol-identity/xmcp-i/blob/main/docs/migrations/oauth-to-oauth2.md`\n );\n }\n\n // Normalize to oauth2\n const normalized = {\n type: 'oauth2' as const,\n provider: auth.provider,\n ...(auth.requiredScopes !== undefined && { requiredScopes: auth.requiredScopes }),\n };\n\n return normalized;\n }\n\n // Normalize 'credential' to 'verifiable_credential'\n if (auth.type === 'credential') {\n if (warn) {\n logger(\n `DEPRECATION: Authorization type 'credential' is deprecated and will be removed in v2.0.0. ` +\n `Please update to 'verifiable_credential'. ` +\n `See https://github.com/modelcontextprotocol-identity/xmcp-i/blob/main/docs/migrations/credential-to-verifiable_credential.md`\n );\n }\n\n // Normalize to verifiable_credential\n const normalized = {\n type: 'verifiable_credential' as const,\n credentialType: auth.credentialType,\n ...(auth.issuer !== undefined && { issuer: auth.issuer }),\n };\n\n return normalized;\n }\n\n // No normalization needed\n return auth;\n}\n","/**\n * Dashboard Configuration Zod Schemas\n *\n * Runtime validation schemas for dashboard configuration types.\n * Used for validating API requests and responses.\n *\n * Ported into checkpoint-shared from `@kya-os/contracts/dashboard-config` as part\n * of the E6 / C-series decommission (#2914 / #2917). The only cross-module\n * dependency (`ToolProtectionSchema`/`ToolProtectionMapSchema`) now resolves to\n * the local `../../tool-protection` module.\n *\n * @module @kya-os/checkpoint-shared/dashboard-config\n */\n\nimport { z } from 'zod';\nimport { ToolProtectionMapSchema } from '../../tool-protection';\n\n/**\n * Identity configuration schema\n */\nexport const identityConfigSchema = z.object({\n /**\n * @deprecated Use serverDid instead. Will be removed in v2.0\n */\n agentDid: z.string().min(1).optional(),\n serverDid: z.string().min(1),\n environment: z.enum(['development', 'production']),\n storageLocation: z.enum(['cloudflare-kv', 'file-system', 'env-vars']),\n});\n\n/**\n * Proofing configuration schema\n */\nexport const proofingConfigSchema = z.object({\n enabled: z.boolean(),\n destinations: z.array(\n z.object({\n type: z.enum(['agentshield', 'kta', 'custom']),\n apiUrl: z.string().url(),\n apiKey: z.string().optional(),\n })\n ),\n batchQueue: z.object({\n maxBatchSize: z.number().int().positive().default(10),\n flushIntervalMs: z.number().int().positive().default(5000),\n maxRetries: z.number().int().nonnegative().default(3),\n }),\n});\n\n/**\n * Delegation verifier type schema\n */\nconst delegationVerifierTypeSchema = z.enum([\n 'agentshield',\n 'kta',\n 'memory',\n 'cloudflare-kv',\n 'redis',\n 'dynamodb',\n 'custom',\n]);\n\n/**\n * Delegation configuration schema\n */\nexport const delegationConfigSchema = z.object({\n enabled: z.boolean(),\n enforceStrictly: z.boolean(),\n verifier: z.object({\n type: delegationVerifierTypeSchema,\n apiUrl: z.string().url().optional(),\n cacheTtl: z.number().int().positive().optional(),\n }),\n authorization: z.object({\n authorizationUrl: z.string().url().optional(),\n minReputationScore: z.number().int().min(0).max(100).optional(),\n resumeTokenTtl: z.number().int().positive().optional(),\n requireAuthForUnknown: z.boolean().optional(),\n }),\n});\n\n/**\n * Tool protection configuration schema\n */\nexport const toolProtectionConfigSchema = z.object({\n source: z.enum(['agentshield', 'inline', 'file']),\n agentShield: z\n .object({\n apiUrl: z.string().url(),\n cacheTtl: z.number().int().positive(),\n })\n .optional(),\n fallback: ToolProtectionMapSchema.optional(),\n});\n\n/** Merged tool protection config with embedded tools */\nexport const mergedToolProtectionConfigSchema = toolProtectionConfigSchema.extend({\n tools: ToolProtectionMapSchema,\n});\n\n/**\n * Audit configuration schema\n */\nexport const auditConfigSchema = z.object({\n enabled: z.boolean(),\n includeProofHashes: z.boolean(),\n includePayloads: z.boolean(),\n});\n\n/**\n * Session configuration schema\n */\nexport const sessionConfigSchema = z.object({\n timestampSkewSeconds: z.number().int().positive().default(120),\n ttlMinutes: z.number().int().positive().default(30),\n absoluteLifetime: z.number().int().positive().optional(),\n});\n\n/**\n * Cloudflare platform configuration schema\n */\nexport const cloudflarePlatformConfigSchema = z.object({\n workers: z.object({\n cpuMs: z.number().int().positive().default(50),\n memoryMb: z.number().int().positive().default(128),\n }),\n kvNamespaces: z.array(\n z.object({\n name: z.string().min(1),\n purpose: z.enum(['sessions', 'delegations', 'cache', 'general']),\n })\n ),\n environmentVariables: z.array(\n z.object({\n name: z.string().min(1),\n value: z.string(),\n source: z.enum(['wrangler.toml', 'secrets', '.dev.vars']),\n })\n ),\n});\n\n/**\n * Node.js platform configuration schema\n */\nexport const nodePlatformConfigSchema = z.object({\n server: z.object({\n port: z.number().int().positive().default(3000),\n host: z.string().default('0.0.0.0'),\n cors: z.boolean().default(true),\n timeout: z.number().int().positive().default(30000),\n }),\n storage: z.object({\n type: z.enum(['memory', 'redis', 'postgres', 'mongodb']),\n connection: z\n .object({\n host: z.string().optional(),\n port: z.number().int().positive().optional(),\n database: z.string().optional(),\n })\n .optional(),\n }),\n});\n\n/**\n * Vercel platform configuration schema\n */\nexport const vercelPlatformConfigSchema = z.object({\n environmentVariables: z.array(\n z.object({\n name: z.string().min(1),\n value: z.string(),\n source: z.enum(['vercel-dashboard', '.env.local']),\n })\n ),\n edgeRuntime: z\n .object({\n maxDuration: z.number().int().positive().optional(),\n regions: z.array(z.string()).optional(),\n })\n .optional(),\n});\n\n/**\n * Platform configuration schema\n */\nexport const platformConfigSchema = z.object({\n type: z.enum(['cloudflare', 'node', 'vercel']),\n cloudflare: cloudflarePlatformConfigSchema.optional(),\n node: nodePlatformConfigSchema.optional(),\n vercel: vercelPlatformConfigSchema.optional(),\n});\n\n/**\n * Metadata schema\n */\nexport const configMetadataSchema = z.object({\n version: z.string(),\n lastUpdated: z.string(),\n source: z.enum(['dashboard', 'code', 'mixed']),\n serverUrl: z.string().url().optional(),\n deploymentStatus: z.enum(['active', 'inactive', 'error']).optional(),\n});\n\n/**\n * Complete KYA-OS Server Configuration schema\n */\nexport const mcpIServerConfigSchema = z.object({\n identity: identityConfigSchema,\n proofing: proofingConfigSchema,\n delegation: delegationConfigSchema,\n toolProtection: toolProtectionConfigSchema,\n audit: auditConfigSchema,\n session: sessionConfigSchema,\n platform: platformConfigSchema,\n metadata: configMetadataSchema,\n});\n\n/** Merged KYA-OS Server Configuration schema @since 1.6.0 */\nexport const mergedMcpIServerConfigSchema = mcpIServerConfigSchema.extend({\n toolProtection: mergedToolProtectionConfigSchema,\n});\n\n/**\n * Get server config request schema\n */\nexport const getServerConfigRequestSchema = z.object({\n projectId: z.string().min(1),\n});\n\n/**\n * Get server config response schema\n */\nexport const getServerConfigResponseSchema = z.object({\n success: z.boolean(),\n data: z.object({\n config: mcpIServerConfigSchema,\n }),\n metadata: z\n .object({\n requestId: z.string().optional(),\n timestamp: z.string().optional(),\n })\n .optional(),\n});\n\n/** Get merged server config response schema @since 1.6.0 */\nexport const getMergedServerConfigResponseSchema = z.object({\n success: z.boolean(),\n data: z.object({\n config: mergedMcpIServerConfigSchema,\n /** @deprecated Use config.toolProtection.tools instead */\n toolProtections: ToolProtectionMapSchema.optional(),\n }),\n metadata: z\n .object({\n requestId: z.string().optional(),\n timestamp: z.string().optional(),\n cachedUntil: z.string().optional(),\n })\n .optional(),\n});\n\n/**\n * Update server config request schema\n */\nexport const updateServerConfigRequestSchema = z.object({\n projectId: z.string().min(1),\n config: mcpIServerConfigSchema.partial(),\n});\n\n/**\n * Update server config response schema\n */\nexport const updateServerConfigResponseSchema = z.object({\n success: z.boolean(),\n data: z.object({\n config: mcpIServerConfigSchema,\n changes: z.array(\n z.object({\n path: z.string(),\n oldValue: z.unknown(),\n newValue: z.unknown(),\n })\n ),\n }),\n metadata: z\n .object({\n requestId: z.string().optional(),\n timestamp: z.string().optional(),\n })\n .optional(),\n});\n\n/**\n * Validate server config request schema\n */\nexport const validateServerConfigRequestSchema = z.object({\n projectId: z.string().min(1),\n config: mcpIServerConfigSchema.partial(),\n});\n\n/**\n * Validate server config response schema\n */\nexport const validateServerConfigResponseSchema = z.object({\n success: z.boolean(),\n data: z.object({\n valid: z.boolean(),\n errors: z\n .array(\n z.object({\n path: z.string(),\n message: z.string(),\n code: z.string(),\n })\n )\n .optional(),\n warnings: z\n .array(\n z.object({\n path: z.string(),\n message: z.string(),\n })\n )\n .optional(),\n }),\n metadata: z\n .object({\n requestId: z.string().optional(),\n timestamp: z.string().optional(),\n })\n .optional(),\n});\n","/**\n * Default Configuration for KYA-OS Servers\n *\n * Provides safe, production-ready defaults for new user configurations.\n * Used by the Checkpoint Dashboard, Scaffolder, and Runtime fallbacks.\n *\n * Ported into checkpoint-shared from the former contracts dashboard-config module\n * as part of the E6 / C-series decommission (#2914 / #2917). Replaces the runtime\n * default-config fallback previously used by\n * `apps/web/lib/services/kyaos-config.service.ts`.\n *\n * @module @kya-os/checkpoint-shared/dashboard-config\n */\n\nimport type { MCPIServerConfig } from './types';\nimport { mcpIServerConfigSchema } from './schemas';\nimport { z } from 'zod';\n\n/**\n * Default configuration JSON content\n * Embedded here to avoid TypeScript JSON import issues in build\n */\nconst defaultConfigJson = {\n identity: {\n // agentDid removed - deprecated, use serverDid instead\n serverDid: '', // New field - will be populated when identity is generated\n environment: 'development' as const,\n storageLocation: 'env-vars' as const,\n },\n proofing: {\n enabled: true,\n destinations: [\n {\n type: 'agentshield' as const,\n apiUrl: 'https://kya.vouched.id',\n },\n ],\n batchQueue: {\n maxBatchSize: 10,\n flushIntervalMs: 5000,\n maxRetries: 3,\n },\n },\n delegation: {\n enabled: true,\n enforceStrictly: false,\n verifier: {\n type: 'agentshield' as const,\n apiUrl: 'https://kya.vouched.id/api/v1/bouncer/delegations/verify',\n cacheTtl: 300000,\n },\n authorization: {\n authorizationUrl: 'https://kya.vouched.id/api/v1/bouncer/delegations/authorize',\n minReputationScore: 80,\n resumeTokenTtl: 3600000,\n requireAuthForUnknown: false,\n },\n },\n toolProtection: {\n source: 'agentshield' as const,\n agentShield: {\n apiUrl: 'https://kya.vouched.id',\n cacheTtl: 300000,\n },\n fallback: {},\n },\n audit: {\n enabled: true,\n includeProofHashes: false,\n includePayloads: false,\n },\n session: {\n timestampSkewSeconds: 120,\n ttlMinutes: 30,\n },\n platform: {\n type: 'node' as const,\n node: {\n server: {\n port: 3000,\n host: '0.0.0.0',\n cors: true,\n timeout: 30000,\n },\n storage: {\n type: 'memory' as const,\n },\n },\n cloudflare: {\n workers: {\n cpuMs: 50,\n memoryMb: 128,\n },\n kvNamespaces: [],\n environmentVariables: [],\n },\n vercel: {\n environmentVariables: [],\n edgeRuntime: {},\n },\n },\n metadata: {\n version: '1.0.0',\n lastUpdated: '',\n source: 'dashboard' as const,\n deploymentStatus: 'inactive' as const,\n },\n};\n\n/**\n * Relaxed schema for default config validation\n * Allows empty strings for fields that will be populated later\n *\n * Note: Empty `agentDid` is valid for new/incomplete configurations.\n * This allows users to create configs before registering their agent DID.\n * The base schema (mcpIServerConfigSchema) requires non-empty agentDid for\n * complete configurations, but defaults allow empty to support progressive\n * configuration.\n */\nconst defaultConfigSchema = mcpIServerConfigSchema.extend({\n identity: mcpIServerConfigSchema.shape.identity.extend({\n agentDid: z.string().optional(), // Allow empty string or undefined for defaults (deprecated)\n serverDid: z.string(), // Allow empty string for defaults (will be populated later)\n }),\n metadata: mcpIServerConfigSchema.shape.metadata.extend({\n lastUpdated: z.string(), // Allow empty string (will be set dynamically)\n }),\n});\n\n/**\n * Default configuration object\n *\n * This is the base default configuration used when creating new user configs.\n * Platform-specific defaults are available via getDefaultConfigForPlatform().\n */\nexport const defaultConfig: MCPIServerConfig = defaultConfigSchema.parse(\n defaultConfigJson\n) as MCPIServerConfig;\n\n/**\n * Platform-specific default configurations\n */\nconst platformDefaults = {\n node: {\n platform: {\n type: 'node' as const,\n node: {\n server: {\n port: 3000,\n host: '0.0.0.0',\n cors: true,\n timeout: 30000,\n },\n storage: {\n type: 'memory' as const,\n },\n },\n },\n },\n cloudflare: {\n platform: {\n type: 'cloudflare' as const,\n cloudflare: {\n workers: {\n cpuMs: 50,\n memoryMb: 128,\n },\n kvNamespaces: [],\n environmentVariables: [],\n },\n },\n },\n vercel: {\n platform: {\n type: 'vercel' as const,\n vercel: {\n environmentVariables: [],\n edgeRuntime: {},\n },\n },\n },\n};\n\n/**\n * Get default configuration for a specific platform\n *\n * Returns the base default config merged with platform-specific defaults.\n *\n * @param platform - Platform type ('node', 'cloudflare', or 'vercel')\n * @returns Platform-specific default configuration\n *\n * @example\n * ```typescript\n * const nodeConfig = getDefaultConfigForPlatform('node');\n * const cloudflareConfig = getDefaultConfigForPlatform('cloudflare');\n * ```\n */\nexport function getDefaultConfigForPlatform(\n platform: 'node' | 'cloudflare' | 'vercel'\n): MCPIServerConfig {\n const platformDefault = platformDefaults[platform];\n\n return {\n ...defaultConfig,\n platform: platformDefault.platform,\n } as MCPIServerConfig;\n}\n\n/**\n * Deep merge utility for objects\n */\nfunction deepMerge<T extends Record<string, unknown>>(target: T, source: Partial<T>): T {\n const result = { ...target } as T;\n\n for (const key in source) {\n const sourceValue = source[key];\n // The leading truthy check already excludes null, so an explicit\n // `!== null` here is redundant (and flagged as such by static analysis).\n if (sourceValue && typeof sourceValue === 'object' && !Array.isArray(sourceValue)) {\n const targetValue = target[key];\n if (targetValue && typeof targetValue === 'object' && !Array.isArray(targetValue)) {\n result[key] = deepMerge(\n targetValue as Record<string, unknown>,\n sourceValue as Record<string, unknown>\n ) as T[Extract<keyof T, string>];\n }\n } else if (sourceValue !== undefined) {\n result[key] = sourceValue as T[Extract<keyof T, string>];\n }\n }\n\n return result;\n}\n\n/**\n * Merge partial configuration with defaults\n *\n * Deep merges a partial configuration object with the base defaults,\n * ensuring all required fields are present.\n *\n * @param partial - Partial configuration to merge with defaults\n * @returns Complete configuration with defaults applied\n *\n * @example\n * ```typescript\n * const config = mergeWithDefaults({\n * proofing: { enabled: false },\n * identity: { environment: 'production' }\n * });\n * ```\n */\nexport function mergeWithDefaults(partial: Partial<MCPIServerConfig>): MCPIServerConfig {\n return deepMerge(\n defaultConfig as unknown as Record<string, unknown>,\n partial as unknown as Record<string, unknown>\n ) as unknown as MCPIServerConfig;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAoCA,MAAM,mBAAmB,EACtB,OAAO,CAAC,CACR,MAAM,qBAAiB,gDAAgD,CAAC,CACxE,IAAI,GAAG;AA+PV,MAAa,8BAA8B,EAAE,OAAO;CAClD,OAAO,EAAE,QAAQ,eAAe;CAChC,MAAM,EAAE,KAAK;EAAC;EAAU;EAAS;CAAY,CAAC;CAC9C,aAAa,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,SAA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;;;;;;;;;;;;;;AAmBA,SAAgB,kBAAkB,SAAsD;CACtF,OAAO,UACL,eACA,OACF;AACF"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../src/tool-protection/index.ts","../../../src/mcpi/dashboard-config/schemas.ts","../../../src/mcpi/dashboard-config/default-config.ts"],"sourcesContent":["/**\n * KYA-OS Tool Protection Specification\n *\n * Core types for tool protection with delegation requirements.\n *\n * Consent Flow: type='none' → 2 screens, others → 3 screens (Auth→Consent→Success).\n * DelegationCredential (VC) is created when user confirms on Consent Screen.\n *\n * Ported into checkpoint-shared from `@kya-os/contracts/tool-protection` as part\n * of the E6 / C-series decommission (#2914 / #2917): checkpoint owns its product\n * types now that the DIF `@kya-os/mcp` core is protocol-only. The single external\n * dependency (`envVarNameSchema` from the contracts `vault` module) is inlined\n * below so this module pulls nothing from `@kya-os/contracts`.\n *\n * @module @kya-os/checkpoint-shared/tool-protection\n */\n\nimport { z } from 'zod';\n\nexport {\n defaultRequiredScopes,\n executeScopeFor,\n MAX_DEFAULT_SCOPE_LENGTH,\n type ToolScopeSources,\n} from './default-required-scopes';\n\n/**\n * Pattern for valid environment variable names (e.g., X_API_KEY, OPENAI_KEY).\n * Inlined from the former `@kya-os/contracts/vault` `ENV_VAR_PATTERN`.\n */\nconst ENV_VAR_PATTERN = /^[A-Z][A-Z0-9_]*$/;\n\n/**\n * Validates an env var name used by the `apikey` authorization requirement.\n * Inlined from the former `@kya-os/contracts/vault` `envVarNameSchema`.\n */\nconst envVarNameSchema = z\n .string()\n .regex(ENV_VAR_PATTERN, 'Must be a valid env var name (e.g., X_API_KEY)')\n .max(255);\n\n/**\n * Authorization Requirement - what auth is needed BEFORE consent screen.\n *\n * Types: none (2 screens), oauth/password/mdl/idv (3 screens), verifiable_credential (future).\n * The VC output is always a DelegationCredential created on consent confirmation.\n */\nexport type AuthorizationRequirement =\n | {\n /**\n * @deprecated Use 'oauth2' instead. Will be removed in v2.0.0.\n */\n type: 'oauth';\n provider: string; // \"github\", \"google\", etc.\n requiredScopes?: string[]; // Provider-specific scopes\n }\n | {\n /** OAuth 2.0 provider authentication (canonical) */\n type: 'oauth2';\n provider: string; // \"github\", \"google\", etc.\n requiredScopes?: string[]; // Provider-specific scopes\n }\n | {\n type: 'password';\n provider: string;\n }\n | {\n type: 'mdl';\n issuer: string; // MDL issuer DID or identifier\n credentialType?: string; // Specific MDL credential type\n }\n | {\n type: 'idv';\n provider: string; // IDV provider name\n verificationLevel?: 'basic' | 'enhanced' | 'loa3';\n }\n | {\n /** Require user to present an existing VC */\n type: 'verifiable_credential';\n credentialType: string;\n issuer?: string;\n }\n | {\n /**\n * @deprecated Use 'verifiable_credential' instead. Will be removed in v2.0.0.\n * This is an alias for 'verifiable_credential' for backward compatibility.\n */\n type: 'credential';\n credentialType: string;\n issuer?: string;\n }\n | {\n /** WebAuthn/Passkey authentication */\n type: 'webauthn';\n rpId?: string; // Relying Party ID\n userVerification?: 'required' | 'preferred' | 'discouraged';\n }\n | {\n /** Sign-In with Ethereum (EIP-4361) */\n type: 'siwe';\n chainId?: number; // Ethereum chain ID (1 = mainnet, 137 = polygon, etc.)\n domain?: string; // Domain for SIWE message\n }\n | {\n /** API Key from per-user vault */\n type: 'apikey';\n envVarNames: string[]; // Env var names to resolve from vault (e.g., ['X_API_KEY'])\n headerMapping: Record<string, string>; // Map env var → HTTP header (e.g., { X_API_KEY: 'X-API-Key' })\n }\n | {\n type: 'none'; // Just consent checkbox, no external auth\n };\n\n/** Canonical authorization type values for type safety */\nexport const AUTHORIZATION_TYPES = {\n /** @deprecated Use OAUTH2 instead. Will be removed in v2.0.0. */\n OAUTH: 'oauth',\n /** OAuth 2.0 provider authentication (canonical) */\n OAUTH2: 'oauth2',\n PASSWORD: 'password',\n MDL: 'mdl',\n IDV: 'idv',\n VERIFIABLE_CREDENTIAL: 'verifiable_credential',\n /** WebAuthn/Passkey authentication */\n WEBAUTHN: 'webauthn',\n /** Sign-In with Ethereum (EIP-4361) */\n SIWE: 'siwe',\n /** API Key from per-user vault */\n APIKEY: 'apikey',\n NONE: 'none',\n} as const;\n\nexport type AuthorizationType = (typeof AUTHORIZATION_TYPES)[keyof typeof AUTHORIZATION_TYPES];\n\n/**\n * Tool Protection Definition\n *\n * Defines the protection requirements for a tool as per KYA-OS spec.\n * This is the canonical definition that all implementations must follow.\n */\nexport interface ToolProtection {\n /**\n * Whether this tool requires explicit delegation from the user\n */\n requiresDelegation: boolean;\n\n /**\n * The scopes required to execute this tool\n * Format: \"resource:action\" (e.g., \"files:read\", \"payment:send\")\n */\n requiredScopes: string[];\n\n /**\n * Risk level classification for the tool\n * Used to determine appropriate authorization flows\n */\n riskLevel?: 'low' | 'medium' | 'high' | 'critical';\n\n /**\n * OAuth provider name for this tool (Phase 2+)\n * If specified, this tool will use the specified OAuth provider.\n * If not specified, provider will be resolved via fallback strategies.\n * @example \"github\", \"google\", \"microsoft\"\n * @deprecated Use `authorization` field instead. Will be removed in Phase 3.\n */\n oauthProvider?: string;\n\n /**\n * Authorization requirement for this tool\n * If requiresDelegation=true, authorization must be specified (or inferred from legacy fields)\n */\n authorization?: AuthorizationRequirement;\n}\n\n/**\n * Tool Protection Map\n *\n * A mapping of tool names to their protection configurations.\n * This is how tool protections are typically stored and transmitted.\n */\nexport type ToolProtectionMap = Record<string, ToolProtection>;\n\n/**\n * Partial tool protection for updates (all fields optional)\n * Use this when accepting partial updates to tool protection settings\n */\nexport type PartialToolProtection = Partial<ToolProtection>;\n\n/**\n * Tool protection with explicit optional fields\n * Useful when TypeScript's Partial<T> doesn't preserve optional property access\n * Supports explicit null values to clear fields\n */\nexport type ToolProtectionUpdate = {\n requiresDelegation?: boolean;\n requiredScopes?: string[];\n riskLevel?: 'low' | 'medium' | 'high' | 'critical';\n oauthProvider?: string | null; // null explicitly clears the field\n authorization?: AuthorizationRequirement | null; // null explicitly clears the field\n};\n\n/**\n * Tool Protection Response\n *\n * The response format when querying for tool protections.\n * Used by tool protection services and APIs.\n */\nexport interface ToolProtectionResponse {\n /**\n * The tool protections keyed by tool name\n */\n toolProtections: ToolProtectionMap;\n\n /**\n * Optional metadata about the response\n */\n metadata?: {\n /**\n * When this configuration was last updated\n */\n lastUpdated?: string;\n\n /**\n * Version of the configuration\n */\n version?: string;\n\n /**\n * Source of the configuration\n */\n source?: string;\n };\n}\n\n/**\n * Delegation Required Error Data\n *\n * The standardized error data returned when a tool requires delegation\n * but none was provided. This is part of the KYA-OS error protocol.\n */\nexport interface DelegationRequiredErrorData {\n /**\n * The name of the tool that requires delegation\n */\n toolName: string;\n\n /**\n * The scopes required for this tool\n */\n requiredScopes: string[];\n\n /**\n * URL where the user can provide consent/delegation\n */\n consentUrl?: string;\n\n /**\n * Alternative field for consent URL (for compatibility)\n */\n authorizationUrl?: string;\n\n /**\n * Additional context about why delegation is required\n */\n reason?: string;\n}\n\n/**\n * Auth Required Error Data\n *\n * Machine-readable error returned when a tool requires per-user auth\n * (vault secret, OAuth, credential) but none is configured and no\n * static env fallback exists. MCP clients use this to present\n * actionable guidance (e.g., \"Add your PulseMCP API key\" with a link).\n *\n * Closes VAULT-11\n */\nexport interface AuthRequiredErrorData {\n /** Discriminator — always \"auth_required\" */\n error: 'auth_required';\n\n /** Which auth mechanism is missing */\n type: 'apikey' | 'oauth' | 'credential';\n\n /** For apikey: which env vars are missing */\n envVarNames?: string[];\n\n /** Dashboard URL where the user can configure the missing auth */\n configUrl: string;\n\n /** Human-readable fallback message */\n message: string;\n}\n\nexport const AuthRequiredErrorDataSchema = z.object({\n error: z.literal('auth_required'),\n type: z.enum(['apikey', 'oauth', 'credential']),\n envVarNames: z.array(z.string()).optional(),\n configUrl: z.string(),\n message: z.string(),\n});\n\n/**\n * Error class thrown when required auth is missing and no fallback exists.\n *\n * Caught by the tool-call handler in agent.ts and serialized as a\n * machine-readable MCP tool result so clients can present actionable UI.\n */\nexport class AuthRequiredError extends Error {\n public readonly type: AuthRequiredErrorData['type'];\n public readonly envVarNames?: string[];\n public readonly configUrl: string;\n\n constructor(opts: {\n type: AuthRequiredErrorData['type'];\n envVarNames?: string[];\n configUrl: string;\n message?: string;\n }) {\n const message =\n opts.message ??\n (opts.type === 'apikey' && opts.envVarNames?.length\n ? `API key required: configure ${opts.envVarNames.join(', ')} in your project settings.`\n : 'Authentication required to use this tool.');\n super(message);\n this.name = 'AuthRequiredError';\n this.type = opts.type;\n this.envVarNames = opts.envVarNames;\n this.configUrl = opts.configUrl;\n }\n\n /** Serialize to the wire format MCP clients expect */\n toJSON(): AuthRequiredErrorData {\n return {\n error: 'auth_required',\n type: this.type,\n ...(this.envVarNames && { envVarNames: this.envVarNames }),\n configUrl: this.configUrl,\n message: this.message,\n };\n }\n}\n\n/**\n * Legacy tool protection format (pre-authorization field)\n * Used during migration period to support both old and new formats\n */\nexport type LegacyToolProtection = Omit<ToolProtection, 'authorization'> & {\n oauthProvider?: string;\n};\n\n/**\n * Union type for both legacy and new formats\n * Useful during migration period when accepting tool protection input\n */\nexport type ToolProtectionInput = ToolProtection | LegacyToolProtection;\n\n/**\n * Zod Schemas for Validation\n */\n\nexport const AuthorizationRequirementSchema = z.discriminatedUnion('type', [\n // Deprecated: 'oauth' is an alias for 'oauth2'\n // Will be removed in v2.0.0. Use 'oauth2' instead.\n z.object({\n type: z.literal('oauth'),\n provider: z.string(),\n requiredScopes: z.array(z.string()).optional(),\n }),\n // OAuth 2.0 provider authentication (canonical)\n z.object({\n type: z.literal('oauth2'),\n provider: z.string(),\n requiredScopes: z.array(z.string()).optional(),\n }),\n z.object({\n type: z.literal('password'),\n provider: z.string(),\n }),\n z.object({\n type: z.literal('mdl'),\n issuer: z.string(),\n credentialType: z.string().optional(),\n }),\n z.object({\n type: z.literal('idv'),\n provider: z.string(),\n verificationLevel: z.enum(['basic', 'enhanced', 'loa3']).optional(),\n }),\n z.object({\n type: z.literal('verifiable_credential'),\n credentialType: z.string(),\n issuer: z.string().optional(),\n }),\n // Deprecated: 'credential' is an alias for 'verifiable_credential'\n // Will be removed in v2.0.0. Use 'verifiable_credential' instead.\n z.object({\n type: z.literal('credential'),\n credentialType: z.string(),\n issuer: z.string().optional(),\n }),\n // WebAuthn/Passkey authentication\n z.object({\n type: z.literal('webauthn'),\n rpId: z.string().optional(),\n userVerification: z.enum(['required', 'preferred', 'discouraged']).optional(),\n }),\n // Sign-In with Ethereum (EIP-4361)\n z.object({\n type: z.literal('siwe'),\n chainId: z.number().optional(),\n domain: z.string().optional(),\n }),\n // API Key from per-user vault\n z.object({\n type: z.literal('apikey'),\n envVarNames: z.array(envVarNameSchema).min(1),\n headerMapping: z.record(z.string(), z.string()),\n }),\n z.object({\n type: z.literal('none'),\n }),\n]);\n\nexport const ToolProtectionSchema = z.object({\n requiresDelegation: z.boolean(),\n requiredScopes: z.array(z.string()),\n riskLevel: z.enum(['low', 'medium', 'high', 'critical']).optional(),\n oauthProvider: z.string().optional(), // Phase 2: Tool-specific OAuth provider\n authorization: AuthorizationRequirementSchema.optional(),\n});\n\nexport const ToolProtectionMapSchema = z.record(z.string(), ToolProtectionSchema);\n\nexport const ToolProtectionResponseSchema = z.object({\n toolProtections: ToolProtectionMapSchema,\n metadata: z\n .object({\n lastUpdated: z.string().optional(),\n version: z.string().optional(),\n source: z.string().optional(),\n })\n .optional(),\n});\n\nexport const DelegationRequiredErrorDataSchema = z.object({\n toolName: z.string(),\n requiredScopes: z.array(z.string()),\n consentUrl: z.string().optional(),\n authorizationUrl: z.string().optional(),\n reason: z.string().optional(),\n});\n\n/**\n * Type Guards\n */\n\nexport function isToolProtection(obj: unknown): obj is ToolProtection {\n return ToolProtectionSchema.safeParse(obj).success;\n}\n\nexport function isToolProtectionMap(obj: unknown): obj is ToolProtectionMap {\n return ToolProtectionMapSchema.safeParse(obj).success;\n}\n\nexport function isToolProtectionResponse(obj: unknown): obj is ToolProtectionResponse {\n return ToolProtectionResponseSchema.safeParse(obj).success;\n}\n\nexport function isDelegationRequiredErrorData(obj: unknown): obj is DelegationRequiredErrorData {\n return DelegationRequiredErrorDataSchema.safeParse(obj).success;\n}\n\n/**\n * Type guard to check if an object is a valid AuthorizationRequirement\n */\nexport function isAuthorizationRequirement(obj: unknown): obj is AuthorizationRequirement {\n return AuthorizationRequirementSchema.safeParse(obj).success;\n}\n\n/**\n * Type guard to check if a ToolProtection has OAuth authorization\n * Checks for both 'oauth' (deprecated) and 'oauth2' (canonical)\n */\nexport function hasOAuthAuthorization(\n protection: ToolProtection\n): protection is ToolProtection & { authorization: { type: 'oauth' | 'oauth2' } } {\n return protection.authorization?.type === 'oauth' || protection.authorization?.type === 'oauth2';\n}\n\n/**\n * Type guard to check if a ToolProtection has password authorization\n */\nexport function hasPasswordAuthorization(\n protection: ToolProtection\n): protection is ToolProtection & { authorization: { type: 'password' } } {\n return protection.authorization?.type === 'password';\n}\n\n/**\n * Type guard to check if a ToolProtection requires a Verifiable Credential\n *\n * Note: Also returns true for deprecated 'credential' type (normalized to verifiable_credential)\n */\nexport function hasVerifiableCredentialAuthorization(\n protection: ToolProtection\n): protection is ToolProtection & {\n authorization: { type: 'verifiable_credential' | 'credential' };\n} {\n return (\n protection.authorization?.type === 'verifiable_credential' ||\n protection.authorization?.type === 'credential'\n );\n}\n\n/**\n * Type guard to check if a ToolProtection has API Key (vault) authorization\n */\nexport function hasApiKeyAuthorization(\n protection: ToolProtection\n): protection is ToolProtection & { authorization: { type: 'apikey' } } {\n return protection.authorization?.type === 'apikey';\n}\n\n/**\n * Validation Functions\n */\n\nexport function validateToolProtection(obj: unknown): ToolProtection {\n return ToolProtectionSchema.parse(obj);\n}\n\nexport function validateToolProtectionMap(obj: unknown): ToolProtectionMap {\n return ToolProtectionMapSchema.parse(obj);\n}\n\nexport function validateToolProtectionResponse(obj: unknown): ToolProtectionResponse {\n return ToolProtectionResponseSchema.parse(obj);\n}\n\nexport function validateDelegationRequiredErrorData(obj: unknown): DelegationRequiredErrorData {\n return DelegationRequiredErrorDataSchema.parse(obj);\n}\n\n/**\n * Utility Functions\n */\n\n/**\n * Check if a tool requires delegation\n */\nexport function toolRequiresDelegation(toolName: string, protections: ToolProtectionMap): boolean {\n const protection = protections[toolName];\n return protection?.requiresDelegation ?? false;\n}\n\n/**\n * Get required scopes for a tool\n */\nexport function getToolRequiredScopes(toolName: string, protections: ToolProtectionMap): string[] {\n const protection = protections[toolName];\n return protection?.requiredScopes ?? [];\n}\n\n/**\n * Get risk level for a tool\n */\nexport function getToolRiskLevel(\n toolName: string,\n protections: ToolProtectionMap\n): ToolProtection['riskLevel'] | undefined {\n return protections[toolName]?.riskLevel;\n}\n\n/**\n * Create a delegation required error\n */\nexport function createDelegationRequiredError(\n toolName: string,\n requiredScopes: string[],\n consentUrl?: string\n): DelegationRequiredErrorData {\n return {\n toolName,\n requiredScopes,\n consentUrl,\n authorizationUrl: consentUrl, // Include both for compatibility\n };\n}\n\n/**\n * Normalize tool protection configuration\n * Migrates legacy oauthProvider field to authorization object\n *\n * - Migrates `oauthProvider` → `authorization: { type: 'oauth', provider: ... }`\n * - Ensures `authorization` field is present when `requiresDelegation=true`\n * - Returns fully normalized ToolProtection object\n *\n * @param raw - Raw tool protection data (may have legacy fields or be partial)\n * @returns Normalized ToolProtection object\n *\n * // TODO: Remove normalizeToolProtection() when all tools migrated\n */\nexport function normalizeToolProtection(\n raw: ToolProtection | PartialToolProtection\n): ToolProtection {\n // Ensure we have required fields (provide defaults for partial input)\n const normalized: ToolProtection = {\n requiresDelegation: raw.requiresDelegation ?? false,\n requiredScopes: raw.requiredScopes ?? [],\n ...(raw.riskLevel && { riskLevel: raw.riskLevel }),\n ...(raw.oauthProvider && { oauthProvider: raw.oauthProvider }),\n };\n\n // If authorization is already present, use it\n if (raw.authorization) {\n normalized.authorization = raw.authorization;\n return normalized;\n }\n\n // Migrate oauthProvider to authorization\n if (raw.oauthProvider) {\n normalized.authorization = {\n type: 'oauth',\n provider: raw.oauthProvider,\n };\n // Keep oauthProvider for backward compatibility\n return normalized;\n }\n\n // Default for requiresDelegation=true without specific auth: type='none' (consent only)\n // But ONLY if authorization is missing entirely\n if (normalized.requiresDelegation && !normalized.authorization && !normalized.oauthProvider) {\n // We don't automatically set type='none' here to allow\n // ProviderResolver to do its scope inference fallback logic.\n // The fallback logic will eventually be moved into an AuthorizationService.\n return normalized;\n }\n\n return normalized;\n}\n\n// =============================================================================\n// CONSENT PROVIDER TYPES - Records what auth method was USED (not required)\n// =============================================================================\n\n/** Consent provider types - stored in delegation metadata to track auth method used */\nexport const CONSENT_PROVIDER_TYPES = {\n /** Consent-only mode - no authentication, just clickwrap agreement */\n NONE: 'none',\n /** OAuth2 provider authentication */\n OAUTH2: 'oauth2',\n /** Password-based authentication (email/password, username/password) */\n PASSWORD: 'password',\n /** @deprecated Use PASSWORD instead. Alias for backward compatibility */\n CREDENTIAL: 'credential',\n /** Email magic link authentication */\n MAGIC_LINK: 'magic_link',\n /** One-time password (SMS/email code) */\n OTP: 'otp',\n} as const;\n\nexport type ConsentProviderType =\n (typeof CONSENT_PROVIDER_TYPES)[keyof typeof CONSENT_PROVIDER_TYPES];\n\n/**\n * Determine consent provider type based on available identity information\n *\n * This is the single source of truth for consent provider type determination.\n *\n * @param hasOAuthIdentity - Whether OAuth identity is available\n * @param isPasswordFlow - Whether this is a password/credential flow\n * @param isMagicLinkFlow - Whether this is a magic link flow\n * @param isOtpFlow - Whether this is an OTP flow\n * @returns The consent provider type\n */\nexport function determineConsentProviderType(\n hasOAuthIdentity: boolean,\n isPasswordFlow: boolean = false,\n isMagicLinkFlow: boolean = false,\n isOtpFlow: boolean = false\n): ConsentProviderType {\n if (isPasswordFlow) {\n return CONSENT_PROVIDER_TYPES.PASSWORD;\n }\n if (isMagicLinkFlow) {\n return CONSENT_PROVIDER_TYPES.MAGIC_LINK;\n }\n if (isOtpFlow) {\n return CONSENT_PROVIDER_TYPES.OTP;\n }\n if (hasOAuthIdentity) {\n return CONSENT_PROVIDER_TYPES.OAUTH2;\n }\n return CONSENT_PROVIDER_TYPES.NONE;\n}\n\n/**\n * Get a human-readable label for an authorization requirement type\n */\nexport function getAuthorizationTypeLabel(auth: AuthorizationRequirement): string {\n switch (auth.type) {\n case 'oauth':\n case 'oauth2':\n return auth.provider\n ? auth.provider.charAt(0).toUpperCase() + auth.provider.slice(1)\n : 'OAuth Provider';\n case 'password':\n return 'Password Authentication';\n case 'mdl':\n return \"Mobile Driver's License\";\n case 'idv':\n return 'Identity Verification';\n case 'verifiable_credential':\n return auth.credentialType || 'Verifiable Credential';\n case 'credential':\n // Deprecated: treat as verifiable_credential\n return auth.credentialType || 'Verifiable Credential';\n case 'webauthn':\n return 'Passkey / WebAuthn';\n case 'siwe':\n return 'Sign-In with Ethereum';\n case 'apikey':\n return 'API Key (Vault)';\n case 'none':\n return 'Consent Only';\n default: {\n // Closed union — this default is unreachable for well-typed input.\n return 'Unknown';\n }\n }\n}\n\n/**\n * Get a unique key for an authorization requirement (for React keys, caching, etc.)\n */\nexport function getAuthorizationTypeKey(auth: AuthorizationRequirement): string {\n switch (auth.type) {\n case 'oauth':\n // Keep original key format for backward compatibility with existing cache entries\n // Handle undefined provider gracefully (may come from loose API response types)\n return auth.provider ? `oauth:${auth.provider}` : 'oauth';\n case 'oauth2':\n return auth.provider ? `oauth2:${auth.provider}` : 'oauth2';\n case 'password':\n return auth.provider ? `password:${auth.provider}` : 'password';\n case 'mdl':\n // Keep trailing colon for backward compatibility with existing cache entries\n return `mdl:${auth.issuer || 'unknown'}:${auth.credentialType || ''}`;\n case 'idv':\n // Keep trailing colon for backward compatibility with existing cache entries\n return `idv:${auth.provider || 'unknown'}:${auth.verificationLevel || ''}`;\n case 'verifiable_credential':\n return `vc:${auth.issuer || 'any'}:${auth.credentialType || 'unknown'}`;\n case 'credential':\n // Deprecated: treat as verifiable_credential\n return `vc:${auth.issuer || 'any'}:${auth.credentialType || 'unknown'}`;\n case 'webauthn':\n return `webauthn:${auth.rpId || 'default'}`;\n case 'siwe':\n return `siwe:${auth.chainId || 1}:${auth.domain || 'any'}`;\n case 'apikey':\n return `apikey:${[...auth.envVarNames].sort().join(',')}`;\n case 'none':\n return 'none';\n default: {\n // Closed union — this default is unreachable for well-typed input.\n return 'unknown';\n }\n }\n}\n\n/**\n * Normalize authorization requirement type\n *\n * Normalizes deprecated types to their canonical equivalents:\n * - 'oauth' → 'oauth2'\n * - 'credential' → 'verifiable_credential'\n *\n * This function should be called at runtime boundaries when processing\n * authorization requirements.\n *\n * @param auth - Authorization requirement (may contain deprecated types)\n * @param options - Normalization options\n * @returns Normalized authorization requirement\n *\n * @example\n * ```typescript\n * const normalized = normalizeAuthorizationType(\n * { type: 'oauth', provider: 'github' },\n * { warn: true }\n * );\n * // Returns: { type: 'oauth2', provider: 'github' }\n * // Logs: DEPRECATION warning\n * ```\n */\nexport function normalizeAuthorizationType(\n auth: AuthorizationRequirement,\n options: { warn?: boolean; logger?: (message: string) => void } = {}\n): AuthorizationRequirement {\n const { warn = true, logger = console.warn } = options;\n\n // Normalize 'oauth' to 'oauth2'\n if (auth.type === 'oauth') {\n if (warn) {\n logger(\n `DEPRECATION: Authorization type 'oauth' is deprecated and will be removed in v2.0.0. ` +\n `Please update to 'oauth2'. ` +\n `See https://github.com/modelcontextprotocol-identity/xmcp-i/blob/main/docs/migrations/oauth-to-oauth2.md`\n );\n }\n\n // Normalize to oauth2\n const normalized = {\n type: 'oauth2' as const,\n provider: auth.provider,\n ...(auth.requiredScopes !== undefined && { requiredScopes: auth.requiredScopes }),\n };\n\n return normalized;\n }\n\n // Normalize 'credential' to 'verifiable_credential'\n if (auth.type === 'credential') {\n if (warn) {\n logger(\n `DEPRECATION: Authorization type 'credential' is deprecated and will be removed in v2.0.0. ` +\n `Please update to 'verifiable_credential'. ` +\n `See https://github.com/modelcontextprotocol-identity/xmcp-i/blob/main/docs/migrations/credential-to-verifiable_credential.md`\n );\n }\n\n // Normalize to verifiable_credential\n const normalized = {\n type: 'verifiable_credential' as const,\n credentialType: auth.credentialType,\n ...(auth.issuer !== undefined && { issuer: auth.issuer }),\n };\n\n return normalized;\n }\n\n // No normalization needed\n return auth;\n}\n","/**\n * Dashboard Configuration Zod Schemas\n *\n * Runtime validation schemas for dashboard configuration types.\n * Used for validating API requests and responses.\n *\n * Ported into checkpoint-shared from `@kya-os/contracts/dashboard-config` as part\n * of the E6 / C-series decommission (#2914 / #2917). The only cross-module\n * dependency (`ToolProtectionSchema`/`ToolProtectionMapSchema`) now resolves to\n * the local `../../tool-protection` module.\n *\n * @module @kya-os/checkpoint-shared/dashboard-config\n */\n\nimport { z } from 'zod';\nimport { ToolProtectionMapSchema } from '../../tool-protection';\n\n/**\n * Identity configuration schema\n */\nexport const identityConfigSchema = z.object({\n /**\n * @deprecated Use serverDid instead. Will be removed in v2.0\n */\n agentDid: z.string().min(1).optional(),\n serverDid: z.string().min(1),\n environment: z.enum(['development', 'production']),\n storageLocation: z.enum(['cloudflare-kv', 'file-system', 'env-vars']),\n});\n\n/**\n * Proofing configuration schema\n */\nexport const proofingConfigSchema = z.object({\n enabled: z.boolean(),\n destinations: z.array(\n z.object({\n type: z.enum(['agentshield', 'kta', 'custom']),\n apiUrl: z.string().url(),\n apiKey: z.string().optional(),\n })\n ),\n batchQueue: z.object({\n maxBatchSize: z.number().int().positive().default(10),\n flushIntervalMs: z.number().int().positive().default(5000),\n maxRetries: z.number().int().nonnegative().default(3),\n }),\n});\n\n/**\n * Delegation verifier type schema\n */\nconst delegationVerifierTypeSchema = z.enum([\n 'agentshield',\n 'kta',\n 'memory',\n 'cloudflare-kv',\n 'redis',\n 'dynamodb',\n 'custom',\n]);\n\n/**\n * Delegation configuration schema\n */\nexport const delegationConfigSchema = z.object({\n enabled: z.boolean(),\n enforceStrictly: z.boolean(),\n verifier: z.object({\n type: delegationVerifierTypeSchema,\n apiUrl: z.string().url().optional(),\n cacheTtl: z.number().int().positive().optional(),\n }),\n authorization: z.object({\n authorizationUrl: z.string().url().optional(),\n minReputationScore: z.number().int().min(0).max(100).optional(),\n resumeTokenTtl: z.number().int().positive().optional(),\n requireAuthForUnknown: z.boolean().optional(),\n }),\n});\n\n/**\n * Tool protection configuration schema\n */\nexport const toolProtectionConfigSchema = z.object({\n source: z.enum(['agentshield', 'inline', 'file']),\n agentShield: z\n .object({\n apiUrl: z.string().url(),\n cacheTtl: z.number().int().positive(),\n })\n .optional(),\n fallback: ToolProtectionMapSchema.optional(),\n});\n\n/** Merged tool protection config with embedded tools */\nexport const mergedToolProtectionConfigSchema = toolProtectionConfigSchema.extend({\n tools: ToolProtectionMapSchema,\n});\n\n/**\n * Audit configuration schema\n */\nexport const auditConfigSchema = z.object({\n enabled: z.boolean(),\n includeProofHashes: z.boolean(),\n includePayloads: z.boolean(),\n});\n\n/**\n * Session configuration schema\n */\nexport const sessionConfigSchema = z.object({\n timestampSkewSeconds: z.number().int().positive().default(120),\n ttlMinutes: z.number().int().positive().default(30),\n absoluteLifetime: z.number().int().positive().optional(),\n});\n\n/**\n * Cloudflare platform configuration schema\n */\nexport const cloudflarePlatformConfigSchema = z.object({\n workers: z.object({\n cpuMs: z.number().int().positive().default(50),\n memoryMb: z.number().int().positive().default(128),\n }),\n kvNamespaces: z.array(\n z.object({\n name: z.string().min(1),\n purpose: z.enum(['sessions', 'delegations', 'cache', 'general']),\n })\n ),\n environmentVariables: z.array(\n z.object({\n name: z.string().min(1),\n value: z.string(),\n source: z.enum(['wrangler.toml', 'secrets', '.dev.vars']),\n })\n ),\n});\n\n/**\n * Node.js platform configuration schema\n */\nexport const nodePlatformConfigSchema = z.object({\n server: z.object({\n port: z.number().int().positive().default(3000),\n host: z.string().default('0.0.0.0'),\n cors: z.boolean().default(true),\n timeout: z.number().int().positive().default(30000),\n }),\n storage: z.object({\n type: z.enum(['memory', 'redis', 'postgres', 'mongodb']),\n connection: z\n .object({\n host: z.string().optional(),\n port: z.number().int().positive().optional(),\n database: z.string().optional(),\n })\n .optional(),\n }),\n});\n\n/**\n * Vercel platform configuration schema\n */\nexport const vercelPlatformConfigSchema = z.object({\n environmentVariables: z.array(\n z.object({\n name: z.string().min(1),\n value: z.string(),\n source: z.enum(['vercel-dashboard', '.env.local']),\n })\n ),\n edgeRuntime: z\n .object({\n maxDuration: z.number().int().positive().optional(),\n regions: z.array(z.string()).optional(),\n })\n .optional(),\n});\n\n/**\n * Platform configuration schema\n */\nexport const platformConfigSchema = z.object({\n type: z.enum(['cloudflare', 'node', 'vercel']),\n cloudflare: cloudflarePlatformConfigSchema.optional(),\n node: nodePlatformConfigSchema.optional(),\n vercel: vercelPlatformConfigSchema.optional(),\n});\n\n/**\n * Metadata schema\n */\nexport const configMetadataSchema = z.object({\n version: z.string(),\n lastUpdated: z.string(),\n source: z.enum(['dashboard', 'code', 'mixed']),\n serverUrl: z.string().url().optional(),\n deploymentStatus: z.enum(['active', 'inactive', 'error']).optional(),\n});\n\n/**\n * Complete KYA-OS Server Configuration schema\n */\nexport const mcpIServerConfigSchema = z.object({\n identity: identityConfigSchema,\n proofing: proofingConfigSchema,\n delegation: delegationConfigSchema,\n toolProtection: toolProtectionConfigSchema,\n audit: auditConfigSchema,\n session: sessionConfigSchema,\n platform: platformConfigSchema,\n metadata: configMetadataSchema,\n});\n\n/** Merged KYA-OS Server Configuration schema @since 1.6.0 */\nexport const mergedMcpIServerConfigSchema = mcpIServerConfigSchema.extend({\n toolProtection: mergedToolProtectionConfigSchema,\n});\n\n/**\n * Get server config request schema\n */\nexport const getServerConfigRequestSchema = z.object({\n projectId: z.string().min(1),\n});\n\n/**\n * Get server config response schema\n */\nexport const getServerConfigResponseSchema = z.object({\n success: z.boolean(),\n data: z.object({\n config: mcpIServerConfigSchema,\n }),\n metadata: z\n .object({\n requestId: z.string().optional(),\n timestamp: z.string().optional(),\n })\n .optional(),\n});\n\n/** Get merged server config response schema @since 1.6.0 */\nexport const getMergedServerConfigResponseSchema = z.object({\n success: z.boolean(),\n data: z.object({\n config: mergedMcpIServerConfigSchema,\n /** @deprecated Use config.toolProtection.tools instead */\n toolProtections: ToolProtectionMapSchema.optional(),\n }),\n metadata: z\n .object({\n requestId: z.string().optional(),\n timestamp: z.string().optional(),\n cachedUntil: z.string().optional(),\n })\n .optional(),\n});\n\n/**\n * Update server config request schema\n */\nexport const updateServerConfigRequestSchema = z.object({\n projectId: z.string().min(1),\n config: mcpIServerConfigSchema.partial(),\n});\n\n/**\n * Update server config response schema\n */\nexport const updateServerConfigResponseSchema = z.object({\n success: z.boolean(),\n data: z.object({\n config: mcpIServerConfigSchema,\n changes: z.array(\n z.object({\n path: z.string(),\n oldValue: z.unknown(),\n newValue: z.unknown(),\n })\n ),\n }),\n metadata: z\n .object({\n requestId: z.string().optional(),\n timestamp: z.string().optional(),\n })\n .optional(),\n});\n\n/**\n * Validate server config request schema\n */\nexport const validateServerConfigRequestSchema = z.object({\n projectId: z.string().min(1),\n config: mcpIServerConfigSchema.partial(),\n});\n\n/**\n * Validate server config response schema\n */\nexport const validateServerConfigResponseSchema = z.object({\n success: z.boolean(),\n data: z.object({\n valid: z.boolean(),\n errors: z\n .array(\n z.object({\n path: z.string(),\n message: z.string(),\n code: z.string(),\n })\n )\n .optional(),\n warnings: z\n .array(\n z.object({\n path: z.string(),\n message: z.string(),\n })\n )\n .optional(),\n }),\n metadata: z\n .object({\n requestId: z.string().optional(),\n timestamp: z.string().optional(),\n })\n .optional(),\n});\n","/**\n * Default Configuration for KYA-OS Servers\n *\n * Provides safe, production-ready defaults for new user configurations.\n * Used by the Checkpoint Dashboard, Scaffolder, and Runtime fallbacks.\n *\n * Ported into checkpoint-shared from the former contracts dashboard-config module\n * as part of the E6 / C-series decommission (#2914 / #2917). Replaces the runtime\n * default-config fallback previously used by\n * `apps/web/lib/services/kyaos-config.service.ts`.\n *\n * @module @kya-os/checkpoint-shared/dashboard-config\n */\n\nimport type { MCPIServerConfig } from './types';\nimport { mcpIServerConfigSchema } from './schemas';\nimport { z } from 'zod';\n\n/**\n * Default configuration JSON content\n * Embedded here to avoid TypeScript JSON import issues in build\n */\nconst defaultConfigJson = {\n identity: {\n // agentDid removed - deprecated, use serverDid instead\n serverDid: '', // New field - will be populated when identity is generated\n environment: 'development' as const,\n storageLocation: 'env-vars' as const,\n },\n proofing: {\n enabled: true,\n destinations: [\n {\n type: 'agentshield' as const,\n apiUrl: 'https://kya.vouched.id',\n },\n ],\n batchQueue: {\n maxBatchSize: 10,\n flushIntervalMs: 5000,\n maxRetries: 3,\n },\n },\n delegation: {\n enabled: true,\n enforceStrictly: false,\n verifier: {\n type: 'agentshield' as const,\n apiUrl: 'https://kya.vouched.id/api/v1/bouncer/delegations/verify',\n cacheTtl: 300000,\n },\n authorization: {\n authorizationUrl: 'https://kya.vouched.id/api/v1/bouncer/delegations/authorize',\n minReputationScore: 80,\n resumeTokenTtl: 3600000,\n requireAuthForUnknown: false,\n },\n },\n toolProtection: {\n source: 'agentshield' as const,\n agentShield: {\n apiUrl: 'https://kya.vouched.id',\n cacheTtl: 300000,\n },\n fallback: {},\n },\n audit: {\n enabled: true,\n includeProofHashes: false,\n includePayloads: false,\n },\n session: {\n timestampSkewSeconds: 120,\n ttlMinutes: 30,\n },\n platform: {\n type: 'node' as const,\n node: {\n server: {\n port: 3000,\n host: '0.0.0.0',\n cors: true,\n timeout: 30000,\n },\n storage: {\n type: 'memory' as const,\n },\n },\n cloudflare: {\n workers: {\n cpuMs: 50,\n memoryMb: 128,\n },\n kvNamespaces: [],\n environmentVariables: [],\n },\n vercel: {\n environmentVariables: [],\n edgeRuntime: {},\n },\n },\n metadata: {\n version: '1.0.0',\n lastUpdated: '',\n source: 'dashboard' as const,\n deploymentStatus: 'inactive' as const,\n },\n};\n\n/**\n * Relaxed schema for default config validation\n * Allows empty strings for fields that will be populated later\n *\n * Note: Empty `agentDid` is valid for new/incomplete configurations.\n * This allows users to create configs before registering their agent DID.\n * The base schema (mcpIServerConfigSchema) requires non-empty agentDid for\n * complete configurations, but defaults allow empty to support progressive\n * configuration.\n */\nconst defaultConfigSchema = mcpIServerConfigSchema.extend({\n identity: mcpIServerConfigSchema.shape.identity.extend({\n agentDid: z.string().optional(), // Allow empty string or undefined for defaults (deprecated)\n serverDid: z.string(), // Allow empty string for defaults (will be populated later)\n }),\n metadata: mcpIServerConfigSchema.shape.metadata.extend({\n lastUpdated: z.string(), // Allow empty string (will be set dynamically)\n }),\n});\n\n/**\n * Default configuration object\n *\n * This is the base default configuration used when creating new user configs.\n * Platform-specific defaults are available via getDefaultConfigForPlatform().\n */\nexport const defaultConfig: MCPIServerConfig = defaultConfigSchema.parse(\n defaultConfigJson\n) as MCPIServerConfig;\n\n/**\n * Platform-specific default configurations\n */\nconst platformDefaults = {\n node: {\n platform: {\n type: 'node' as const,\n node: {\n server: {\n port: 3000,\n host: '0.0.0.0',\n cors: true,\n timeout: 30000,\n },\n storage: {\n type: 'memory' as const,\n },\n },\n },\n },\n cloudflare: {\n platform: {\n type: 'cloudflare' as const,\n cloudflare: {\n workers: {\n cpuMs: 50,\n memoryMb: 128,\n },\n kvNamespaces: [],\n environmentVariables: [],\n },\n },\n },\n vercel: {\n platform: {\n type: 'vercel' as const,\n vercel: {\n environmentVariables: [],\n edgeRuntime: {},\n },\n },\n },\n};\n\n/**\n * Get default configuration for a specific platform\n *\n * Returns the base default config merged with platform-specific defaults.\n *\n * @param platform - Platform type ('node', 'cloudflare', or 'vercel')\n * @returns Platform-specific default configuration\n *\n * @example\n * ```typescript\n * const nodeConfig = getDefaultConfigForPlatform('node');\n * const cloudflareConfig = getDefaultConfigForPlatform('cloudflare');\n * ```\n */\nexport function getDefaultConfigForPlatform(\n platform: 'node' | 'cloudflare' | 'vercel'\n): MCPIServerConfig {\n const platformDefault = platformDefaults[platform];\n\n return {\n ...defaultConfig,\n platform: platformDefault.platform,\n } as MCPIServerConfig;\n}\n\n/**\n * Deep merge utility for objects\n */\nfunction deepMerge<T extends Record<string, unknown>>(target: T, source: Partial<T>): T {\n const result = { ...target } as T;\n\n for (const key in source) {\n const sourceValue = source[key];\n // The leading truthy check already excludes null, so an explicit\n // `!== null` here is redundant (and flagged as such by static analysis).\n if (sourceValue && typeof sourceValue === 'object' && !Array.isArray(sourceValue)) {\n const targetValue = target[key];\n if (targetValue && typeof targetValue === 'object' && !Array.isArray(targetValue)) {\n result[key] = deepMerge(\n targetValue as Record<string, unknown>,\n sourceValue as Record<string, unknown>\n ) as T[Extract<keyof T, string>];\n }\n } else if (sourceValue !== undefined) {\n result[key] = sourceValue as T[Extract<keyof T, string>];\n }\n }\n\n return result;\n}\n\n/**\n * Merge partial configuration with defaults\n *\n * Deep merges a partial configuration object with the base defaults,\n * ensuring all required fields are present.\n *\n * @param partial - Partial configuration to merge with defaults\n * @returns Complete configuration with defaults applied\n *\n * @example\n * ```typescript\n * const config = mergeWithDefaults({\n * proofing: { enabled: false },\n * identity: { environment: 'production' }\n * });\n * ```\n */\nexport function mergeWithDefaults(partial: Partial<MCPIServerConfig>): MCPIServerConfig {\n return deepMerge(\n defaultConfig as unknown as Record<string, unknown>,\n partial as unknown as Record<string, unknown>\n ) as unknown as MCPIServerConfig;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAoCA,MAAM,mBAAmB,EACtB,OAAO,CAAC,CACR,MAAM,qBAAiB,gDAAgD,CAAC,CACxE,IAAI,GAAG;AA+PV,MAAa,8BAA8B,EAAE,OAAO;CAClD,OAAO,EAAE,QAAQ,eAAe;CAChC,MAAM,EAAE,KAAK;EAAC;EAAU;EAAS;CAAY,CAAC;CAC9C,aAAa,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS;CAC1C,WAAW,EAAE,OAAO;CACpB,SAAS,EAAE,OAAO;AACpB,CAAC;;;;AA6DD,MAAa,iCAAiC,EAAE,mBAAmB,QAAQ;CAGzE,EAAE,OAAO;EACP,MAAM,EAAE,QAAQ,OAAO;EACvB,UAAU,EAAE,OAAO;EACnB,gBAAgB,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS;CAC/C,CAAC;CAED,EAAE,OAAO;EACP,MAAM,EAAE,QAAQ,QAAQ;EACxB,UAAU,EAAE,OAAO;EACnB,gBAAgB,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAA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,MAAM;IACN,MAAM;IACN,MAAM;IACN,SAAS;GACX;GACA,SAAS,EACP,MAAM,SACR;EACF;CACF,EACF;CACA,YAAY,EACV,UAAU;EACR,MAAM;EACN,YAAY;GACV,SAAS;IACP,OAAO;IACP,UAAU;GACZ;GACA,cAAc,CAAC;GACf,sBAAsB,CAAC;EACzB;CACF,EACF;CACA,QAAQ,EACN,UAAU;EACR,MAAM;EACN,QAAQ;GACN,sBAAsB,CAAC;GACvB,aAAa,CAAC;EAChB;CACF,EACF;AACF;;;;;;;;;;;;;;;AAgBA,SAAgB,4BACd,UACkB;CAClB,MAAM,kBAAkB,iBAAiB;CAEzC,OAAO;EACL,GAAG;EACH,UAAU,gBAAgB;CAC5B;AACF;;;;AAKA,SAAS,UAA6C,QAAW,QAAuB;CACtF,MAAM,SAAS,EAAE,GAAG,OAAO;CAE3B,KAAK,MAAM,OAAO,QAAQ;EACxB,MAAM,cAAc,OAAO;EAG3B,IAAI,eAAe,OAAO,gBAAgB,YAAY,CAAC,MAAM,QAAQ,WAAW,GAAG;GACjF,MAAM,cAAc,OAAO;GAC3B,IAAI,eAAe,OAAO,gBAAgB,YAAY,CAAC,MAAM,QAAQ,WAAW,GAC9E,OAAO,OAAO,UACZ,aACA,WACF;EAEJ,OAAO,IAAI,gBAAgB,QACzB,OAAO,OAAO;CAElB;CAEA,OAAO;AACT;;;;;;;;;;;;;;;;;;AAmBA,SAAgB,kBAAkB,SAAsD;CACtF,OAAO,UACL,eACA,OACF;AACF"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
//#region src/constants/patterns.d.ts
|
|
2
|
+
declare const UUID_PATTERN: RegExp;
|
|
3
|
+
declare const VALIDATION_PATTERNS: {
|
|
4
|
+
readonly UUID: RegExp;
|
|
5
|
+
readonly ULID: RegExp;
|
|
6
|
+
readonly SLUG: RegExp;
|
|
7
|
+
readonly IPV4: RegExp;
|
|
8
|
+
readonly IPV6: RegExp;
|
|
9
|
+
readonly IP: RegExp;
|
|
10
|
+
readonly CIDR: RegExp;
|
|
11
|
+
readonly DOMAIN: RegExp;
|
|
12
|
+
readonly HOSTNAME: RegExp;
|
|
13
|
+
readonly URL: RegExp;
|
|
14
|
+
readonly EMAIL: RegExp;
|
|
15
|
+
readonly PHONE: RegExp;
|
|
16
|
+
readonly JWT: RegExp;
|
|
17
|
+
readonly BASE64: RegExp;
|
|
18
|
+
readonly HEX: RegExp;
|
|
19
|
+
readonly MD5: RegExp;
|
|
20
|
+
readonly SHA1: RegExp;
|
|
21
|
+
readonly SHA256: RegExp;
|
|
22
|
+
readonly SEMVER: RegExp;
|
|
23
|
+
readonly FILENAME: RegExp;
|
|
24
|
+
readonly PATH: RegExp;
|
|
25
|
+
readonly API_KEY: RegExp;
|
|
26
|
+
readonly SECRET_KEY: RegExp;
|
|
27
|
+
readonly PIXEL_ID: RegExp;
|
|
28
|
+
};
|
|
29
|
+
declare function testPattern(pattern: RegExp, value: string): boolean;
|
|
30
|
+
declare function extractMatch(pattern: RegExp, value: string): string | null;
|
|
31
|
+
declare function testPatterns(patterns: RegExp[], value: string): boolean;
|
|
32
|
+
declare function findMatchingPattern(patterns: Record<string, RegExp>, value: string): string | null;
|
|
33
|
+
//#endregion
|
|
34
|
+
export { testPattern as a, findMatchingPattern as i, VALIDATION_PATTERNS as n, testPatterns as o, extractMatch as r, UUID_PATTERN as t };
|
|
35
|
+
//# sourceMappingURL=patterns-CdTh7LU2.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"patterns-CdTh7LU2.d.mts","names":[],"sources":["../src/constants/patterns.ts"],"mappings":";cAmBa,cAAY;cAGZ;;;;;;;;;;;;;;;;;;;;;;;;;;iBAkEG,YAAY,SAAS,QAAQ;iBAS7B,aAAa,SAAS,QAAQ;iBAS9B,aAAa,UAAU,UAAU;iBAOjC,oBACd,UAAU,eAAe,SACzB"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
//#region src/constants/patterns.d.ts
|
|
2
|
+
declare const UUID_PATTERN: RegExp;
|
|
3
|
+
declare const VALIDATION_PATTERNS: {
|
|
4
|
+
readonly UUID: RegExp;
|
|
5
|
+
readonly ULID: RegExp;
|
|
6
|
+
readonly SLUG: RegExp;
|
|
7
|
+
readonly IPV4: RegExp;
|
|
8
|
+
readonly IPV6: RegExp;
|
|
9
|
+
readonly IP: RegExp;
|
|
10
|
+
readonly CIDR: RegExp;
|
|
11
|
+
readonly DOMAIN: RegExp;
|
|
12
|
+
readonly HOSTNAME: RegExp;
|
|
13
|
+
readonly URL: RegExp;
|
|
14
|
+
readonly EMAIL: RegExp;
|
|
15
|
+
readonly PHONE: RegExp;
|
|
16
|
+
readonly JWT: RegExp;
|
|
17
|
+
readonly BASE64: RegExp;
|
|
18
|
+
readonly HEX: RegExp;
|
|
19
|
+
readonly MD5: RegExp;
|
|
20
|
+
readonly SHA1: RegExp;
|
|
21
|
+
readonly SHA256: RegExp;
|
|
22
|
+
readonly SEMVER: RegExp;
|
|
23
|
+
readonly FILENAME: RegExp;
|
|
24
|
+
readonly PATH: RegExp;
|
|
25
|
+
readonly API_KEY: RegExp;
|
|
26
|
+
readonly SECRET_KEY: RegExp;
|
|
27
|
+
readonly PIXEL_ID: RegExp;
|
|
28
|
+
};
|
|
29
|
+
declare function testPattern(pattern: RegExp, value: string): boolean;
|
|
30
|
+
declare function extractMatch(pattern: RegExp, value: string): string | null;
|
|
31
|
+
declare function testPatterns(patterns: RegExp[], value: string): boolean;
|
|
32
|
+
declare function findMatchingPattern(patterns: Record<string, RegExp>, value: string): string | null;
|
|
33
|
+
//#endregion
|
|
34
|
+
export { testPattern as a, findMatchingPattern as i, VALIDATION_PATTERNS as n, testPatterns as o, extractMatch as r, UUID_PATTERN as t };
|
|
35
|
+
//# sourceMappingURL=patterns-CdTh7LU2.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"patterns-CdTh7LU2.d.ts","names":[],"sources":["../src/constants/patterns.ts"],"mappings":";cAmBa,cAAY;cAGZ;;;;;;;;;;;;;;;;;;;;;;;;;;iBAkEG,YAAY,SAAS,QAAQ;iBAS7B,aAAa,SAAS,QAAQ;iBAS9B,aAAa,UAAU,UAAU;iBAOjC,oBACd,UAAU,eAAe,SACzB"}
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Regular Expression Patterns
|
|
4
4
|
*
|
|
5
|
-
* Common regex patterns used for validation and
|
|
5
|
+
* Common regex patterns used for validation, and helpers that match bounded
|
|
6
|
+
* input against them. Request classification belongs to the detection
|
|
7
|
+
* engine, so no detection patterns live here.
|
|
6
8
|
*/
|
|
7
9
|
/**
|
|
8
10
|
* Validation Patterns
|
|
@@ -35,99 +37,6 @@ const VALIDATION_PATTERNS = {
|
|
|
35
37
|
PIXEL_ID: /^px_[A-Za-z0-9]{16}$/
|
|
36
38
|
};
|
|
37
39
|
/**
|
|
38
|
-
* User Agent Patterns for Agent Detection
|
|
39
|
-
*/
|
|
40
|
-
const USER_AGENT_PATTERNS = {
|
|
41
|
-
OPENAI: /(?:GPTBot|ChatGPT-User|OpenAI)/i,
|
|
42
|
-
ANTHROPIC: /(?:Claude-Web|Claude-User|anthropic-ai|claude-web|claude-user|ClaudeBot)/i,
|
|
43
|
-
PERPLEXITY: /(?:PerplexityBot|Perplexica)/i,
|
|
44
|
-
GOOGLE_AI: /(?:Bard|Google-InspectionTool)/i,
|
|
45
|
-
MICROSOFT_AI: /(?:BingPreview\/.*ChatGPT|Copilot)/i,
|
|
46
|
-
GOOGLEBOT: /Googlebot/i,
|
|
47
|
-
BINGBOT: /(?:bingbot|BingPreview|msnbot)/i,
|
|
48
|
-
DUCKDUCKBOT: /DuckDuckBot/i,
|
|
49
|
-
BAIDUBOT: /Baiduspider/i,
|
|
50
|
-
YANDEXBOT: /YandexBot/i,
|
|
51
|
-
FACEBOOK: /(?:facebookexternalhit|facebookcatalog)/i,
|
|
52
|
-
TWITTER: /(?:Twitterbot|TwitterImageProxy)/i,
|
|
53
|
-
LINKEDIN: /LinkedInBot/i,
|
|
54
|
-
WHATSAPP: /WhatsApp/i,
|
|
55
|
-
TELEGRAM: /TelegramBot/i,
|
|
56
|
-
DISCORD: /Discordbot/i,
|
|
57
|
-
SLACK: /Slackbot/i,
|
|
58
|
-
GENERIC_BOT: /(?:bot|crawler|spider|scraper|agent)/i,
|
|
59
|
-
SCRAPY: /Scrapy/i,
|
|
60
|
-
PUPPETEER: /(?:HeadlessChrome|Puppeteer)/i,
|
|
61
|
-
PLAYWRIGHT: /Playwright/i,
|
|
62
|
-
SELENIUM: /(?:selenium|webdriver)/i,
|
|
63
|
-
POSTMAN: /PostmanRuntime/i,
|
|
64
|
-
INSOMNIA: /insomnia/i,
|
|
65
|
-
CURL: /curl/i,
|
|
66
|
-
WGET: /Wget/i,
|
|
67
|
-
HTTPIE: /HTTPie/i,
|
|
68
|
-
UPTIMEROBOT: /UptimeRobot/i,
|
|
69
|
-
PINGDOM: /Pingdom/i,
|
|
70
|
-
NEWRELIC: /NewRelicPinger/i,
|
|
71
|
-
DATADOG: /Datadog/i
|
|
72
|
-
};
|
|
73
|
-
/**
|
|
74
|
-
* Header Patterns for Agent Detection
|
|
75
|
-
*/
|
|
76
|
-
const HEADER_PATTERNS = {
|
|
77
|
-
AI_HEADERS: /^(?:X-(?:OpenAI|Anthropic|AI|Bot|Agent|LLM))/i,
|
|
78
|
-
AUTOMATION_HEADERS: /^(?:X-(?:Automated|Robot|Crawler|Scraper))/i,
|
|
79
|
-
MISSING_ACCEPT: /^$/,
|
|
80
|
-
MISSING_ACCEPT_LANGUAGE: /^$/,
|
|
81
|
-
MISSING_ACCEPT_ENCODING: /^$/,
|
|
82
|
-
GENERIC_ACCEPT: /^\*\/\*$/,
|
|
83
|
-
NO_COOKIES: /^$/,
|
|
84
|
-
PROXY_HEADERS: /^(?:X-Forwarded-|X-Real-IP|X-Originating-IP|Via|Forwarded)/i,
|
|
85
|
-
CLOUD_HEADERS: /^(?:X-(?:AWS|Azure|GCP|Cloudflare))/i
|
|
86
|
-
};
|
|
87
|
-
/**
|
|
88
|
-
* Browser Patterns
|
|
89
|
-
*/
|
|
90
|
-
const BROWSER_PATTERNS = {
|
|
91
|
-
CHROME: /Chrome\/([0-9.]+)/,
|
|
92
|
-
FIREFOX: /Firefox\/([0-9.]+)/,
|
|
93
|
-
SAFARI: /Version\/([0-9.]+).*Safari/,
|
|
94
|
-
EDGE: /Edg\/([0-9.]+)/,
|
|
95
|
-
OPERA: /OPR\/([0-9.]+)/,
|
|
96
|
-
IE: /MSIE ([0-9.]+)/
|
|
97
|
-
};
|
|
98
|
-
/**
|
|
99
|
-
* Operating System Patterns
|
|
100
|
-
*/
|
|
101
|
-
const OS_PATTERNS = {
|
|
102
|
-
WINDOWS: /Windows NT ([0-9.]+)/,
|
|
103
|
-
MACOS: /Mac OS X ([0-9_]+)/,
|
|
104
|
-
LINUX: /Linux/,
|
|
105
|
-
ANDROID: /Android ([0-9.]+)/,
|
|
106
|
-
IOS: /OS ([0-9_]+) like Mac OS X/
|
|
107
|
-
};
|
|
108
|
-
/**
|
|
109
|
-
* Mobile Device Patterns
|
|
110
|
-
*/
|
|
111
|
-
const MOBILE_PATTERNS = {
|
|
112
|
-
MOBILE: /(?:Mobile|Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini)/i,
|
|
113
|
-
TABLET: /(?:iPad|Android.*Tablet|Tablet.*Android|Kindle|Silk)/i,
|
|
114
|
-
DESKTOP: /(?:Windows NT|Mac OS X|Linux|CrOS)/i
|
|
115
|
-
};
|
|
116
|
-
/**
|
|
117
|
-
* Suspicious Behavior Patterns
|
|
118
|
-
*/
|
|
119
|
-
const SUSPICIOUS_PATTERNS = {
|
|
120
|
-
RAPID_REQUESTS: /^[0-9]{1,3}$/,
|
|
121
|
-
SEQUENTIAL_URLS: /\?(?:page|offset|id)=[0-9]+/,
|
|
122
|
-
API_ENDPOINTS: /\/api\/|\.json$|\.xml$/i,
|
|
123
|
-
DIRECT_POST: /^POST$/,
|
|
124
|
-
SQL_INJECTION: /(?:union|select|insert|update|delete|drop|create|alter|exec|script|javascript|onerror|onload|eval|src=)/i,
|
|
125
|
-
XSS_ATTEMPT: /(?:<script|javascript:|onerror=|onclick=|<iframe|<embed|<object)/i,
|
|
126
|
-
PATH_TRAVERSAL: /(?:\.\.\/|\.\.\\|%2e%2e%2f|%252e%252e%252f)/i,
|
|
127
|
-
URL_ENCODED: /%[0-9a-f]{2}/i,
|
|
128
|
-
BASE64_DATA: /data:[^;]+;base64,/i
|
|
129
|
-
};
|
|
130
|
-
/**
|
|
131
40
|
* Maximum input length for pattern matching. UAs, header values, and
|
|
132
41
|
* detection payloads are bounded in practice (<4KB even for the most
|
|
133
42
|
* verbose Chrome/Firefox UAs). Caps worst-case complexity for any
|
|
@@ -169,42 +78,6 @@ function findMatchingPattern(patterns, value) {
|
|
|
169
78
|
}
|
|
170
79
|
|
|
171
80
|
//#endregion
|
|
172
|
-
Object.defineProperty(exports, 'BROWSER_PATTERNS', {
|
|
173
|
-
enumerable: true,
|
|
174
|
-
get: function () {
|
|
175
|
-
return BROWSER_PATTERNS;
|
|
176
|
-
}
|
|
177
|
-
});
|
|
178
|
-
Object.defineProperty(exports, 'HEADER_PATTERNS', {
|
|
179
|
-
enumerable: true,
|
|
180
|
-
get: function () {
|
|
181
|
-
return HEADER_PATTERNS;
|
|
182
|
-
}
|
|
183
|
-
});
|
|
184
|
-
Object.defineProperty(exports, 'MOBILE_PATTERNS', {
|
|
185
|
-
enumerable: true,
|
|
186
|
-
get: function () {
|
|
187
|
-
return MOBILE_PATTERNS;
|
|
188
|
-
}
|
|
189
|
-
});
|
|
190
|
-
Object.defineProperty(exports, 'OS_PATTERNS', {
|
|
191
|
-
enumerable: true,
|
|
192
|
-
get: function () {
|
|
193
|
-
return OS_PATTERNS;
|
|
194
|
-
}
|
|
195
|
-
});
|
|
196
|
-
Object.defineProperty(exports, 'SUSPICIOUS_PATTERNS', {
|
|
197
|
-
enumerable: true,
|
|
198
|
-
get: function () {
|
|
199
|
-
return SUSPICIOUS_PATTERNS;
|
|
200
|
-
}
|
|
201
|
-
});
|
|
202
|
-
Object.defineProperty(exports, 'USER_AGENT_PATTERNS', {
|
|
203
|
-
enumerable: true,
|
|
204
|
-
get: function () {
|
|
205
|
-
return USER_AGENT_PATTERNS;
|
|
206
|
-
}
|
|
207
|
-
});
|
|
208
81
|
Object.defineProperty(exports, 'UUID_PATTERN', {
|
|
209
82
|
enumerable: true,
|
|
210
83
|
get: function () {
|