@kya-os/mcp-i-cloudflare 1.17.0 → 1.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +273 -54
- package/dist/adapter.d.ts +3 -17
- package/dist/adapter.d.ts.map +1 -1
- package/dist/adapter.js +39 -477
- package/dist/adapter.js.map +1 -1
- package/dist/agent.d.ts +59 -35
- package/dist/agent.d.ts.map +1 -1
- package/dist/agent.js +386 -404
- package/dist/agent.js.map +1 -1
- package/dist/app.d.ts.map +1 -1
- package/dist/app.js +150 -94
- package/dist/app.js.map +1 -1
- package/dist/audit/deployment-binding.d.ts +16 -16
- package/dist/authority-outcome.d.ts +110 -0
- package/dist/authority-outcome.d.ts.map +1 -0
- package/dist/authority-outcome.js +154 -0
- package/dist/authority-outcome.js.map +1 -0
- package/dist/config.d.ts +8 -77
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +0 -83
- package/dist/config.js.map +1 -1
- package/dist/delegation-http/bearer-retry.d.ts +84 -32
- package/dist/delegation-http/bearer-retry.d.ts.map +1 -1
- package/dist/delegation-http/bearer-retry.js +124 -139
- package/dist/delegation-http/bearer-retry.js.map +1 -1
- package/dist/delegation-http/connect-gate.d.ts +47 -0
- package/dist/delegation-http/connect-gate.d.ts.map +1 -0
- package/dist/delegation-http/connect-gate.js +104 -0
- package/dist/delegation-http/connect-gate.js.map +1 -0
- package/dist/delegation-http/constants.d.ts +4 -49
- package/dist/delegation-http/constants.d.ts.map +1 -1
- package/dist/delegation-http/constants.js +4 -58
- package/dist/delegation-http/constants.js.map +1 -1
- package/dist/delegation-http/issuer-binding.d.ts +26 -0
- package/dist/delegation-http/issuer-binding.d.ts.map +1 -0
- package/dist/delegation-http/issuer-binding.js +51 -0
- package/dist/delegation-http/issuer-binding.js.map +1 -0
- package/dist/delegation-http/lazy-auth-gate.d.ts +88 -0
- package/dist/delegation-http/lazy-auth-gate.d.ts.map +1 -0
- package/dist/delegation-http/lazy-auth-gate.js +203 -0
- package/dist/delegation-http/lazy-auth-gate.js.map +1 -0
- package/dist/delegation-http/native-challenge.d.ts +52 -0
- package/dist/delegation-http/native-challenge.d.ts.map +1 -0
- package/dist/delegation-http/native-challenge.js +124 -0
- package/dist/delegation-http/native-challenge.js.map +1 -0
- package/dist/delegation-http/native-consent-redirect.d.ts +21 -0
- package/dist/delegation-http/native-consent-redirect.d.ts.map +1 -0
- package/dist/delegation-http/native-consent-redirect.js +43 -0
- package/dist/delegation-http/native-consent-redirect.js.map +1 -0
- package/dist/delegation-http/native-http.d.ts +1 -86
- package/dist/delegation-http/native-http.d.ts.map +1 -1
- package/dist/delegation-http/native-http.js +2 -130
- package/dist/delegation-http/native-http.js.map +1 -1
- package/dist/delegation-http/native-oauth-state-do.d.ts +13 -35
- package/dist/delegation-http/native-oauth-state-do.d.ts.map +1 -1
- package/dist/delegation-http/native-oauth-state-do.js +10 -165
- package/dist/delegation-http/native-oauth-state-do.js.map +1 -1
- package/dist/delegation-http/protected-resource.d.ts +37 -0
- package/dist/delegation-http/protected-resource.d.ts.map +1 -0
- package/dist/delegation-http/protected-resource.js +43 -0
- package/dist/delegation-http/protected-resource.js.map +1 -0
- package/dist/delegation-http/request-proof.d.ts +20 -0
- package/dist/delegation-http/request-proof.d.ts.map +1 -0
- package/dist/delegation-http/request-proof.js +29 -0
- package/dist/delegation-http/request-proof.js.map +1 -0
- package/dist/delegation-http/sid.d.ts +4 -12
- package/dist/delegation-http/sid.d.ts.map +1 -1
- package/dist/delegation-http/sid.js +4 -19
- package/dist/delegation-http/sid.js.map +1 -1
- package/dist/delegation-http/well-known-capability.d.ts +8 -12
- package/dist/delegation-http/well-known-capability.d.ts.map +1 -1
- package/dist/delegation-http/well-known-capability.js +9 -18
- package/dist/delegation-http/well-known-capability.js.map +1 -1
- package/dist/helpers/env-mapper.d.ts.map +1 -1
- package/dist/helpers/env-mapper.js +7 -29
- package/dist/helpers/env-mapper.js.map +1 -1
- package/dist/index.d.ts +2 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -8
- package/dist/index.js.map +1 -1
- package/dist/proof-generator.d.ts +24 -17
- package/dist/proof-generator.d.ts.map +1 -1
- package/dist/proof-generator.js +42 -56
- package/dist/proof-generator.js.map +1 -1
- package/dist/runtime/amount-limit-refusal.d.ts +3 -0
- package/dist/runtime/amount-limit-refusal.d.ts.map +1 -0
- package/dist/runtime/amount-limit-refusal.js +7 -0
- package/dist/runtime/amount-limit-refusal.js.map +1 -0
- package/dist/runtime/oauth-handler.d.ts +1 -1
- package/dist/runtime/oauth-handler.d.ts.map +1 -1
- package/dist/runtime/oauth-handler.js +31 -34
- package/dist/runtime/oauth-handler.js.map +1 -1
- package/dist/runtime.d.ts +34 -10
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +65 -16
- package/dist/runtime.js.map +1 -1
- package/dist/security/admission-refusal.d.ts +3 -3
- package/dist/security/admission-refusal.d.ts.map +1 -1
- package/dist/security/admission-refusal.js +14 -6
- package/dist/security/admission-refusal.js.map +1 -1
- package/dist/security/holder-binding.d.ts +34 -0
- package/dist/security/holder-binding.d.ts.map +1 -0
- package/dist/security/holder-binding.js +75 -0
- package/dist/security/holder-binding.js.map +1 -0
- package/dist/security/mcp-admission.d.ts +29 -1
- package/dist/security/mcp-admission.d.ts.map +1 -1
- package/dist/security/mcp-admission.js +78 -12
- package/dist/security/mcp-admission.js.map +1 -1
- package/dist/security/native-holder-admission.d.ts +39 -0
- package/dist/security/native-holder-admission.d.ts.map +1 -0
- package/dist/security/native-holder-admission.js +65 -0
- package/dist/security/native-holder-admission.js.map +1 -0
- package/dist/security/outcome-proof.d.ts +39 -0
- package/dist/security/outcome-proof.d.ts.map +1 -0
- package/dist/security/outcome-proof.js +54 -0
- package/dist/security/outcome-proof.js.map +1 -0
- package/dist/security/request-nonce-store.d.ts +43 -0
- package/dist/security/request-nonce-store.d.ts.map +1 -0
- package/dist/security/request-nonce-store.js +129 -0
- package/dist/security/request-nonce-store.js.map +1 -0
- package/dist/security/routed-request.d.ts +41 -0
- package/dist/security/routed-request.d.ts.map +1 -0
- package/dist/security/routed-request.js +86 -0
- package/dist/security/routed-request.js.map +1 -0
- package/dist/security/sign-in-amr.d.ts +23 -0
- package/dist/security/sign-in-amr.d.ts.map +1 -0
- package/dist/security/sign-in-amr.js +44 -0
- package/dist/security/sign-in-amr.js.map +1 -0
- package/dist/services/approval-route.d.ts +3 -2
- package/dist/services/approval-route.d.ts.map +1 -1
- package/dist/services/approval-route.js.map +1 -1
- package/dist/services/checkpoint-decision.d.ts +56 -0
- package/dist/services/checkpoint-decision.d.ts.map +1 -0
- package/dist/services/checkpoint-decision.js +109 -0
- package/dist/services/checkpoint-decision.js.map +1 -0
- package/dist/services/consent-page-renderer.d.ts.map +1 -1
- package/dist/services/consent-page-renderer.js +2 -3
- package/dist/services/consent-page-renderer.js.map +1 -1
- package/dist/services/consent.service.d.ts +11 -49
- package/dist/services/consent.service.d.ts.map +1 -1
- package/dist/services/consent.service.js +81 -307
- package/dist/services/consent.service.js.map +1 -1
- package/dist/services/credential-auth.handler.d.ts.map +1 -1
- package/dist/services/credential-auth.handler.js +2 -8
- package/dist/services/credential-auth.handler.js.map +1 -1
- package/dist/services/delegation-authority.d.ts +53 -0
- package/dist/services/delegation-authority.d.ts.map +1 -0
- package/dist/services/delegation-authority.js +130 -0
- package/dist/services/delegation-authority.js.map +1 -0
- package/dist/services/delegation-trust.d.ts +35 -64
- package/dist/services/delegation-trust.d.ts.map +1 -1
- package/dist/services/delegation-trust.js +98 -279
- package/dist/services/delegation-trust.js.map +1 -1
- package/dist/services/delegation.service.d.ts +83 -105
- package/dist/services/delegation.service.d.ts.map +1 -1
- package/dist/services/delegation.service.js +166 -518
- package/dist/services/delegation.service.js.map +1 -1
- package/dist/services/idp-token-storage.d.ts +32 -12
- package/dist/services/idp-token-storage.d.ts.map +1 -1
- package/dist/services/idp-token-storage.js +79 -36
- package/dist/services/idp-token-storage.js.map +1 -1
- package/dist/services/issuer-keys.d.ts +55 -0
- package/dist/services/issuer-keys.d.ts.map +1 -0
- package/dist/services/issuer-keys.js +184 -0
- package/dist/services/issuer-keys.js.map +1 -0
- package/dist/services/oauth-security.service.d.ts +17 -1
- package/dist/services/oauth-security.service.d.ts.map +1 -1
- package/dist/services/oauth-security.service.js +29 -10
- package/dist/services/oauth-security.service.js.map +1 -1
- package/dist/services/proof.service.d.ts +10 -0
- package/dist/services/proof.service.d.ts.map +1 -1
- package/dist/services/proof.service.js +28 -6
- package/dist/services/proof.service.js.map +1 -1
- package/dist/services/resource-audience.d.ts +12 -9
- package/dist/services/resource-audience.d.ts.map +1 -1
- package/dist/services/resource-audience.js +12 -9
- package/dist/services/resource-audience.js.map +1 -1
- package/dist/services/unenforceable-tool-protection.d.ts +32 -0
- package/dist/services/unenforceable-tool-protection.d.ts.map +1 -0
- package/dist/services/unenforceable-tool-protection.js +90 -0
- package/dist/services/unenforceable-tool-protection.js.map +1 -0
- package/dist/services/upstream-fetch.d.ts +14 -0
- package/dist/services/upstream-fetch.d.ts.map +1 -0
- package/dist/services/upstream-fetch.js +56 -0
- package/dist/services/upstream-fetch.js.map +1 -0
- package/dist/types.d.ts +5 -18
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/oauth-profile.d.ts +19 -0
- package/dist/utils/oauth-profile.d.ts.map +1 -1
- package/dist/utils/oauth-profile.js +54 -1
- package/dist/utils/oauth-profile.js.map +1 -1
- package/dist/utils/tool-security-schemes.d.ts +65 -0
- package/dist/utils/tool-security-schemes.d.ts.map +1 -0
- package/dist/utils/tool-security-schemes.js +168 -0
- package/dist/utils/tool-security-schemes.js.map +1 -0
- package/package.json +5 -6
- package/dist/delegation-http/anchor-do.d.ts +0 -84
- package/dist/delegation-http/anchor-do.d.ts.map +0 -1
- package/dist/delegation-http/anchor-do.js +0 -412
- package/dist/delegation-http/anchor-do.js.map +0 -1
- package/dist/delegation-http/anchor-registration-validate.d.ts +0 -61
- package/dist/delegation-http/anchor-registration-validate.d.ts.map +0 -1
- package/dist/delegation-http/anchor-registration-validate.js +0 -191
- package/dist/delegation-http/anchor-registration-validate.js.map +0 -1
- package/dist/delegation-http/anchor-registration.d.ts +0 -62
- package/dist/delegation-http/anchor-registration.d.ts.map +0 -1
- package/dist/delegation-http/anchor-registration.js +0 -337
- package/dist/delegation-http/anchor-registration.js.map +0 -1
- package/dist/delegation-http/anchor-routing.d.ts +0 -20
- package/dist/delegation-http/anchor-routing.d.ts.map +0 -1
- package/dist/delegation-http/anchor-routing.js +0 -27
- package/dist/delegation-http/anchor-routing.js.map +0 -1
- package/dist/delegation-http/challenge-middleware.d.ts +0 -28
- package/dist/delegation-http/challenge-middleware.d.ts.map +0 -1
- package/dist/delegation-http/challenge-middleware.js +0 -190
- package/dist/delegation-http/challenge-middleware.js.map +0 -1
- package/dist/delegation-http/challenge.d.ts +0 -102
- package/dist/delegation-http/challenge.d.ts.map +0 -1
- package/dist/delegation-http/challenge.js +0 -223
- package/dist/delegation-http/challenge.js.map +0 -1
- package/dist/delegation-http/consent-anchor-bridge.d.ts +0 -70
- package/dist/delegation-http/consent-anchor-bridge.d.ts.map +0 -1
- package/dist/delegation-http/consent-anchor-bridge.js +0 -1130
- package/dist/delegation-http/consent-anchor-bridge.js.map +0 -1
- package/dist/delegation-http/consent-preparation-page.d.ts +0 -18
- package/dist/delegation-http/consent-preparation-page.d.ts.map +0 -1
- package/dist/delegation-http/consent-preparation-page.js +0 -172
- package/dist/delegation-http/consent-preparation-page.js.map +0 -1
- package/dist/delegation-http/credential-consent.d.ts +0 -149
- package/dist/delegation-http/credential-consent.d.ts.map +0 -1
- package/dist/delegation-http/credential-consent.js +0 -338
- package/dist/delegation-http/credential-consent.js.map +0 -1
- package/dist/delegation-http/native-capabilities.d.ts +0 -4
- package/dist/delegation-http/native-capabilities.d.ts.map +0 -1
- package/dist/delegation-http/native-capabilities.js +0 -53
- package/dist/delegation-http/native-capabilities.js.map +0 -1
- package/dist/delegation-http/native-oauth-state.d.ts +0 -28
- package/dist/delegation-http/native-oauth-state.d.ts.map +0 -1
- package/dist/delegation-http/native-oauth-state.js +0 -146
- package/dist/delegation-http/native-oauth-state.js.map +0 -1
- package/dist/delegation-http/native-oauth.d.ts +0 -26
- package/dist/delegation-http/native-oauth.d.ts.map +0 -1
- package/dist/delegation-http/native-oauth.js +0 -393
- package/dist/delegation-http/native-oauth.js.map +0 -1
- package/dist/delegation-http/native-pickup.d.ts +0 -20
- package/dist/delegation-http/native-pickup.d.ts.map +0 -1
- package/dist/delegation-http/native-pickup.js +0 -227
- package/dist/delegation-http/native-pickup.js.map +0 -1
- package/dist/delegation-http/pickup-routes.d.ts +0 -43
- package/dist/delegation-http/pickup-routes.d.ts.map +0 -1
- package/dist/delegation-http/pickup-routes.js +0 -166
- package/dist/delegation-http/pickup-routes.js.map +0 -1
- package/dist/delegation-http/register.d.ts +0 -26
- package/dist/delegation-http/register.d.ts.map +0 -1
- package/dist/delegation-http/register.js +0 -95
- package/dist/delegation-http/register.js.map +0 -1
- package/dist/delegation-http/registrar-auth.d.ts +0 -24
- package/dist/delegation-http/registrar-auth.d.ts.map +0 -1
- package/dist/delegation-http/registrar-auth.js +0 -61
- package/dist/delegation-http/registrar-auth.js.map +0 -1
- package/dist/delegation-http/remote-issuer.d.ts +0 -52
- package/dist/delegation-http/remote-issuer.d.ts.map +0 -1
- package/dist/delegation-http/remote-issuer.js +0 -324
- package/dist/delegation-http/remote-issuer.js.map +0 -1
- package/dist/delegation-http/types.d.ts +0 -116
- package/dist/delegation-http/types.d.ts.map +0 -1
- package/dist/delegation-http/types.js +0 -11
- package/dist/delegation-http/types.js.map +0 -1
|
@@ -1,412 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* draft-kya-http-02 delegation layer — pickup-anchor durable object.
|
|
3
|
-
*
|
|
4
|
-
* Implements the §13 anchor state machine: create → PENDING (or PINNED for a
|
|
5
|
-
* challenge-time signed caller) → first poll pins the holder → human approves
|
|
6
|
-
* (PINNED→APPROVED, credential parked) → the pinned holder polls 200-ready,
|
|
7
|
-
* repeatably, until the anchor TTL elapses.
|
|
8
|
-
*
|
|
9
|
-
* Design:
|
|
10
|
-
* - ALL transition logic lives in the pure, synchronous reducers
|
|
11
|
-
* `reduceCreate` / `reducePoll` / `reduceApprove` (injectable `now`). They never
|
|
12
|
-
* touch storage and never await — which is what lets the Cloudflare DO input gate
|
|
13
|
-
* serialize the first-poll race (the dispatcher does `get → reduce → put` with no
|
|
14
|
-
* intervening non-storage await, so the read-modify-write is atomic per the gate).
|
|
15
|
-
* - `handlePickupInternal` is the only async surface: it reads the record from
|
|
16
|
-
* `ctx.storage`, runs the reducer, then persists or deletes.
|
|
17
|
-
*
|
|
18
|
-
* Non-negotiables:
|
|
19
|
-
* - never store/log a raw token — only its `sha256Hex` digest (see `./hash`);
|
|
20
|
-
* - no `alarm()` override: the `agents` SDK base class assigns `this.alarm` as an
|
|
21
|
-
* own-property arrow (its SQL scheduler), which shadows any subclass method and
|
|
22
|
-
* exposes no `super.alarm` to delegate to — so anchor lifetime is instead bounded
|
|
23
|
-
* by idempotent creation (one anchor per deterministic sid) plus the ≤600s TTL;
|
|
24
|
-
* - lazy expiry with delete-on-expired-read (a 410 outcome deletes the key);
|
|
25
|
-
* - every response carries `Cache-Control: no-store`;
|
|
26
|
-
* - 429 is status + `Retry-After` only — never a body.
|
|
27
|
-
*
|
|
28
|
-
* @module @kya-os/mcp-i-cloudflare/delegation-http/anchor-do
|
|
29
|
-
*/
|
|
30
|
-
import { sha256Hex } from "./hash";
|
|
31
|
-
import { KYAOS_ERRORS, INTERNAL_PICKUP_CREATE, INTERNAL_PICKUP_POLL, INTERNAL_PICKUP_APPROVE, INTERNAL_PICKUP_INFO, } from "./constants";
|
|
32
|
-
import { STORAGE_KEYS } from "../constants/storage-keys";
|
|
33
|
-
/**
|
|
34
|
-
* The record projection echoed in every create response (`body.anchor`) — the
|
|
35
|
-
* authoritative first-write-wins values a registrar response must echo, in one
|
|
36
|
-
* atomic round-trip (no read-back window; the record can't expire between a
|
|
37
|
-
* create and a follow-up INFO). Never includes the pin or the parked delegation.
|
|
38
|
-
*/
|
|
39
|
-
function anchorSnapshot(rec) {
|
|
40
|
-
return {
|
|
41
|
-
sid: rec.sid,
|
|
42
|
-
status: rec.status,
|
|
43
|
-
requiredScopes: rec.requiredScopes,
|
|
44
|
-
minAssurance: rec.minAssurance,
|
|
45
|
-
expiresAt: rec.expiresAt,
|
|
46
|
-
createdAt: rec.createdAt,
|
|
47
|
-
registeredAtMs: rec.registeredAtMs,
|
|
48
|
-
issuedAtMs: rec.issuedAtMs,
|
|
49
|
-
agentDid: rec.agentDid,
|
|
50
|
-
audience: rec.audience,
|
|
51
|
-
serverDid: rec.serverDid,
|
|
52
|
-
nativeHttp: rec.nativeHttp,
|
|
53
|
-
nativeRegistration: rec.nativeRegistration,
|
|
54
|
-
nativeIssuerDid: rec.nativeIssuerDid,
|
|
55
|
-
nativePolicyRevision: rec.nativePolicyRevision,
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
const pendingBody = (rec, now) => ({
|
|
59
|
-
status: "pending",
|
|
60
|
-
// This is the remaining authorization-session lifetime, not the future VC's
|
|
61
|
-
// lifetime. Preserve the frozen legacy response and the original DO deadline.
|
|
62
|
-
...(rec.nativeHttp
|
|
63
|
-
? {
|
|
64
|
-
expires_in: Math.max(0, Math.floor((rec.expiresAt - now) / 1000)),
|
|
65
|
-
// Presentation only, emitted after the verified poll pins/matches its holder.
|
|
66
|
-
authorization: (rec.expiresAt - now < 1000
|
|
67
|
-
? { state: "expired", approval_ready: false }
|
|
68
|
-
: {
|
|
69
|
-
state: "approval_ready",
|
|
70
|
-
approval_ready: true,
|
|
71
|
-
}),
|
|
72
|
-
}
|
|
73
|
-
: {}),
|
|
74
|
-
});
|
|
75
|
-
const pinnedErr = () => ({ error: KYAOS_ERRORS.pickupPinned });
|
|
76
|
-
const invalidSessionErr = () => ({ error: KYAOS_ERRORS.invalidSession });
|
|
77
|
-
const pickupExpiredErr = () => ({ error: KYAOS_ERRORS.pickupExpired });
|
|
78
|
-
/** Native records predating persisted signed expiry cannot safely be delivered. */
|
|
79
|
-
function nativeGrantExpired(rec, now) {
|
|
80
|
-
if (!rec.nativeHttp || rec.status !== "approved")
|
|
81
|
-
return false;
|
|
82
|
-
const exp = rec.delegation?.expiresAtUnix;
|
|
83
|
-
return (!Number.isSafeInteger(exp) ||
|
|
84
|
-
exp <= 0 ||
|
|
85
|
-
!Number.isSafeInteger(exp * 1000) ||
|
|
86
|
-
now >= exp * 1000);
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Pure reducer for `create`. Writes a fresh anchor record (PENDING, or PINNED when a
|
|
90
|
-
* challenge-time keyid pin is supplied). Idempotent by construction: a `pickup:<sid>`
|
|
91
|
-
* instance is created once, by the challenge emitter, before the 401 leaves.
|
|
92
|
-
*/
|
|
93
|
-
export function reduceCreate(rec, input, now) {
|
|
94
|
-
const i = input;
|
|
95
|
-
// Creation-bounding (W1): create is idempotent. A still-live anchor for this sid
|
|
96
|
-
// is reused as-is, so repeated challenges for the same (session, scopes) — which
|
|
97
|
-
// derive the same deterministic sid (see challenge-middleware.ts) — never orphan a
|
|
98
|
-
// fresh durable object or reset an in-flight pin/approval. The `reused: true`
|
|
99
|
-
// discriminator is the ONLY authoritative fresh-vs-existing signal: the DO input
|
|
100
|
-
// gate serializes creates, so exactly one racing caller sees a fresh write and
|
|
101
|
-
// every other sees `reused` (the anchor-registration route maps this onto
|
|
102
|
-
// checkpoint's 201-created / 200-existing status parity). Status stays 201 for
|
|
103
|
-
// both, so status-only callers (challenge-middleware) are unaffected.
|
|
104
|
-
if (rec && now <= rec.expiresAt) {
|
|
105
|
-
return {
|
|
106
|
-
response: {
|
|
107
|
-
status: 201,
|
|
108
|
-
body: { success: true, reused: true, anchor: anchorSnapshot(rec) },
|
|
109
|
-
},
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
if (i.nativeHttp &&
|
|
113
|
-
i.nativeIssuedAtMs !== undefined &&
|
|
114
|
-
(!Number.isSafeInteger(i.nativeIssuedAtMs) ||
|
|
115
|
-
i.nativeIssuedAtMs > now + 30_000 ||
|
|
116
|
-
i.nativeIssuedAtMs + 600_000 <= now))
|
|
117
|
-
return {
|
|
118
|
-
response: { status: 410, body: { error: "kyaos/pickup-expired" } },
|
|
119
|
-
};
|
|
120
|
-
const issuedAt = i.nativeHttp && i.nativeIssuedAtMs !== undefined ? i.nativeIssuedAtMs : now;
|
|
121
|
-
const record = {
|
|
122
|
-
sid: i.sid,
|
|
123
|
-
status: i.pin ? "pinned" : "pending",
|
|
124
|
-
requiredScopes: i.requiredScopes,
|
|
125
|
-
minAssurance: i.minAssurance,
|
|
126
|
-
pollIntervalS: i.pollIntervalS,
|
|
127
|
-
createdAt: now,
|
|
128
|
-
expiresAt: issuedAt +
|
|
129
|
-
Math.min(i.nativeHttp ? 600 : i.anchorTtlS, i.anchorTtlS) * 1000,
|
|
130
|
-
agentDid: typeof i.agentDid === "string" ? i.agentDid : undefined,
|
|
131
|
-
audience: typeof i.audience === "string" ? i.audience : undefined,
|
|
132
|
-
serverDid: typeof i.serverDid === "string" ? i.serverDid : undefined,
|
|
133
|
-
registeredAtMs: typeof i.registeredAtMs === "number" ? i.registeredAtMs : undefined,
|
|
134
|
-
issuedAtMs: issuedAt,
|
|
135
|
-
nativeHttp: i.nativeHttp,
|
|
136
|
-
nativeRegistration: i.nativeRegistration,
|
|
137
|
-
nativeIssuerDid: i.nativeIssuerDid,
|
|
138
|
-
nativePolicyRevision: i.nativePolicyRevision,
|
|
139
|
-
pin: i.pin
|
|
140
|
-
? {
|
|
141
|
-
type: i.pin.type,
|
|
142
|
-
valueSha256: i.pin.valueSha256,
|
|
143
|
-
pinnedAt: now,
|
|
144
|
-
source: "challenge",
|
|
145
|
-
}
|
|
146
|
-
: undefined,
|
|
147
|
-
};
|
|
148
|
-
return {
|
|
149
|
-
record,
|
|
150
|
-
response: {
|
|
151
|
-
status: 201,
|
|
152
|
-
body: { success: true, anchor: anchorSnapshot(record) },
|
|
153
|
-
},
|
|
154
|
-
};
|
|
155
|
-
}
|
|
156
|
-
/**
|
|
157
|
-
* Pure reducer for `poll`. The §13 wire state machine:
|
|
158
|
-
* - no record → 404 invalid-session;
|
|
159
|
-
* - `now > expiresAt` → 410 pickup-expired (the dispatcher deletes the key);
|
|
160
|
-
* - no pin yet → this poll pins `sha256Hex(holder.value)` (PENDING→PINNED);
|
|
161
|
-
* - pin mismatch (any state, incl. after approval) → 403 pickup-pinned;
|
|
162
|
-
* - pinned holder, awaiting consent, polling faster than `pollIntervalS` → 429;
|
|
163
|
-
* - pinned holder, credential parked → 200 ready (repeatable, no consume-on-read);
|
|
164
|
-
* - otherwise → 202 pending.
|
|
165
|
-
*/
|
|
166
|
-
export function reducePoll(rec, holder, now) {
|
|
167
|
-
if (!rec) {
|
|
168
|
-
return { response: { status: 404, body: invalidSessionErr() } };
|
|
169
|
-
}
|
|
170
|
-
if (now > rec.expiresAt || nativeGrantExpired(rec, now)) {
|
|
171
|
-
// delete-on-expired-read: a 410 outcome tells the dispatcher to drop the key.
|
|
172
|
-
return { response: { status: 410, body: pickupExpiredErr() } };
|
|
173
|
-
}
|
|
174
|
-
if (rec.nativeHttp &&
|
|
175
|
-
(!holder.nativeVerified ||
|
|
176
|
-
holder.type !== "keyid" ||
|
|
177
|
-
rec.nativeHttp.action.pin.mode !== "key")) {
|
|
178
|
-
return {
|
|
179
|
-
response: { status: 403, body: { error: "kyaos/profile-violation" } },
|
|
180
|
-
};
|
|
181
|
-
}
|
|
182
|
-
const holderSha = sha256Hex(holder.value);
|
|
183
|
-
let working = rec;
|
|
184
|
-
let pinnedJustNow = false;
|
|
185
|
-
if (rec.pin) {
|
|
186
|
-
// W2: require a matching holder TYPE as well as digest, so a token whose value
|
|
187
|
-
// equals a pinned keyid string (or vice-versa) can never satisfy the pin.
|
|
188
|
-
if (rec.pin.type !== holder.type || rec.pin.valueSha256 !== holderSha) {
|
|
189
|
-
return { response: { status: 403, body: pinnedErr() } };
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
else {
|
|
193
|
-
// First poll on an unpinned anchor pins the holder. The DO input gate makes this
|
|
194
|
-
// read-modify-write the compare-and-set: a racing second holder sees this pin.
|
|
195
|
-
working = {
|
|
196
|
-
...rec,
|
|
197
|
-
status: rec.status === "pending" ? "pinned" : rec.status,
|
|
198
|
-
pin: {
|
|
199
|
-
type: holder.type,
|
|
200
|
-
valueSha256: holderSha,
|
|
201
|
-
pinnedAt: now,
|
|
202
|
-
source: "first-poll",
|
|
203
|
-
...(rec.nativeHttp ? { keyId: holder.value } : {}),
|
|
204
|
-
},
|
|
205
|
-
};
|
|
206
|
-
pinnedJustNow = true;
|
|
207
|
-
}
|
|
208
|
-
// The holder is now the pinned holder. Deliver the parked credential if approved.
|
|
209
|
-
if (working.status === "approved" && working.delegation) {
|
|
210
|
-
const body = {
|
|
211
|
-
status: "ready",
|
|
212
|
-
token_type: "Bearer",
|
|
213
|
-
delegation: working.delegation.vcJwt,
|
|
214
|
-
expires_in: working.nativeHttp
|
|
215
|
-
? Math.max(0, Math.floor((working.delegation.expiresAtUnix * 1000 - now) / 1000))
|
|
216
|
-
: working.delegation.expiresInS,
|
|
217
|
-
};
|
|
218
|
-
return pinnedJustNow
|
|
219
|
-
? { record: working, response: { status: 200, body } }
|
|
220
|
-
: { response: { status: 200, body } };
|
|
221
|
-
}
|
|
222
|
-
// Awaiting consent. Throttle repeat polls by the pinned holder (never the pinning
|
|
223
|
-
// poll itself, and never the repeatable ready path above).
|
|
224
|
-
if (!pinnedJustNow &&
|
|
225
|
-
working.lastPollAt !== undefined &&
|
|
226
|
-
now - working.lastPollAt < working.pollIntervalS * 1000) {
|
|
227
|
-
return { response: { status: 429, retryAfterS: working.pollIntervalS } };
|
|
228
|
-
}
|
|
229
|
-
return {
|
|
230
|
-
record: { ...working, lastPollAt: now },
|
|
231
|
-
response: { status: 202, body: pendingBody(working, now) },
|
|
232
|
-
};
|
|
233
|
-
}
|
|
234
|
-
/**
|
|
235
|
-
* Pure reducer for `approve`. Parks the minted credential on a live anchor
|
|
236
|
-
* (PENDING or PINNED → APPROVED). Consent on an EXPIRED anchor MUST fail (410); an
|
|
237
|
-
* unknown anchor is 404 invalid-session.
|
|
238
|
-
*/
|
|
239
|
-
export function reduceApprove(rec, input, now) {
|
|
240
|
-
const i = input;
|
|
241
|
-
if (!rec) {
|
|
242
|
-
return { response: { status: 404, body: invalidSessionErr() } };
|
|
243
|
-
}
|
|
244
|
-
if (now > rec.expiresAt || nativeGrantExpired(rec, now)) {
|
|
245
|
-
return { response: { status: 410, body: pickupExpiredErr() } };
|
|
246
|
-
}
|
|
247
|
-
if (rec.nativeHttp && (!rec.pin?.keyId || rec.pin.type !== "keyid")) {
|
|
248
|
-
return {
|
|
249
|
-
response: { status: 409, body: { error: "kyaos/pickup-unpinned" } },
|
|
250
|
-
};
|
|
251
|
-
}
|
|
252
|
-
// Idempotent approve: once a credential is parked, a duplicate approval (a
|
|
253
|
-
// double-submit, two consent tabs) must NOT replace it. Each approve mints a fresh
|
|
254
|
-
// VC-JWT, so a blind upsert would swap a live delegation the pinned holder may
|
|
255
|
-
// already be picking up. Return the existing success without re-parking.
|
|
256
|
-
if (rec.status === "approved" && rec.delegation) {
|
|
257
|
-
if (rec.nativeHttp &&
|
|
258
|
-
(rec.delegation.vcJwt !== i.vcJwt ||
|
|
259
|
-
rec.delegation.expiresAtUnix !== i.expiresAtUnix)) {
|
|
260
|
-
return {
|
|
261
|
-
response: { status: 409, body: { error: "kyaos/session-mismatch" } },
|
|
262
|
-
};
|
|
263
|
-
}
|
|
264
|
-
return {
|
|
265
|
-
response: {
|
|
266
|
-
status: 200,
|
|
267
|
-
body: {
|
|
268
|
-
success: true,
|
|
269
|
-
...(rec.nativeHttp
|
|
270
|
-
? { expiresAtUnix: rec.delegation.expiresAtUnix }
|
|
271
|
-
: {}),
|
|
272
|
-
},
|
|
273
|
-
},
|
|
274
|
-
};
|
|
275
|
-
}
|
|
276
|
-
if (rec.nativeHttp &&
|
|
277
|
-
(!Number.isSafeInteger(i.expiresAtUnix) ||
|
|
278
|
-
i.expiresAtUnix <= 0 ||
|
|
279
|
-
!Number.isSafeInteger(i.expiresAtUnix * 1000) ||
|
|
280
|
-
i.expiresAtUnix > Math.floor(now / 1000) + 3630)) {
|
|
281
|
-
return {
|
|
282
|
-
response: { status: 400, body: { error: "kyaos/profile-violation" } },
|
|
283
|
-
};
|
|
284
|
-
}
|
|
285
|
-
if (rec.nativeHttp && now >= i.expiresAtUnix * 1000) {
|
|
286
|
-
return { response: { status: 410, body: pickupExpiredErr() } };
|
|
287
|
-
}
|
|
288
|
-
const record = {
|
|
289
|
-
...rec,
|
|
290
|
-
status: "approved",
|
|
291
|
-
delegation: {
|
|
292
|
-
vcJwt: i.vcJwt,
|
|
293
|
-
expiresInS: i.expiresInS,
|
|
294
|
-
approvedAt: now,
|
|
295
|
-
...(rec.nativeHttp ? { expiresAtUnix: i.expiresAtUnix } : {}),
|
|
296
|
-
},
|
|
297
|
-
};
|
|
298
|
-
return {
|
|
299
|
-
record,
|
|
300
|
-
response: {
|
|
301
|
-
status: 200,
|
|
302
|
-
body: {
|
|
303
|
-
success: true,
|
|
304
|
-
...(rec.nativeHttp ? { expiresAtUnix: i.expiresAtUnix } : {}),
|
|
305
|
-
},
|
|
306
|
-
},
|
|
307
|
-
};
|
|
308
|
-
}
|
|
309
|
-
/** Reducer outcome → wire `Response`, applying the frozen header rules. */
|
|
310
|
-
function wireResponse(r) {
|
|
311
|
-
const headers = { "Cache-Control": "no-store" };
|
|
312
|
-
if (r.status === 429) {
|
|
313
|
-
// 429 is status + Retry-After only — never a body (the §9 registry has no
|
|
314
|
-
// over-rate string to put there).
|
|
315
|
-
if (r.retryAfterS !== undefined)
|
|
316
|
-
headers["Retry-After"] = String(r.retryAfterS);
|
|
317
|
-
return new Response(null, { status: 429, headers });
|
|
318
|
-
}
|
|
319
|
-
headers["Content-Type"] = "application/json";
|
|
320
|
-
return new Response(r.body === undefined ? "" : JSON.stringify(r.body), {
|
|
321
|
-
status: r.status,
|
|
322
|
-
headers,
|
|
323
|
-
});
|
|
324
|
-
}
|
|
325
|
-
/**
|
|
326
|
-
* Dispatch `/_internal/pickup/*` requests against the anchor's durable-object
|
|
327
|
-
* storage. One `ctx.storage.get` up front, the matching pure reducer, then a single
|
|
328
|
-
* `put` (or `delete` on an expired 410 read) — no non-storage await between read and
|
|
329
|
-
* write, so the DO input gate makes the first-poll pin a compare-and-set.
|
|
330
|
-
*
|
|
331
|
-
* `now` is injectable for tests; production callers omit it and it resolves to the
|
|
332
|
-
* wall clock.
|
|
333
|
-
*/
|
|
334
|
-
export async function handlePickupInternal(ctx, request, now) {
|
|
335
|
-
const t = now ?? Date.now();
|
|
336
|
-
const path = new URL(request.url).pathname;
|
|
337
|
-
let body;
|
|
338
|
-
try {
|
|
339
|
-
body = (await request.json());
|
|
340
|
-
}
|
|
341
|
-
catch {
|
|
342
|
-
body = {};
|
|
343
|
-
}
|
|
344
|
-
const key = STORAGE_KEYS.pickupAnchor(String(body.sid));
|
|
345
|
-
const rec = (await ctx.storage.get(key));
|
|
346
|
-
if (path === INTERNAL_PICKUP_CREATE) {
|
|
347
|
-
const { record, response } = reduceCreate(rec, body, t);
|
|
348
|
-
if (record)
|
|
349
|
-
await ctx.storage.put(key, record);
|
|
350
|
-
return wireResponse(response);
|
|
351
|
-
}
|
|
352
|
-
if (path === INTERNAL_PICKUP_POLL) {
|
|
353
|
-
const h = body.holder;
|
|
354
|
-
if (!h ||
|
|
355
|
-
typeof h.value !== "string" ||
|
|
356
|
-
(h.type !== "token" && h.type !== "keyid")) {
|
|
357
|
-
return wireResponse({
|
|
358
|
-
status: 400,
|
|
359
|
-
body: {
|
|
360
|
-
error: "kyaos/invalid-request",
|
|
361
|
-
message: "missing or malformed holder",
|
|
362
|
-
},
|
|
363
|
-
});
|
|
364
|
-
}
|
|
365
|
-
const { record, response } = reducePoll(rec, h, t);
|
|
366
|
-
if (response.status === 410)
|
|
367
|
-
await ctx.storage.delete(key);
|
|
368
|
-
else if (record)
|
|
369
|
-
await ctx.storage.put(key, record);
|
|
370
|
-
return wireResponse(response);
|
|
371
|
-
}
|
|
372
|
-
if (path === INTERNAL_PICKUP_APPROVE) {
|
|
373
|
-
const { record, response } = reduceApprove(rec, body, t);
|
|
374
|
-
if (response.status === 410)
|
|
375
|
-
await ctx.storage.delete(key);
|
|
376
|
-
else if (record)
|
|
377
|
-
await ctx.storage.put(key, record);
|
|
378
|
-
return wireResponse(response);
|
|
379
|
-
}
|
|
380
|
-
if (path === INTERNAL_PICKUP_INFO) {
|
|
381
|
-
if (!rec) {
|
|
382
|
-
return wireResponse({ status: 404, body: invalidSessionErr() });
|
|
383
|
-
}
|
|
384
|
-
if (t > rec.expiresAt || nativeGrantExpired(rec, t)) {
|
|
385
|
-
await ctx.storage.delete(key);
|
|
386
|
-
return wireResponse({ status: 410, body: pickupExpiredErr() });
|
|
387
|
-
}
|
|
388
|
-
// NEVER expose the pin or the parked delegation here.
|
|
389
|
-
return wireResponse({
|
|
390
|
-
status: 200,
|
|
391
|
-
body: {
|
|
392
|
-
status: rec.status,
|
|
393
|
-
requiredScopes: rec.requiredScopes,
|
|
394
|
-
minAssurance: rec.minAssurance,
|
|
395
|
-
expiresAt: rec.expiresAt,
|
|
396
|
-
agentDid: rec.agentDid,
|
|
397
|
-
audience: rec.audience,
|
|
398
|
-
serverDid: rec.serverDid,
|
|
399
|
-
nativeHttp: rec.nativeHttp,
|
|
400
|
-
nativeRegistration: rec.nativeRegistration,
|
|
401
|
-
nativeIssuerDid: rec.nativeIssuerDid,
|
|
402
|
-
nativePolicyRevision: rec.nativePolicyRevision,
|
|
403
|
-
// This internal-only projection carries public key material for issuance.
|
|
404
|
-
...(rec.nativeHttp && rec.pin?.type === "keyid"
|
|
405
|
-
? { holderKeyId: rec.pin.keyId }
|
|
406
|
-
: {}),
|
|
407
|
-
},
|
|
408
|
-
});
|
|
409
|
-
}
|
|
410
|
-
return wireResponse({ status: 404, body: invalidSessionErr() });
|
|
411
|
-
}
|
|
412
|
-
//# sourceMappingURL=anchor-do.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"anchor-do.js","sourceRoot":"","sources":["../../src/delegation-http/anchor-do.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAKH,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,EACL,YAAY,EACZ,sBAAsB,EACtB,oBAAoB,EACpB,uBAAuB,EACvB,oBAAoB,GACrB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AA2BzD;;;;;GAKG;AACH,SAAS,cAAc,CAAC,GAAuB;IAC7C,OAAO;QACL,GAAG,EAAE,GAAG,CAAC,GAAG;QACZ,MAAM,EAAE,GAAG,CAAC,MAAM;QAClB,cAAc,EAAE,GAAG,CAAC,cAAc;QAClC,YAAY,EAAE,GAAG,CAAC,YAAY;QAC9B,SAAS,EAAE,GAAG,CAAC,SAAS;QACxB,SAAS,EAAE,GAAG,CAAC,SAAS;QACxB,cAAc,EAAE,GAAG,CAAC,cAAc;QAClC,UAAU,EAAE,GAAG,CAAC,UAAU;QAC1B,QAAQ,EAAE,GAAG,CAAC,QAAQ;QACtB,QAAQ,EAAE,GAAG,CAAC,QAAQ;QACtB,SAAS,EAAE,GAAG,CAAC,SAAS;QACxB,UAAU,EAAE,GAAG,CAAC,UAAU;QAC1B,kBAAkB,EAAE,GAAG,CAAC,kBAAkB;QAC1C,eAAe,EAAE,GAAG,CAAC,eAAe;QACpC,oBAAoB,EAAE,GAAG,CAAC,oBAAoB;KAC/C,CAAC;AACJ,CAAC;AAUD,MAAM,WAAW,GAAG,CAAC,GAAuB,EAAE,GAAW,EAAE,EAAE,CAAC,CAAC;IAC7D,MAAM,EAAE,SAAS;IACjB,4EAA4E;I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EAAE,iBAAiB,EAAE,EAAE,CAAC,CAAC;AAClE,CAAC"}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* draft-kya-http-02 delegation layer — anchor-registration request validation.
|
|
3
|
-
*
|
|
4
|
-
* Mirrors checkpoint's `registerSessionSchema` (bouncer validators) rule-for-rule
|
|
5
|
-
* for every field this worker consumes, so a body that checkpoint's own
|
|
6
|
-
* `POST /api/v1/bouncer/sessions` accepts is accepted here and vice versa — the
|
|
7
|
-
* wire shape is frozen by the vendored `registration.request.json` fixture.
|
|
8
|
-
* Optional metadata this worker does not consume (`client_identity`) is accepted
|
|
9
|
-
* and ignored rather than deep-validated; checkpoint remains the stricter end.
|
|
10
|
-
*
|
|
11
|
-
* @module @kya-os/mcp-i-cloudflare/delegation-http/anchor-registration-validate
|
|
12
|
-
*/
|
|
13
|
-
import { type NativeHttpRegistration } from "./native-http";
|
|
14
|
-
/** The parsed challenge block (snake_case wire keys camelized). */
|
|
15
|
-
export interface RegistrationChallenge {
|
|
16
|
-
http?: NativeHttpRegistration;
|
|
17
|
-
policyId?: string;
|
|
18
|
-
composedPolicyHash?: string;
|
|
19
|
-
requiredScopes: string[];
|
|
20
|
-
pepSurface?: string;
|
|
21
|
-
verdict?: string;
|
|
22
|
-
detectedAgentDid?: string;
|
|
23
|
-
challengePin?: string;
|
|
24
|
-
/**
|
|
25
|
-
* The resource org's DID — becomes the minted VC's `aud` (the value the
|
|
26
|
-
* resource PEP's §4.3 claim gate pins). ADDITIVE optional field: checkpoint's
|
|
27
|
-
* own route strips unknown challenge keys, so registrars may send it to
|
|
28
|
-
* either end; flagged for the SSOT schema in the C3 pass.
|
|
29
|
-
*/
|
|
30
|
-
audience?: string;
|
|
31
|
-
}
|
|
32
|
-
/** The parsed registration body (snake_case wire keys camelized). */
|
|
33
|
-
export interface RegistrationInput {
|
|
34
|
-
sessionId: string;
|
|
35
|
-
agentDid: string;
|
|
36
|
-
projectId: string;
|
|
37
|
-
createdAt: number;
|
|
38
|
-
clientName: string;
|
|
39
|
-
clientVersion?: string;
|
|
40
|
-
/** Challenged resource server's DID (already in checkpoint's schema, optional). */
|
|
41
|
-
serverDid?: string;
|
|
42
|
-
challenge?: RegistrationChallenge;
|
|
43
|
-
}
|
|
44
|
-
/** One validation failure, shaped like checkpoint's zod-error details entries. */
|
|
45
|
-
export interface ValidationIssue {
|
|
46
|
-
path: string;
|
|
47
|
-
message: string;
|
|
48
|
-
}
|
|
49
|
-
export type ValidationResult = {
|
|
50
|
-
ok: true;
|
|
51
|
-
input: RegistrationInput;
|
|
52
|
-
} | {
|
|
53
|
-
ok: false;
|
|
54
|
-
issues: ValidationIssue[];
|
|
55
|
-
};
|
|
56
|
-
/**
|
|
57
|
-
* Validate a registration body against the frozen wire contract. Returns the
|
|
58
|
-
* camelized input, or the full issue list (mirroring checkpoint's 400 `details`).
|
|
59
|
-
*/
|
|
60
|
-
export declare function validateRegistrationBody(raw: unknown): ValidationResult;
|
|
61
|
-
//# sourceMappingURL=anchor-registration-validate.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"anchor-registration-validate.d.ts","sourceRoot":"","sources":["../../src/delegation-http/anchor-registration-validate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,OAAO,EAA4B,KAAK,sBAAsB,EAAE,MAAM,eAAe,CAAC;AA2BtF,mEAAmE;AACnE,MAAM,WAAW,qBAAqB;IACpC,IAAI,CAAC,EAAE,sBAAsB,CAAC;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;;OAKG;IACH,QAAQ,CA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