@proofoftech/flowsafe 0.11.0 → 0.12.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 +36 -0
- package/README.md +65 -43
- package/deployment-identity-protocol.d.mts +52 -0
- package/deployment-identity-protocol.mjs +231 -0
- package/dist/agent-host/approval-resumer.d.ts +3 -3
- package/dist/agent-host/approval-resumer.d.ts.map +1 -1
- package/dist/agent-host/approval-resumer.js +6 -7
- package/dist/agent-host/approval-resumer.js.map +1 -1
- package/dist/agent-host/catalog.js +2 -2
- package/dist/agent-host/catalog.js.map +1 -1
- package/dist/agent-host/index.d.ts +2 -2
- package/dist/agent-host/index.d.ts.map +1 -1
- package/dist/agent-host/index.js.map +1 -1
- package/dist/agent-host/router.d.ts +2 -2
- package/dist/agent-host/router.d.ts.map +1 -1
- package/dist/agent-host/router.js +22 -54
- package/dist/agent-host/router.js.map +1 -1
- package/dist/agent-host/thread-host.d.ts +42 -8
- package/dist/agent-host/thread-host.d.ts.map +1 -1
- package/dist/agent-host/thread-host.js +533 -106
- package/dist/agent-host/thread-host.js.map +1 -1
- package/dist/agent-host/thread-topology.d.ts +28 -7
- package/dist/agent-host/thread-topology.d.ts.map +1 -1
- package/dist/agent-host/thread-topology.js +97 -39
- package/dist/agent-host/thread-topology.js.map +1 -1
- package/dist/agent-host/trusted-context.d.ts.map +1 -1
- package/dist/agent-host/trusted-context.js +3 -1
- package/dist/agent-host/trusted-context.js.map +1 -1
- package/dist/agent-host/types.d.ts +2 -0
- package/dist/agent-host/types.d.ts.map +1 -1
- package/dist/agent-runner/agent-run-state.d.ts +9 -8
- package/dist/agent-runner/agent-run-state.d.ts.map +1 -1
- package/dist/agent-runner/agent-run-state.js +78 -40
- package/dist/agent-runner/agent-run-state.js.map +1 -1
- package/dist/agent-runner/durable-agent-runner.d.ts +18 -16
- package/dist/agent-runner/durable-agent-runner.d.ts.map +1 -1
- package/dist/agent-runner/durable-agent-runner.js +120 -43
- package/dist/agent-runner/durable-agent-runner.js.map +1 -1
- package/dist/agent-runner/index.d.ts +1 -1
- package/dist/agent-runner/index.d.ts.map +1 -1
- package/dist/agent-runner/index.js +1 -1
- package/dist/agent-runner/index.js.map +1 -1
- package/dist/approval-api/actor-context.d.ts +67 -0
- package/dist/approval-api/actor-context.d.ts.map +1 -0
- package/dist/approval-api/actor-context.js +120 -0
- package/dist/approval-api/actor-context.js.map +1 -0
- package/dist/approval-api/contract.d.ts +12 -23
- package/dist/approval-api/contract.d.ts.map +1 -1
- package/dist/approval-api/d1-store.d.ts +7 -15
- package/dist/approval-api/d1-store.d.ts.map +1 -1
- package/dist/approval-api/d1-store.js +83 -159
- package/dist/approval-api/d1-store.js.map +1 -1
- package/dist/approval-api/grants.d.ts +3 -17
- package/dist/approval-api/grants.d.ts.map +1 -1
- package/dist/approval-api/grants.js +19 -39
- package/dist/approval-api/grants.js.map +1 -1
- package/dist/approval-api/index.d.ts +8 -8
- package/dist/approval-api/index.d.ts.map +1 -1
- package/dist/approval-api/index.js +5 -5
- package/dist/approval-api/index.js.map +1 -1
- package/dist/approval-api/principal.d.ts +29 -30
- package/dist/approval-api/principal.d.ts.map +1 -1
- package/dist/approval-api/principal.js +73 -54
- package/dist/approval-api/principal.js.map +1 -1
- package/dist/approval-api/resource-ownership.d.ts +64 -0
- package/dist/approval-api/resource-ownership.d.ts.map +1 -0
- package/dist/approval-api/resource-ownership.js +329 -0
- package/dist/approval-api/resource-ownership.js.map +1 -0
- package/dist/approval-api/retention.d.ts +6 -11
- package/dist/approval-api/retention.d.ts.map +1 -1
- package/dist/approval-api/retention.js +7 -12
- package/dist/approval-api/retention.js.map +1 -1
- package/dist/approval-api/router.d.ts +9 -8
- package/dist/approval-api/router.d.ts.map +1 -1
- package/dist/approval-api/router.js +50 -18
- package/dist/approval-api/router.js.map +1 -1
- package/dist/approval-api/service.d.ts +26 -36
- package/dist/approval-api/service.d.ts.map +1 -1
- package/dist/approval-api/service.js +104 -166
- package/dist/approval-api/service.js.map +1 -1
- package/dist/approval-api/store-factory.d.ts +19 -0
- package/dist/approval-api/store-factory.d.ts.map +1 -0
- package/dist/approval-api/store-factory.js +49 -0
- package/dist/approval-api/store-factory.js.map +1 -0
- package/dist/approval-api/store.d.ts +22 -36
- package/dist/approval-api/store.d.ts.map +1 -1
- package/dist/approval-api/store.js +48 -66
- package/dist/approval-api/store.js.map +1 -1
- package/dist/approval-api/types.d.ts +28 -22
- package/dist/approval-api/types.d.ts.map +1 -1
- package/dist/approval-api/types.js +51 -3
- package/dist/approval-api/types.js.map +1 -1
- package/dist/approval-ui/client.js +3 -3
- package/dist/approval-ui/client.js.map +1 -1
- package/dist/approval-ui/stream.d.ts +4 -4
- package/dist/approval-ui/stream.d.ts.map +1 -1
- package/dist/approval-ui/stream.js +2 -2
- package/dist/approval-ui/tips.d.ts +1 -1
- package/dist/approval-ui/tips.js +1 -1
- package/dist/approval-ui/tips.js.map +1 -1
- package/dist/approval-ui/use-approval-dashboard.d.ts +3 -3
- package/dist/approval-ui/use-approval-dashboard.js +1 -1
- package/dist/artifacts/index.d.ts +2 -3
- package/dist/artifacts/index.d.ts.map +1 -1
- package/dist/artifacts/index.js +9 -8
- package/dist/artifacts/index.js.map +1 -1
- package/dist/audit-export/audit-proxy.d.ts +71 -0
- package/dist/audit-export/audit-proxy.d.ts.map +1 -0
- package/dist/audit-export/audit-proxy.js +142 -0
- package/dist/audit-export/audit-proxy.js.map +1 -0
- package/dist/audit-export/index.d.ts +4 -7
- package/dist/audit-export/index.d.ts.map +1 -1
- package/dist/audit-export/index.js +1 -4
- package/dist/audit-export/index.js.map +1 -1
- package/dist/audit-export/queue-types.d.ts +5 -0
- package/dist/audit-export/queue-types.d.ts.map +1 -0
- package/dist/audit-export/queue-types.js +3 -0
- package/dist/audit-export/queue-types.js.map +1 -0
- package/dist/background-tasks/d1-storage.d.ts +9 -19
- package/dist/background-tasks/d1-storage.d.ts.map +1 -1
- package/dist/background-tasks/d1-storage.js +22 -52
- package/dist/background-tasks/d1-storage.js.map +1 -1
- package/dist/background-tasks/host.d.ts +4 -6
- package/dist/background-tasks/host.d.ts.map +1 -1
- package/dist/background-tasks/host.js +14 -17
- package/dist/background-tasks/host.js.map +1 -1
- package/dist/background-tasks/index.d.ts +1 -1
- package/dist/background-tasks/index.d.ts.map +1 -1
- package/dist/background-tasks/index.js +3 -3
- package/dist/background-tasks/index.js.map +1 -1
- package/dist/background-tasks/routes.d.ts +8 -4
- package/dist/background-tasks/routes.d.ts.map +1 -1
- package/dist/background-tasks/routes.js +33 -31
- package/dist/background-tasks/routes.js.map +1 -1
- package/dist/deployment-identity-protocol.d.ts +3 -0
- package/dist/deployment-identity-protocol.d.ts.map +1 -0
- package/dist/deployment-identity-protocol.js +3 -0
- package/dist/deployment-identity-protocol.js.map +1 -0
- package/dist/do-runner/breakwater-keys.d.ts +7 -5
- package/dist/do-runner/breakwater-keys.d.ts.map +1 -1
- package/dist/do-runner/breakwater-keys.js +7 -5
- package/dist/do-runner/breakwater-keys.js.map +1 -1
- package/dist/do-runner/cf-types.d.ts +18 -12
- package/dist/do-runner/cf-types.d.ts.map +1 -1
- package/dist/do-runner/cf-types.js.map +1 -1
- package/dist/do-runner/d1-storage.d.ts +44 -182
- package/dist/do-runner/d1-storage.d.ts.map +1 -1
- package/dist/do-runner/d1-storage.js +102 -353
- package/dist/do-runner/d1-storage.js.map +1 -1
- package/dist/do-runner/deployment-identity.d.ts +121 -0
- package/dist/do-runner/deployment-identity.d.ts.map +1 -0
- package/dist/do-runner/deployment-identity.js +272 -0
- package/dist/do-runner/deployment-identity.js.map +1 -0
- package/dist/do-runner/do-error-response.d.ts +1 -1
- package/dist/do-runner/do-error-response.d.ts.map +1 -1
- package/dist/do-runner/do-error-response.js +7 -1
- package/dist/do-runner/do-error-response.js.map +1 -1
- package/dist/do-runner/durable-object.d.ts +23 -16
- package/dist/do-runner/durable-object.d.ts.map +1 -1
- package/dist/do-runner/durable-object.js +303 -70
- package/dist/do-runner/durable-object.js.map +1 -1
- package/dist/do-runner/execution-context.d.ts +1 -0
- package/dist/do-runner/execution-context.d.ts.map +1 -1
- package/dist/do-runner/execution-context.js +4 -7
- package/dist/do-runner/execution-context.js.map +1 -1
- package/dist/do-runner/execution-principal-header.d.ts +16 -0
- package/dist/do-runner/execution-principal-header.d.ts.map +1 -0
- package/dist/do-runner/execution-principal-header.js +20 -0
- package/dist/do-runner/execution-principal-header.js.map +1 -0
- package/dist/do-runner/hub-do.d.ts +17 -25
- package/dist/do-runner/hub-do.d.ts.map +1 -1
- package/dist/do-runner/hub-do.js +63 -59
- package/dist/do-runner/hub-do.js.map +1 -1
- package/dist/do-runner/index.d.ts +12 -10
- package/dist/do-runner/index.d.ts.map +1 -1
- package/dist/do-runner/index.js +10 -9
- package/dist/do-runner/index.js.map +1 -1
- package/dist/do-runner/init.d.ts +0 -7
- package/dist/do-runner/init.d.ts.map +1 -1
- package/dist/do-runner/init.js +1 -2
- package/dist/do-runner/init.js.map +1 -1
- package/dist/do-runner/memory-id.d.ts +8 -25
- package/dist/do-runner/memory-id.d.ts.map +1 -1
- package/dist/do-runner/memory-id.js +25 -52
- package/dist/do-runner/memory-id.js.map +1 -1
- package/dist/do-runner/path-safe-id.d.ts +2 -48
- package/dist/do-runner/path-safe-id.d.ts.map +1 -1
- package/dist/do-runner/path-safe-id.js +3 -93
- package/dist/do-runner/path-safe-id.js.map +1 -1
- package/dist/do-runner/pubsub.d.ts +1 -1
- package/dist/do-runner/pubsub.js +1 -1
- package/dist/do-runner/runtime.d.ts +47 -34
- package/dist/do-runner/runtime.d.ts.map +1 -1
- package/dist/do-runner/runtime.js +281 -143
- package/dist/do-runner/runtime.js.map +1 -1
- package/dist/do-runner/schedule-source.d.ts +81 -0
- package/dist/do-runner/schedule-source.d.ts.map +1 -0
- package/dist/do-runner/schedule-source.js +64 -0
- package/dist/do-runner/schedule-source.js.map +1 -0
- package/dist/do-runner/thread-do.d.ts +18 -32
- package/dist/do-runner/thread-do.d.ts.map +1 -1
- package/dist/do-runner/thread-do.js +52 -74
- package/dist/do-runner/thread-do.js.map +1 -1
- package/dist/goals/objective-routes.d.ts +7 -4
- package/dist/goals/objective-routes.d.ts.map +1 -1
- package/dist/goals/objective-routes.js +58 -43
- package/dist/goals/objective-routes.js.map +1 -1
- package/dist/host-kit/approval-bridge.d.ts +18 -21
- package/dist/host-kit/approval-bridge.d.ts.map +1 -1
- package/dist/host-kit/approval-bridge.js +37 -37
- package/dist/host-kit/approval-bridge.js.map +1 -1
- package/dist/host-kit/bearer-auth.d.ts +3 -4
- package/dist/host-kit/bearer-auth.d.ts.map +1 -1
- package/dist/host-kit/bearer-auth.js +7 -11
- package/dist/host-kit/bearer-auth.js.map +1 -1
- package/dist/host-kit/do-run-topology.d.ts +14 -5
- package/dist/host-kit/do-run-topology.d.ts.map +1 -1
- package/dist/host-kit/do-run-topology.js +47 -15
- package/dist/host-kit/do-run-topology.js.map +1 -1
- package/dist/host-kit/env-vars.d.ts +1 -1
- package/dist/host-kit/env-vars.js +1 -1
- package/dist/host-kit/flowsafe-worker.d.ts +149 -73
- package/dist/host-kit/flowsafe-worker.d.ts.map +1 -1
- package/dist/host-kit/flowsafe-worker.js +619 -141
- package/dist/host-kit/flowsafe-worker.js.map +1 -1
- package/dist/host-kit/host-approval-service.d.ts +62 -54
- package/dist/host-kit/host-approval-service.d.ts.map +1 -1
- package/dist/host-kit/host-approval-service.js +90 -61
- package/dist/host-kit/host-approval-service.js.map +1 -1
- package/dist/host-kit/hub-topology.d.ts +6 -7
- package/dist/host-kit/hub-topology.d.ts.map +1 -1
- package/dist/host-kit/hub-topology.js +16 -12
- package/dist/host-kit/hub-topology.js.map +1 -1
- package/dist/host-kit/index.d.ts +13 -11
- package/dist/host-kit/index.d.ts.map +1 -1
- package/dist/host-kit/index.js +9 -12
- package/dist/host-kit/index.js.map +1 -1
- package/dist/host-kit/maintenance-capability.d.ts +58 -0
- package/dist/host-kit/maintenance-capability.d.ts.map +1 -0
- package/dist/host-kit/maintenance-capability.js +268 -0
- package/dist/host-kit/maintenance-capability.js.map +1 -0
- package/dist/host-kit/memory-boundary.d.ts +4 -19
- package/dist/host-kit/memory-boundary.d.ts.map +1 -1
- package/dist/host-kit/memory-boundary.js +12 -27
- package/dist/host-kit/memory-boundary.js.map +1 -1
- package/dist/host-kit/resource-access.d.ts +4 -0
- package/dist/host-kit/resource-access.d.ts.map +1 -0
- package/dist/host-kit/resource-access.js +12 -0
- package/dist/host-kit/resource-access.js.map +1 -0
- package/dist/host-kit/run-router.d.ts +25 -15
- package/dist/host-kit/run-router.d.ts.map +1 -1
- package/dist/host-kit/run-router.js +61 -46
- package/dist/host-kit/run-router.js.map +1 -1
- package/dist/host-kit/state-egress.d.ts +51 -0
- package/dist/host-kit/state-egress.d.ts.map +1 -0
- package/dist/host-kit/state-egress.js +120 -0
- package/dist/host-kit/state-egress.js.map +1 -0
- package/dist/host-kit/stream-router.d.ts +9 -4
- package/dist/host-kit/stream-router.d.ts.map +1 -1
- package/dist/host-kit/stream-router.js +45 -38
- package/dist/host-kit/stream-router.js.map +1 -1
- package/dist/host-kit/stream-ticket.d.ts +10 -10
- package/dist/host-kit/stream-ticket.d.ts.map +1 -1
- package/dist/host-kit/stream-ticket.js +60 -90
- package/dist/host-kit/stream-ticket.js.map +1 -1
- package/dist/host-kit/thread-topology.d.ts +17 -11
- package/dist/host-kit/thread-topology.d.ts.map +1 -1
- package/dist/host-kit/thread-topology.js +33 -59
- package/dist/host-kit/thread-topology.js.map +1 -1
- package/dist/host-kit/verifier.d.ts +6 -6
- package/dist/host-kit/verifier.d.ts.map +1 -1
- package/dist/host-kit/verifier.js +51 -119
- package/dist/host-kit/verifier.js.map +1 -1
- package/dist/http-body.d.ts +20 -0
- package/dist/http-body.d.ts.map +1 -0
- package/dist/http-body.js +67 -0
- package/dist/http-body.js.map +1 -0
- package/dist/schedules/index.d.ts +3 -2
- package/dist/schedules/index.d.ts.map +1 -1
- package/dist/schedules/index.js +5 -4
- package/dist/schedules/index.js.map +1 -1
- package/dist/schedules/router.d.ts +16 -10
- package/dist/schedules/router.d.ts.map +1 -1
- package/dist/schedules/router.js +153 -91
- package/dist/schedules/router.js.map +1 -1
- package/dist/schedules/schedules-d1.d.ts +88 -0
- package/dist/schedules/schedules-d1.d.ts.map +1 -1
- package/dist/schedules/schedules-d1.js +411 -50
- package/dist/schedules/schedules-d1.js.map +1 -1
- package/dist/schedules/target-policy.d.ts +29 -0
- package/dist/schedules/target-policy.d.ts.map +1 -0
- package/dist/schedules/target-policy.js +70 -0
- package/dist/schedules/target-policy.js.map +1 -0
- package/dist/schedules/tick.d.ts +125 -21
- package/dist/schedules/tick.d.ts.map +1 -1
- package/dist/schedules/tick.js +637 -160
- package/dist/schedules/tick.js.map +1 -1
- package/dist/signal-providers/delivery.d.ts +0 -19
- package/dist/signal-providers/delivery.d.ts.map +1 -1
- package/dist/signal-providers/delivery.js +5 -54
- package/dist/signal-providers/delivery.js.map +1 -1
- package/dist/signal-providers/github-provider.d.ts.map +1 -1
- package/dist/signal-providers/github-provider.js +9 -16
- package/dist/signal-providers/github-provider.js.map +1 -1
- package/dist/signal-providers/host-do.d.ts +3 -45
- package/dist/signal-providers/host-do.d.ts.map +1 -1
- package/dist/signal-providers/host-do.js +86 -106
- package/dist/signal-providers/host-do.js.map +1 -1
- package/dist/signal-providers/host-topology.d.ts +5 -14
- package/dist/signal-providers/host-topology.d.ts.map +1 -1
- package/dist/signal-providers/host-topology.js +11 -25
- package/dist/signal-providers/host-topology.js.map +1 -1
- package/dist/signal-providers/index.d.ts +3 -3
- package/dist/signal-providers/index.d.ts.map +1 -1
- package/dist/signal-providers/index.js +3 -3
- package/dist/signal-providers/index.js.map +1 -1
- package/dist/signal-providers/provider.d.ts +4 -5
- package/dist/signal-providers/provider.d.ts.map +1 -1
- package/dist/signal-providers/provider.js +5 -6
- package/dist/signal-providers/provider.js.map +1 -1
- package/dist/signal-providers/subscription-d1.d.ts +10 -57
- package/dist/signal-providers/subscription-d1.d.ts.map +1 -1
- package/dist/signal-providers/subscription-d1.js +208 -155
- package/dist/signal-providers/subscription-d1.js.map +1 -1
- package/dist/signal-providers/webhook-route.d.ts +28 -14
- package/dist/signal-providers/webhook-route.d.ts.map +1 -1
- package/dist/signal-providers/webhook-route.js +117 -88
- package/dist/signal-providers/webhook-route.js.map +1 -1
- package/dist/signals/client.js +8 -8
- package/dist/signals/client.js.map +1 -1
- package/dist/signals/d1-shared.js +1 -1
- package/dist/signals/d1-shared.js.map +1 -1
- package/dist/signals/index.d.ts +1 -1
- package/dist/signals/index.d.ts.map +1 -1
- package/dist/signals/index.js.map +1 -1
- package/dist/signals/notification-dispatch.d.ts +12 -6
- package/dist/signals/notification-dispatch.d.ts.map +1 -1
- package/dist/signals/notification-dispatch.js +37 -21
- package/dist/signals/notification-dispatch.js.map +1 -1
- package/dist/signals/notifications-d1.d.ts +5 -8
- package/dist/signals/notifications-d1.d.ts.map +1 -1
- package/dist/signals/notifications-d1.js +8 -13
- package/dist/signals/notifications-d1.js.map +1 -1
- package/dist/signals/router.d.ts +10 -10
- package/dist/signals/router.d.ts.map +1 -1
- package/dist/signals/router.js +49 -51
- package/dist/signals/router.js.map +1 -1
- package/dist/signals/thread-do-routes.d.ts +74 -15
- package/dist/signals/thread-do-routes.d.ts.map +1 -1
- package/dist/signals/thread-do-routes.js +484 -41
- package/dist/signals/thread-do-routes.js.map +1 -1
- package/dist/signals/thread-state-d1.d.ts.map +1 -1
- package/dist/signals/thread-state-d1.js +2 -3
- package/dist/signals/thread-state-d1.js.map +1 -1
- package/package.json +29 -6
- package/scripts/seed-deployment-identity.mjs +252 -0
- package/dist/approval-api/tenant-brand.d.ts +0 -35
- package/dist/approval-api/tenant-brand.d.ts.map +0 -1
- package/dist/approval-api/tenant-brand.js +0 -19
- package/dist/approval-api/tenant-brand.js.map +0 -1
- package/dist/approval-api/tenant-context.d.ts +0 -84
- package/dist/approval-api/tenant-context.d.ts.map +0 -1
- package/dist/approval-api/tenant-context.js +0 -112
- package/dist/approval-api/tenant-context.js.map +0 -1
- package/dist/approval-api/tenant-store.d.ts +0 -36
- package/dist/approval-api/tenant-store.d.ts.map +0 -1
- package/dist/approval-api/tenant-store.js +0 -129
- package/dist/approval-api/tenant-store.js.map +0 -1
- package/dist/do-runner/resume-ledger.d.ts +0 -48
- package/dist/do-runner/resume-ledger.d.ts.map +0 -1
- package/dist/do-runner/resume-ledger.js +0 -60
- package/dist/do-runner/resume-ledger.js.map +0 -1
- package/dist/do-runner/thread-header.d.ts +0 -31
- package/dist/do-runner/thread-header.d.ts.map +0 -1
- package/dist/do-runner/thread-header.js +0 -39
- package/dist/do-runner/thread-header.js.map +0 -1
- package/dist/host-kit/subdomain-check.d.ts +0 -23
- package/dist/host-kit/subdomain-check.d.ts.map +0 -1
- package/dist/host-kit/subdomain-check.js +0 -61
- package/dist/host-kit/subdomain-check.js.map +0 -1
- package/dist/host-kit/tenant-registry.d.ts +0 -51
- package/dist/host-kit/tenant-registry.d.ts.map +0 -1
- package/dist/host-kit/tenant-registry.js +0 -88
- package/dist/host-kit/tenant-registry.js.map +0 -1
|
@@ -1,101 +1,75 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
-
// The per-thread DO topology seam — and the
|
|
3
|
-
// ThreadDurableObject verifies (DL-002). Mint and verify ship together,
|
|
4
|
-
//
|
|
5
|
-
// write is not a check.
|
|
2
|
+
// The per-thread DO topology seam — and the minter for the execution-principal
|
|
3
|
+
// header ThreadDurableObject verifies (DL-002). Mint and verify ship together,
|
|
4
|
+
// because a verifier whose input the caller can write is not a check.
|
|
6
5
|
//
|
|
7
6
|
// THE TRAP THIS EXISTS TO CLOSE. The house idiom for forwarding into a DO is
|
|
8
|
-
// hub-topology.ts's `forwardSubscribe
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
// event.record.tenantId against its own id.name from server-side data). A thread
|
|
7
|
+
// hub-topology.ts's `forwardSubscribe(request) => stub().fetch(request)` — the
|
|
8
|
+
// CLIENT's Request, headers and all. That is safe for the hub, which trusts the
|
|
9
|
+
// forwarded request for nothing. A thread
|
|
12
10
|
// route copying that shape would hand the client the very header the thread DO
|
|
13
|
-
// authenticates on
|
|
14
|
-
//
|
|
15
|
-
// including forwarded upgrades, where it OVERWRITES rather than defaults.
|
|
11
|
+
// authenticates on. This module, not the caller, decides the principal header's
|
|
12
|
+
// value on every path, including forwarded upgrades, where it overwrites.
|
|
16
13
|
//
|
|
17
14
|
// Reach a thread DO through here. A route that addresses the namespace itself
|
|
18
|
-
// re-opens the hole, so
|
|
19
|
-
//
|
|
20
|
-
// threadId the caller's tenant does not own BEFORE the DO is ever addressed.
|
|
15
|
+
// re-opens the hole, so `send`/`forward` are the sanctioned surface and both
|
|
16
|
+
// validate the threadId before the DO is addressed.
|
|
21
17
|
//
|
|
22
18
|
// Structural namespace/stub types (method syntax, so a real
|
|
23
19
|
// DurableObjectNamespace satisfies them under TS method-parameter bivariance),
|
|
24
20
|
// keeping host-kit free of @cloudflare/workers-types — same convention as
|
|
25
21
|
// RunnerNamespaceLike / HubNamespaceLike.
|
|
26
22
|
import { assertExecutionPrincipal, encodeExecutionPrincipal, } from '../approval-api/index.js';
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
23
|
+
import { deploymentIdentityHeaders, EXECUTION_PRINCIPAL_HEADER, stampDeploymentIdentityRequest, } from '../do-runner/index.js';
|
|
24
|
+
import { requireMemoryId } from './memory-boundary.js';
|
|
29
25
|
/**
|
|
30
|
-
* The
|
|
31
|
-
* to. The principal is the ONLY identity on the wire: the DO projects
|
|
32
|
-
* `scope.actor` from it, so a host's separate `TenantContext.actor` can never
|
|
26
|
+
* The principal is the only identity on the wire; no parallel actor header can
|
|
33
27
|
* disagree with what executes.
|
|
34
|
-
*
|
|
35
|
-
* The tenant check matters because `encodeExecutionPrincipal` deliberately omits
|
|
36
|
-
* `tenantId` and the DO re-binds it from its own authenticated tenant: without
|
|
37
|
-
* this, a context whose principal belongs to another tenant would be silently
|
|
38
|
-
* re-tenanted, and the audit trail would name the wrong tenant's principal with
|
|
39
|
-
* nothing flagging it.
|
|
40
28
|
*/
|
|
41
|
-
function stampedPrincipal(
|
|
42
|
-
return assertExecutionPrincipal(
|
|
29
|
+
function stampedPrincipal(context) {
|
|
30
|
+
return assertExecutionPrincipal(context.principal, 'thread topology principal');
|
|
43
31
|
}
|
|
44
|
-
export function createThreadTopology(namespace) {
|
|
45
|
-
// One DO per thread: id.name
|
|
46
|
-
// carries its tenant exactly like a runId carries its own (DL-002).
|
|
32
|
+
export function createThreadTopology(namespace, deploymentIdentitySecret) {
|
|
33
|
+
// One DO per thread: id.name is the host-minted threadId (DL-002).
|
|
47
34
|
const stub = (threadId) => namespace.get(namespace.idFromName(threadId));
|
|
48
|
-
|
|
49
|
-
// subsumes the other: this 404 is what stops tenant B reaching tenant A's
|
|
50
|
-
// thread at all, and the header the DO re-asserts is what stops a routing bug
|
|
51
|
-
// here from being the only thing between them.
|
|
52
|
-
const owned = (tenant, threadId) => requireOwnedMemoryId(tenant, threadId, 'threadId');
|
|
35
|
+
const addressed = (threadId) => requireMemoryId(threadId, 'threadId');
|
|
53
36
|
// Both surfaces are `async` so the ownership refusal REJECTS rather than
|
|
54
37
|
// throwing synchronously out of a Promise-typed call: a caller writing
|
|
55
38
|
// `topology.send(...).catch(handle)` would never see a sync throw, and the
|
|
56
39
|
// 404 would escape past the very handler meant to map it.
|
|
57
40
|
return {
|
|
58
|
-
send: async (
|
|
59
|
-
// Merge through Headers so the stamp wins by case-
|
|
60
|
-
// plain-object spread
|
|
61
|
-
// property; Headers' fill algorithm then appends both into `globex, acme`,
|
|
62
|
-
// which the DO reads as claimed !== tenantId — a 403 that looks like an
|
|
63
|
-
// identity attack (fail-closed, but the wrong error and a false
|
|
64
|
-
// "spelling cannot win" story). `set` is the primitive `forward` already
|
|
65
|
-
// relies on; it overwrites at every spelling. The value is the RESOLVED
|
|
66
|
-
// tenant context (authenticate -> INV-3 -> bind), never a header or body.
|
|
41
|
+
send: async (context, threadId, path, init = {}) => {
|
|
42
|
+
// Merge through Headers so the stamp wins by case-insensitive name. A
|
|
43
|
+
// plain-object spread can preserve duplicate case variants instead.
|
|
67
44
|
const merged = new Headers(init.headers);
|
|
68
|
-
const principal = stampedPrincipal(
|
|
69
|
-
merged.set(
|
|
70
|
-
merged.set(THREAD_PRINCIPAL_HEADER, encodeExecutionPrincipal(principal));
|
|
45
|
+
const principal = stampedPrincipal(context);
|
|
46
|
+
merged.set(EXECUTION_PRINCIPAL_HEADER, encodeExecutionPrincipal(principal));
|
|
71
47
|
// Retired identity headers: nothing reads them, but a caller's value must
|
|
72
48
|
// not ride into the DO as if the topology had stamped it.
|
|
73
49
|
merged.delete('x-flowsafe-actor');
|
|
74
50
|
merged.delete('x-flowsafe-role');
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
});
|
|
79
|
-
return stub(owned(tenant, threadId)).fetch(`http://thread${path}`, {
|
|
51
|
+
merged.delete('x-flowsafe-tenant');
|
|
52
|
+
const headers = deploymentIdentityHeaders(deploymentIdentitySecret, merged);
|
|
53
|
+
return stub(addressed(threadId)).fetch(`http://thread${path}`, {
|
|
80
54
|
...init,
|
|
81
55
|
headers,
|
|
82
56
|
});
|
|
83
57
|
},
|
|
84
|
-
forward: async (
|
|
85
|
-
const
|
|
58
|
+
forward: async (context, threadId, request) => {
|
|
59
|
+
const threadName = addressed(threadId);
|
|
86
60
|
// A cloned Request has MUTABLE headers where an inbound one does not, so
|
|
87
61
|
// this is what lets the overwrite happen at all — and `set` (not `append`)
|
|
88
62
|
// is what makes a forged client value vanish rather than ride along as a
|
|
89
63
|
// second value the DO might read.
|
|
90
|
-
const forwarded =
|
|
91
|
-
const principal = stampedPrincipal(
|
|
92
|
-
forwarded.headers.set(THREAD_TENANT_HEADER, tenant.tenantId);
|
|
64
|
+
const forwarded = stampDeploymentIdentityRequest(request, deploymentIdentitySecret);
|
|
65
|
+
const principal = stampedPrincipal(context);
|
|
93
66
|
// Retired identity headers: nothing reads them, but a client's forged
|
|
94
67
|
// value must not ride into the DO as if the topology had stamped it.
|
|
95
68
|
forwarded.headers.delete('x-flowsafe-actor');
|
|
96
69
|
forwarded.headers.delete('x-flowsafe-role');
|
|
97
|
-
forwarded.headers.
|
|
98
|
-
|
|
70
|
+
forwarded.headers.delete('x-flowsafe-tenant');
|
|
71
|
+
forwarded.headers.set(EXECUTION_PRINCIPAL_HEADER, encodeExecutionPrincipal(principal));
|
|
72
|
+
return stub(threadName).fetch(forwarded);
|
|
99
73
|
},
|
|
100
74
|
};
|
|
101
75
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"thread-topology.js","sourceRoot":"","sources":["../../src/host-kit/thread-topology.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC
|
|
1
|
+
{"version":3,"file":"thread-topology.js","sourceRoot":"","sources":["../../src/host-kit/thread-topology.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,+EAA+E;AAC/E,+EAA+E;AAC/E,sEAAsE;AACtE,EAAE;AACF,6EAA6E;AAC7E,+EAA+E;AAC/E,gFAAgF;AAChF,0CAA0C;AAC1C,+EAA+E;AAC/E,gFAAgF;AAChF,0EAA0E;AAC1E,EAAE;AACF,8EAA8E;AAC9E,6EAA6E;AAC7E,oDAAoD;AACpD,EAAE;AACF,4DAA4D;AAC5D,+EAA+E;AAC/E,0EAA0E;AAC1E,0CAA0C;AAE1C,OAAO,EAEL,wBAAwB,EACxB,wBAAwB,GACzB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,yBAAyB,EACzB,0BAA0B,EAC1B,8BAA8B,GAC/B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAuEvD;;;GAGG;AACH,SAAS,gBAAgB,CAAC,OAA+B;IACvD,OAAO,wBAAwB,CAC7B,OAAO,CAAC,SAAS,EACjB,2BAA2B,CAC5B,CAAC;AACJ,CAAC;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AQ,CAAC,CAAC;YACvC,yEAAyE;YACzE,2EAA2E;YAC3E,yEAAyE;YACzE,kCAAkC;YAClC,MAAM,SAAS,GAAG,8BAA8B,CAC9C,OAAO,EACP,wBAAwB,CACzB,CAAC;YACF,MAAM,SAAS,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;YAC5C,sEAAsE;YACtE,qEAAqE;YACrE,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC;YAC7C,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;YAC5C,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC;YAC9C,SAAS,CAAC,OAAO,CAAC,GAAG,CACnB,0BAA0B,EAC1B,wBAAwB,CAAC,SAAS,CAAC,CACpC,CAAC;YACF,OAAO,IAAI,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QAC3C,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -5,8 +5,7 @@ export interface TokenVerifier {
|
|
|
5
5
|
/**
|
|
6
6
|
* Validate an untyped candidate into an ApprovalActor — the ONE place a
|
|
7
7
|
* decoded token/map entry becomes an identity. No `as`-casting at the JSON
|
|
8
|
-
* boundary: id non-empty
|
|
9
|
-
* reserved identity.
|
|
8
|
+
* boundary: id non-empty and role recognized.
|
|
10
9
|
*/
|
|
11
10
|
export declare function toApprovalActor(candidate: unknown): ApprovalActor | undefined;
|
|
12
11
|
/** The parsed bearer map as a TokenVerifier (entries are pre-validated). */
|
|
@@ -36,10 +35,11 @@ export declare function hmacSign(secret: string, payload: string): Promise<strin
|
|
|
36
35
|
*
|
|
37
36
|
* The algorithm is PINNED: only `alg: "HS256"` verifies — `none` and every
|
|
38
37
|
* negotiated value are rejected before any cryptography runs, so a token
|
|
39
|
-
* cannot choose its own verification scheme.
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
* (string or array), then sub/role
|
|
38
|
+
* cannot choose its own verification scheme. JOSE owns key import and
|
|
39
|
+
* signature verification; no hand-rolled comparison remains. The protected
|
|
40
|
+
* typ is pinned to JWT. Claims checked: exp (required),
|
|
41
|
+
* nbf (when present), iss, aud (string or array), then sub/role through
|
|
42
|
+
* toApprovalActor.
|
|
43
43
|
*/
|
|
44
44
|
export declare function hmacVerifier(options: HmacVerifierOptions): TokenVerifier;
|
|
45
45
|
export interface MintHmacTokenOptions {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verifier.d.ts","sourceRoot":"","sources":["../../src/host-kit/verifier.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"verifier.d.ts","sourceRoot":"","sources":["../../src/host-kit/verifier.ts"],"names":[],"mappings":"AAgBA,OAAO,EACL,KAAK,aAAa,EAEnB,MAAM,0BAA0B,CAAC;AAElC,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC,CAAC;CAC3D;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,OAAO,GAAG,aAAa,GAAG,SAAS,CAE7E;AAED,4EAA4E;AAC5E,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,aAAa,CAAC,GACzC,aAAa,CAWf;AAED,MAAM,WAAW,mBAAmB;IAClC;;;;OAIG;IACH,IAAI,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,8DAA8D;IAC9D,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CACpB;AAID,wBAAgB,eAAe,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAOzD;AAED;;;;;GAKG;AACH,wBAAsB,QAAQ,CAC5B,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,MAAM,CAAC,CAQjB;AAeD;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,mBAAmB,GAAG,aAAa,CAoCxE;AAED,MAAM,WAAW,oBAAoB;IACnC,qEAAqE;IACrE,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,aAAa,CAAC;IACrB,mDAAmD;IACnD,UAAU,EAAE,MAAM,CAAC;IACnB,8DAA8D;IAC9D,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CACpB;AAED;;;;GAIG;AACH,wBAAsB,aAAa,CACjC,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,MAAM,CAAC,CAUjB"}
|
|
@@ -9,78 +9,34 @@
|
|
|
9
9
|
// worker mints these; a commercial IdP later drops in as another
|
|
10
10
|
// TokenVerifier implementation without touching the routers).
|
|
11
11
|
//
|
|
12
|
-
// TRUSTED-COMPUTING-BASE code: a verifier
|
|
13
|
-
//
|
|
14
|
-
//
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
// default actor.
|
|
18
|
-
import { APPROVAL_ROLES } from '../approval-api/index.js';
|
|
19
|
-
import { RESERVED_TENANT_IDS, TENANT_ID_PATTERN, } from '../do-runner/path-safe-id.js';
|
|
12
|
+
// TRUSTED-COMPUTING-BASE code: a verifier asserts identity. Every path out of
|
|
13
|
+
// this module validates the role before an ApprovalActor exists. Fail closed:
|
|
14
|
+
// anything malformed verifies to `undefined` (a 401), never to a default actor.
|
|
15
|
+
import { jwtVerify, SignJWT } from 'jose';
|
|
16
|
+
import { canonicalApprovalActor, } from '../approval-api/index.js';
|
|
20
17
|
/**
|
|
21
18
|
* Validate an untyped candidate into an ApprovalActor — the ONE place a
|
|
22
19
|
* decoded token/map entry becomes an identity. No `as`-casting at the JSON
|
|
23
|
-
* boundary: id non-empty
|
|
24
|
-
* reserved identity.
|
|
20
|
+
* boundary: id non-empty and role recognized.
|
|
25
21
|
*/
|
|
26
22
|
export function toApprovalActor(candidate) {
|
|
27
|
-
|
|
28
|
-
return undefined;
|
|
29
|
-
const { id, role, tenantId } = candidate;
|
|
30
|
-
if (typeof id !== 'string' || id.length === 0)
|
|
31
|
-
return undefined;
|
|
32
|
-
if (typeof role !== 'string' ||
|
|
33
|
-
!APPROVAL_ROLES.includes(role)) {
|
|
34
|
-
return undefined;
|
|
35
|
-
}
|
|
36
|
-
if (typeof tenantId !== 'string' || !TENANT_ID_PATTERN.test(tenantId)) {
|
|
37
|
-
return undefined;
|
|
38
|
-
}
|
|
39
|
-
// 'system' is the TCB's own audit identity (cron maintenance attribution);
|
|
40
|
-
// a client token claiming it would launder into the operator's maintenance
|
|
41
|
-
// log stream. Only RESERVED_TENANT_IDS bites here: rejecting the routing
|
|
42
|
-
// slugs (api/docs/...) too would 401 a single-tenant host named 'api' over
|
|
43
|
-
// a subdomain collision that cannot occur on a host with no subdomains —
|
|
44
|
-
// those stay allocation/routing concerns (RESERVED_FOR_ALLOCATION).
|
|
45
|
-
if (RESERVED_TENANT_IDS.includes(tenantId))
|
|
46
|
-
return undefined;
|
|
47
|
-
return { id, role: role, tenantId };
|
|
23
|
+
return canonicalApprovalActor(candidate);
|
|
48
24
|
}
|
|
49
25
|
/** The parsed bearer map as a TokenVerifier (entries are pre-validated). */
|
|
50
26
|
export function staticTokenVerifier(actors) {
|
|
27
|
+
const canonical = new Map();
|
|
28
|
+
for (const [token, actor] of actors) {
|
|
29
|
+
const snapshot = canonicalApprovalActor(actor);
|
|
30
|
+
if (snapshot)
|
|
31
|
+
canonical.set(token, snapshot);
|
|
32
|
+
}
|
|
51
33
|
return {
|
|
52
34
|
async verify(token) {
|
|
53
|
-
return
|
|
35
|
+
return canonical.get(token);
|
|
54
36
|
},
|
|
55
37
|
};
|
|
56
38
|
}
|
|
57
39
|
const encoder = new TextEncoder();
|
|
58
|
-
function base64UrlDecodeBytes(segment) {
|
|
59
|
-
const normalized = segment.replace(/-/g, '+').replace(/_/g, '/');
|
|
60
|
-
const padded = normalized + '='.repeat((4 - (normalized.length % 4)) % 4);
|
|
61
|
-
try {
|
|
62
|
-
const binary = atob(padded);
|
|
63
|
-
const bytes = new Uint8Array(binary.length);
|
|
64
|
-
for (let index = 0; index < binary.length; index += 1) {
|
|
65
|
-
bytes[index] = binary.charCodeAt(index);
|
|
66
|
-
}
|
|
67
|
-
return bytes;
|
|
68
|
-
}
|
|
69
|
-
catch {
|
|
70
|
-
return undefined;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
function base64UrlDecodeJson(segment) {
|
|
74
|
-
const bytes = base64UrlDecodeBytes(segment);
|
|
75
|
-
if (!bytes)
|
|
76
|
-
return undefined;
|
|
77
|
-
try {
|
|
78
|
-
return JSON.parse(new TextDecoder().decode(bytes));
|
|
79
|
-
}
|
|
80
|
-
catch {
|
|
81
|
-
return undefined;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
40
|
export function base64UrlEncode(bytes) {
|
|
85
41
|
let binary = '';
|
|
86
42
|
for (const byte of bytes)
|
|
@@ -109,60 +65,43 @@ async function importHmacKey(secret, usage) {
|
|
|
109
65
|
*
|
|
110
66
|
* The algorithm is PINNED: only `alg: "HS256"` verifies — `none` and every
|
|
111
67
|
* negotiated value are rejected before any cryptography runs, so a token
|
|
112
|
-
* cannot choose its own verification scheme.
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
* (string or array), then sub/role
|
|
68
|
+
* cannot choose its own verification scheme. JOSE owns key import and
|
|
69
|
+
* signature verification; no hand-rolled comparison remains. The protected
|
|
70
|
+
* typ is pinned to JWT. Claims checked: exp (required),
|
|
71
|
+
* nbf (when present), iss, aud (string or array), then sub/role through
|
|
72
|
+
* toApprovalActor.
|
|
116
73
|
*/
|
|
117
74
|
export function hmacVerifier(options) {
|
|
118
75
|
const now = options.now ?? Date.now;
|
|
119
76
|
return {
|
|
120
77
|
async verify(token) {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
78
|
+
try {
|
|
79
|
+
const { payload } = await jwtVerify(token, async (protectedHeader) => {
|
|
80
|
+
if (protectedHeader.alg !== 'HS256') {
|
|
81
|
+
throw new Error('unsupported token algorithm');
|
|
82
|
+
}
|
|
83
|
+
const secret = typeof protectedHeader.kid === 'string'
|
|
84
|
+
? options.keys.get(protectedHeader.kid)
|
|
85
|
+
: protectedHeader.kid === undefined && options.keys.size === 1
|
|
86
|
+
? [...options.keys.values()][0]
|
|
87
|
+
: undefined;
|
|
88
|
+
if (secret === undefined)
|
|
89
|
+
throw new Error('unknown token key');
|
|
90
|
+
return encoder.encode(secret);
|
|
91
|
+
}, {
|
|
92
|
+
algorithms: ['HS256'],
|
|
93
|
+
typ: 'JWT',
|
|
94
|
+
issuer: options.issuer,
|
|
95
|
+
audience: options.audience,
|
|
96
|
+
currentDate: new Date(now()),
|
|
97
|
+
clockTolerance: 0,
|
|
98
|
+
requiredClaims: ['exp'],
|
|
99
|
+
});
|
|
100
|
+
return toApprovalActor({ id: payload.sub, role: payload.role });
|
|
134
101
|
}
|
|
135
|
-
|
|
136
|
-
return undefined;
|
|
137
|
-
const signature = base64UrlDecodeBytes(signaturePart);
|
|
138
|
-
if (!signature)
|
|
139
|
-
return undefined;
|
|
140
|
-
const key = await importHmacKey(secret, 'verify');
|
|
141
|
-
const valid = await crypto.subtle.verify('HMAC', key, signature, encoder.encode(`${headerPart}.${claimsPart}`));
|
|
142
|
-
if (!valid)
|
|
143
|
-
return undefined;
|
|
144
|
-
const claims = base64UrlDecodeJson(claimsPart);
|
|
145
|
-
if (!claims)
|
|
102
|
+
catch {
|
|
146
103
|
return undefined;
|
|
147
|
-
const nowSeconds = now() / 1000;
|
|
148
|
-
if (typeof claims.exp !== 'number' || nowSeconds >= claims.exp) {
|
|
149
|
-
return undefined;
|
|
150
|
-
}
|
|
151
|
-
if (claims.nbf !== undefined) {
|
|
152
|
-
if (typeof claims.nbf !== 'number' || nowSeconds < claims.nbf) {
|
|
153
|
-
return undefined;
|
|
154
|
-
}
|
|
155
104
|
}
|
|
156
|
-
if (claims.iss !== options.issuer)
|
|
157
|
-
return undefined;
|
|
158
|
-
const audiences = Array.isArray(claims.aud) ? claims.aud : [claims.aud];
|
|
159
|
-
if (!audiences.includes(options.audience))
|
|
160
|
-
return undefined;
|
|
161
|
-
return toApprovalActor({
|
|
162
|
-
id: claims.sub,
|
|
163
|
-
role: claims.role,
|
|
164
|
-
tenantId: claims.tenantId,
|
|
165
|
-
});
|
|
166
105
|
},
|
|
167
106
|
};
|
|
168
107
|
}
|
|
@@ -173,20 +112,13 @@ export function hmacVerifier(options) {
|
|
|
173
112
|
*/
|
|
174
113
|
export async function mintHmacToken(options) {
|
|
175
114
|
const nowSeconds = Math.floor((options.now ?? Date.now)() / 1000);
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
exp: nowSeconds + options.ttlSeconds,
|
|
185
|
-
};
|
|
186
|
-
const headerPart = base64UrlEncode(encoder.encode(JSON.stringify(header)));
|
|
187
|
-
const claimsPart = base64UrlEncode(encoder.encode(JSON.stringify(claims)));
|
|
188
|
-
const key = await importHmacKey(options.secret, 'sign');
|
|
189
|
-
const signature = await crypto.subtle.sign('HMAC', key, encoder.encode(`${headerPart}.${claimsPart}`));
|
|
190
|
-
return `${headerPart}.${claimsPart}.${base64UrlEncode(new Uint8Array(signature))}`;
|
|
115
|
+
return new SignJWT({ role: options.actor.role })
|
|
116
|
+
.setProtectedHeader({ alg: 'HS256', typ: 'JWT', kid: options.kid })
|
|
117
|
+
.setIssuer(options.issuer)
|
|
118
|
+
.setAudience(options.audience)
|
|
119
|
+
.setSubject(options.actor.id)
|
|
120
|
+
.setIssuedAt(nowSeconds)
|
|
121
|
+
.setExpirationTime(nowSeconds + options.ttlSeconds)
|
|
122
|
+
.sign(encoder.encode(options.secret));
|
|
191
123
|
}
|
|
192
124
|
//# sourceMappingURL=verifier.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verifier.js","sourceRoot":"","sources":["../../src/host-kit/verifier.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,6EAA6E;AAC7E,8EAA8E;AAC9E,qDAAqD;AACrD,EAAE;AACF,6EAA6E;AAC7E,0BAA0B;AAC1B,2EAA2E;AAC3E,qEAAqE;AACrE,kEAAkE;AAClE,EAAE;AACF,
|
|
1
|
+
{"version":3,"file":"verifier.js","sourceRoot":"","sources":["../../src/host-kit/verifier.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,6EAA6E;AAC7E,8EAA8E;AAC9E,qDAAqD;AACrD,EAAE;AACF,6EAA6E;AAC7E,0BAA0B;AAC1B,2EAA2E;AAC3E,qEAAqE;AACrE,kEAAkE;AAClE,EAAE;AACF,8EAA8E;AAC9E,8EAA8E;AAC9E,gFAAgF;AAEhF,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC1C,OAAO,EAEL,sBAAsB,GACvB,MAAM,0BAA0B,CAAC;AAMlC;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,SAAkB;IAChD,OAAO,sBAAsB,CAAC,SAAS,CAAC,CAAC;AAC3C,CAAC;AAED,4EAA4E;AAC5E,MAAM,UAAU,mBAAmB,CACjC,MAA0C;IAE1C,MAAM,SAAS,GAAG,IAAI,GAAG,EAAyB,CAAC;IACnD,KAAK,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,MAAM,EAAE,CAAC;QACpC,MAAM,QAAQ,GAAG,sBAAsB,CAAC,KAAK,CAAC,CAAC;QAC/C,IAAI,QAAQ;YAAE,SAAS,CAAC,GAAG,CAAC,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GAAG,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;YAClE,CAAC;YAAC,MAAM,CAAC;gBACP,OAAO,SAAS,CAAC;YACnB,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC;AAeD;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,OAA6B;IAE7B,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC;IAClE,OAAO,IAAI,OAAO,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;SAC7C,kBAAkB,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC;SAClE,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC;SACzB,WAAW,CAAC,OAAO,CAAC,QAAQ,CAAC;SAC7B,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;SAC5B,WAAW,CAAC,UAAU,CAAC;SACvB,iBAAiB,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;SAClD,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;AAC1C,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type BoundedBodyResult = {
|
|
2
|
+
ok: true;
|
|
3
|
+
bytes: Uint8Array;
|
|
4
|
+
text: string;
|
|
5
|
+
} | {
|
|
6
|
+
ok: false;
|
|
7
|
+
reason: 'payload-too-large' | 'invalid-utf8';
|
|
8
|
+
bytesRead: number;
|
|
9
|
+
};
|
|
10
|
+
export type BoundedBytesResult = {
|
|
11
|
+
ok: true;
|
|
12
|
+
bytes: Uint8Array;
|
|
13
|
+
} | {
|
|
14
|
+
ok: false;
|
|
15
|
+
reason: 'payload-too-large';
|
|
16
|
+
bytesRead: number;
|
|
17
|
+
};
|
|
18
|
+
export declare function readBoundedBytes(request: Request, maxBytes: number, cancelReason?: string): Promise<BoundedBytesResult>;
|
|
19
|
+
export declare function readBoundedBody(request: Request, maxBytes: number, cancelReason?: string): Promise<BoundedBodyResult>;
|
|
20
|
+
//# sourceMappingURL=http-body.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-body.d.ts","sourceRoot":"","sources":["../src/http-body.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,iBAAiB,GACzB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,UAAU,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC7C;IACE,EAAE,EAAE,KAAK,CAAC;IACV,MAAM,EAAE,mBAAmB,GAAG,cAAc,CAAC;IAC7C,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEN,MAAM,MAAM,kBAAkB,GAC1B;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,UAAU,CAAA;CAAE,GAC/B;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,mBAAmB,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC;AAElE,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,MAAM,EAChB,YAAY,SAA+B,GAC1C,OAAO,CAAC,kBAAkB,CAAC,CA4C7B;AAED,wBAAsB,eAAe,CACnC,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,MAAM,EAChB,YAAY,SAA+B,GAC1C,OAAO,CAAC,iBAAiB,CAAC,CAmB5B"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
export async function readBoundedBytes(request, maxBytes, cancelReason = 'request body exceeds limit') {
|
|
3
|
+
if (!Number.isSafeInteger(maxBytes) || maxBytes < 0) {
|
|
4
|
+
throw new RangeError('maxBytes must be a nonnegative safe integer');
|
|
5
|
+
}
|
|
6
|
+
const contentLength = request.headers.get('content-length');
|
|
7
|
+
if (contentLength !== null &&
|
|
8
|
+
/^\d+$/.test(contentLength) &&
|
|
9
|
+
Number(contentLength) > maxBytes) {
|
|
10
|
+
return {
|
|
11
|
+
ok: false,
|
|
12
|
+
reason: 'payload-too-large',
|
|
13
|
+
bytesRead: maxBytes + 1,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
const reader = request.body?.getReader();
|
|
17
|
+
const chunks = [];
|
|
18
|
+
let length = 0;
|
|
19
|
+
if (reader) {
|
|
20
|
+
for (;;) {
|
|
21
|
+
const next = await reader.read();
|
|
22
|
+
if (next.done)
|
|
23
|
+
break;
|
|
24
|
+
length += next.value.byteLength;
|
|
25
|
+
if (length > maxBytes) {
|
|
26
|
+
try {
|
|
27
|
+
await reader.cancel(cancelReason);
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
// Cancellation is cleanup; the size verdict is already authoritative.
|
|
31
|
+
}
|
|
32
|
+
return { ok: false, reason: 'payload-too-large', bytesRead: length };
|
|
33
|
+
}
|
|
34
|
+
chunks.push(next.value);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
const bytes = new Uint8Array(length);
|
|
38
|
+
let offset = 0;
|
|
39
|
+
for (const chunk of chunks) {
|
|
40
|
+
bytes.set(chunk, offset);
|
|
41
|
+
offset += chunk.byteLength;
|
|
42
|
+
}
|
|
43
|
+
return { ok: true, bytes };
|
|
44
|
+
}
|
|
45
|
+
export async function readBoundedBody(request, maxBytes, cancelReason = 'request body exceeds limit') {
|
|
46
|
+
const raw = await readBoundedBytes(request, maxBytes, cancelReason);
|
|
47
|
+
if (!raw.ok)
|
|
48
|
+
return raw;
|
|
49
|
+
try {
|
|
50
|
+
return {
|
|
51
|
+
ok: true,
|
|
52
|
+
bytes: raw.bytes,
|
|
53
|
+
text: new TextDecoder('utf-8', {
|
|
54
|
+
fatal: true,
|
|
55
|
+
ignoreBOM: false,
|
|
56
|
+
}).decode(raw.bytes),
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
return {
|
|
61
|
+
ok: false,
|
|
62
|
+
reason: 'invalid-utf8',
|
|
63
|
+
bytesRead: raw.bytes.byteLength,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=http-body.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-body.js","sourceRoot":"","sources":["../src/http-body.ts"],"names":[],"mappings":"AAAA,sCAAsC;AActC,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,OAAgB,EAChB,QAAgB,EAChB,YAAY,GAAG,4BAA4B;IAE3C,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,QAAQ,CAAC,IAAI,QAAQ,GAAG,CAAC,EAAE,CAAC;QACpD,MAAM,IAAI,UAAU,CAAC,6CAA6C,CAAC,CAAC;IACtE,CAAC;IACD,MAAM,aAAa,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;IAC5D,IACE,aAAa,KAAK,IAAI;QACtB,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC;QAC3B,MAAM,CAAC,aAAa,CAAC,GAAG,QAAQ,EAChC,CAAC;QACD,OAAO;YACL,EAAE,EAAE,KAAK;YACT,MAAM,EAAE,mBAAmB;YAC3B,SAAS,EAAE,QAAQ,GAAG,CAAC;SACxB,CAAC;IACJ,CAAC;IAED,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,EAAE,SAAS,EAAE,CAAC;IACzC,MAAM,MAAM,GAAiB,EAAE,CAAC;IAChC,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,IAAI,MAAM,EAAE,CAAC;QACX,SAAS,CAAC;YACR,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,IAAI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K;aACjB,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC;SACrB,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO;YACL,EAAE,EAAE,KAAK;YACT,MAAM,EAAE,cAAc;YACtB,SAAS,EAAE,GAAG,CAAC,KAAK,CAAC,UAAU;SAChC,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { createScheduleRouter, type ScheduleFacadeStore, type ScheduleOperation, type ScheduleRouteAuditEvent, type ScheduleRouteAuditSink, type ScheduleRouter, type ScheduleRouterOptions, } from './router.js';
|
|
2
|
-
export { D1SchedulesStorage, type Schedule, type ScheduleDatabase, type ScheduleStatement, type ScheduleTrigger, } from './schedules-d1.js';
|
|
2
|
+
export { D1SchedulesStorage, parseScheduleAgentDispatchReceipt, type Schedule, type ScheduleAgentDispatchAction, type ScheduleAgentDispatchReceipt, type ScheduleAgentDispatchState, type ScheduleDatabase, type ScheduleFireClaim, type ScheduleStatement, type ScheduleTrigger, } from './schedules-d1.js';
|
|
3
3
|
export { createScheduleStorageDomains } from './storage.js';
|
|
4
|
-
export { type
|
|
4
|
+
export { type AuthorizedSchedule, createScheduleTargetPolicy, type ScheduleTargetCatalogEntry, type ScheduleTargetDecision, type ScheduleTargetPolicy, type ScheduleTargetPolicyOptions, scheduleCreatorRole, scheduleWithCreatorRole, } from './target-policy.js';
|
|
5
|
+
export { type AgentScheduleTarget, buildScheduledLegContext, canPersistScheduledAgentSignal, createScheduleStartSource, createScheduleTick, isReservedScheduleContextKey, RESERVED_SCHEDULE_CONTEXT_KEYS, type ScheduleFireOutcome, type ScheduleStartSource, type ScheduleStartSourceStore, type ScheduleStartSourceTarget, type ScheduleTickAuditEvent, type ScheduleTickAuditSink, type ScheduleTickDispatchRef, type ScheduleTickOptions, type ScheduleTickResult, type ScheduleTickRunCap, type ScheduleTickSignalAgent, type ScheduleTickSignalAgentInput, type ScheduleTickStart, type ScheduleTickStartAgent, type ScheduleTickStartAgentInput, type ScheduleTickStartInput, type ScheduleTickStatus, type ScheduleTickStatusResult, type ScheduleTickStore, stripReservedScheduleContext, type WorkflowScheduleTarget, } from './tick.js';
|
|
5
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schedules/index.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,oBAAoB,EACpB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAC3B,KAAK,cAAc,EACnB,KAAK,qBAAqB,GAC3B,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,kBAAkB,EAClB,KAAK,QAAQ,EACb,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,eAAe,GACrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,4BAA4B,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schedules/index.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,oBAAoB,EACpB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAC3B,KAAK,cAAc,EACnB,KAAK,qBAAqB,GAC3B,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,kBAAkB,EAClB,iCAAiC,EACjC,KAAK,QAAQ,EACb,KAAK,2BAA2B,EAChC,KAAK,4BAA4B,EACjC,KAAK,0BAA0B,EAC/B,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,eAAe,GACrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,4BAA4B,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EACL,KAAK,kBAAkB,EACvB,0BAA0B,EAC1B,KAAK,0BAA0B,EAC/B,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EACzB,KAAK,2BAA2B,EAChC,mBAAmB,EACnB,uBAAuB,GACxB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,KAAK,mBAAmB,EACxB,wBAAwB,EACxB,8BAA8B,EAC9B,yBAAyB,EACzB,kBAAkB,EAClB,4BAA4B,EAC5B,8BAA8B,EAC9B,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAC9B,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC5B,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,uBAAuB,EAC5B,KAAK,4BAA4B,EACjC,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,2BAA2B,EAChC,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,EACvB,KAAK,wBAAwB,EAC7B,KAAK,iBAAiB,EACtB,4BAA4B,EAC5B,KAAK,sBAAsB,GAC5B,MAAM,WAAW,CAAC"}
|
package/dist/schedules/index.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
-
// Track D (M-006) — schedules: the D1 domain, the CAS tick, and the
|
|
2
|
+
// Track D (M-006) — schedules: the D1 domain, the CAS tick, and the authenticated
|
|
3
3
|
// facade. Subpath-only (`@proofoftech/flowsafe/schedules`), like agent-runner /
|
|
4
4
|
// background-tasks / signals / goals: host-side wiring a consumer opts into, not
|
|
5
5
|
// in the root barrel.
|
|
6
|
-
// The
|
|
6
|
+
// The facade router (CI-M-006-003).
|
|
7
7
|
export { createScheduleRouter, } from './router.js';
|
|
8
8
|
// The D1 schedules storage domain (CI-M-006-001).
|
|
9
|
-
export { D1SchedulesStorage, } from './schedules-d1.js';
|
|
9
|
+
export { D1SchedulesStorage, parseScheduleAgentDispatchReceipt, } from './schedules-d1.js';
|
|
10
10
|
export { createScheduleStorageDomains } from './storage.js';
|
|
11
|
+
export { createScheduleTargetPolicy, scheduleCreatorRole, scheduleWithCreatorRole, } from './target-policy.js';
|
|
11
12
|
// The CAS tick (CI-M-006-002).
|
|
12
|
-
export { buildScheduledLegContext, createScheduleTick, isReservedScheduleContextKey, RESERVED_SCHEDULE_CONTEXT_KEYS, stripReservedScheduleContext, } from './tick.js';
|
|
13
|
+
export { buildScheduledLegContext, canPersistScheduledAgentSignal, createScheduleStartSource, createScheduleTick, isReservedScheduleContextKey, RESERVED_SCHEDULE_CONTEXT_KEYS, stripReservedScheduleContext, } from './tick.js';
|
|
13
14
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/schedules/index.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/schedules/index.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,kFAAkF;AAClF,gFAAgF;AAChF,iFAAiF;AACjF,sBAAsB;AAEtB,oCAAoC;AACpC,OAAO,EACL,oBAAoB,GAOrB,MAAM,aAAa,CAAC;AACrB,kDAAkD;AAClD,OAAO,EACL,kBAAkB,EAClB,iCAAiC,GASlC,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,4BAA4B,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EAEL,0BAA0B,EAK1B,mBAAmB,EACnB,uBAAuB,GACxB,MAAM,oBAAoB,CAAC;AAC5B,+BAA+B;AAC/B,OAAO,EAEL,wBAAwB,EACxB,8BAA8B,EAC9B,yBAAyB,EACzB,kBAAkB,EAClB,4BAA4B,EAC5B,8BAA8B,EAoB9B,4BAA4B,GAE7B,MAAM,WAAW,CAAC"}
|