@adcp/sdk 15.9.0 → 16.0.0-beta.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/bin/adcp-identity.js +74 -0
- package/bin/adcp.js +2 -0
- package/dist/lib/adapters/keyed-account-backend.d.mts +37 -0
- package/dist/lib/adapters/keyed-account-backend.d.ts +37 -0
- package/dist/lib/adapters/keyed-account-backend.js +121 -0
- package/dist/lib/adapters/keyed-account-backend.mjs +94 -0
- package/dist/lib/adapters/keyed-account-store.d.mts +28 -0
- package/dist/lib/adapters/keyed-account-store.d.ts +28 -0
- package/dist/lib/adapters/keyed-account-store.js +227 -0
- package/dist/lib/adapters/keyed-account-store.mjs +203 -0
- package/dist/lib/core/SingleAgentClient.d.mts +16 -2
- package/dist/lib/core/SingleAgentClient.d.ts +16 -2
- package/dist/lib/core/SingleAgentClient.js +259 -62
- package/dist/lib/core/SingleAgentClient.mjs +261 -57
- package/dist/lib/core/TaskExecutor.d.mts +6 -0
- package/dist/lib/core/TaskExecutor.d.ts +6 -0
- package/dist/lib/core/TaskExecutor.js +66 -5
- package/dist/lib/core/TaskExecutor.mjs +71 -5
- package/dist/lib/core/postgres-webhook-registration-store.js +32 -5
- package/dist/lib/core/postgres-webhook-registration-store.mjs +32 -5
- package/dist/lib/core/redis-webhook-registration-store.js +23 -1
- package/dist/lib/core/redis-webhook-registration-store.mjs +23 -1
- package/dist/lib/core/webhook-registration.d.mts +7 -1
- package/dist/lib/core/webhook-registration.d.ts +7 -1
- package/dist/lib/core/webhook-registration.js +24 -2
- package/dist/lib/core/webhook-registration.mjs +23 -2
- package/dist/lib/identity-3.3/index.d.mts +10 -0
- package/dist/lib/identity-3.3/index.d.ts +10 -0
- package/dist/lib/identity-3.3/index.js +75 -0
- package/dist/lib/identity-3.3/index.mjs +46 -0
- package/dist/lib/identity-3.3/lifecycle.d.mts +113 -0
- package/dist/lib/identity-3.3/lifecycle.d.ts +113 -0
- package/dist/lib/identity-3.3/lifecycle.js +267 -0
- package/dist/lib/identity-3.3/lifecycle.mjs +240 -0
- package/dist/lib/identity-3.3/revocation.d.mts +50 -0
- package/dist/lib/identity-3.3/revocation.d.ts +50 -0
- package/dist/lib/identity-3.3/revocation.js +238 -0
- package/dist/lib/identity-3.3/revocation.mjs +216 -0
- package/dist/lib/identity-3.3/schemas.draft.d.mts +2472 -0
- package/dist/lib/identity-3.3/schemas.draft.d.ts +2472 -0
- package/dist/lib/identity-3.3/schemas.draft.js +1448 -0
- package/dist/lib/identity-3.3/schemas.draft.mjs +1428 -0
- package/dist/lib/identity-3.3/server.d.mts +34 -0
- package/dist/lib/identity-3.3/server.d.ts +34 -0
- package/dist/lib/identity-3.3/server.js +219 -0
- package/dist/lib/identity-3.3/server.mjs +194 -0
- package/dist/lib/identity-3.3/store.d.mts +24 -0
- package/dist/lib/identity-3.3/store.d.ts +24 -0
- package/dist/lib/identity-3.3/store.js +191 -0
- package/dist/lib/identity-3.3/store.mjs +169 -0
- package/dist/lib/identity-3.3/trust.d.mts +94 -0
- package/dist/lib/identity-3.3/trust.d.ts +94 -0
- package/dist/lib/identity-3.3/trust.js +278 -0
- package/dist/lib/identity-3.3/trust.mjs +239 -0
- package/dist/lib/identity-3.3/types.d.mts +127 -0
- package/dist/lib/identity-3.3/types.d.ts +127 -0
- package/dist/lib/identity-3.3/types.js +16 -0
- package/dist/lib/identity-3.3/types.mjs +0 -0
- package/dist/lib/identity-3.3/validation.d.mts +2 -0
- package/dist/lib/identity-3.3/validation.d.ts +2 -0
- package/dist/lib/identity-3.3/validation.js +125 -0
- package/dist/lib/identity-3.3/validation.mjs +91 -0
- package/dist/lib/index.d.mts +1 -1
- package/dist/lib/index.d.ts +1 -1
- package/dist/lib/reporting/azure/index.d.mts +5 -0
- package/dist/lib/reporting/azure/index.d.ts +5 -0
- package/dist/lib/reporting/azure/index.js +26 -7
- package/dist/lib/reporting/azure/index.mjs +26 -7
- package/dist/lib/reporting/bigquery/index.d.mts +80 -25
- package/dist/lib/reporting/bigquery/index.d.ts +80 -25
- package/dist/lib/reporting/bigquery/index.js +184 -81
- package/dist/lib/reporting/bigquery/index.mjs +182 -80
- package/dist/lib/reporting/gcs/adapter.d.mts +8 -1
- package/dist/lib/reporting/gcs/adapter.d.ts +8 -1
- package/dist/lib/reporting/gcs/errors.d.mts +6 -0
- package/dist/lib/reporting/gcs/errors.d.ts +6 -0
- package/dist/lib/reporting/gcs/fence.d.mts +5 -0
- package/dist/lib/reporting/gcs/fence.d.ts +5 -0
- package/dist/lib/reporting/gcs/index.d.mts +9 -0
- package/dist/lib/reporting/gcs/index.d.ts +9 -0
- package/dist/lib/reporting/gcs/reader.d.mts +27 -3
- package/dist/lib/reporting/gcs/reader.d.ts +27 -3
- package/dist/lib/reporting/gcs/row-provider.d.mts +7 -0
- package/dist/lib/reporting/gcs/row-provider.d.ts +7 -0
- package/dist/lib/reporting/gcs/row-provider.js +34 -14
- package/dist/lib/reporting/gcs/row-provider.mjs +34 -14
- package/dist/lib/reporting/ledger/change-feed.d.mts +22 -1
- package/dist/lib/reporting/ledger/change-feed.d.ts +22 -1
- package/dist/lib/reporting/ledger/index.d.mts +11 -0
- package/dist/lib/reporting/ledger/index.d.ts +11 -0
- package/dist/lib/reporting/ledger/managed-postgres.d.mts +8 -0
- package/dist/lib/reporting/ledger/managed-postgres.d.ts +8 -0
- package/dist/lib/reporting/ledger/managed-router.d.mts +27 -2
- package/dist/lib/reporting/ledger/managed-router.d.ts +27 -2
- package/dist/lib/reporting/ledger/managed.d.mts +86 -6
- package/dist/lib/reporting/ledger/managed.d.ts +86 -6
- package/dist/lib/reporting/ledger/notification-activity.d.mts +65 -3
- package/dist/lib/reporting/ledger/notification-activity.d.ts +65 -3
- package/dist/lib/reporting/ledger/object-writes.d.mts +64 -5
- package/dist/lib/reporting/ledger/object-writes.d.ts +64 -5
- package/dist/lib/reporting/ledger/postgres.d.mts +43 -9
- package/dist/lib/reporting/ledger/postgres.d.ts +43 -9
- package/dist/lib/reporting/ledger/postgres.js +43 -27
- package/dist/lib/reporting/ledger/postgres.mjs +43 -27
- package/dist/lib/reporting/ledger/row-encoding.d.mts +92 -6
- package/dist/lib/reporting/ledger/row-encoding.d.ts +92 -6
- package/dist/lib/reporting/ledger/row-encoding.js +8 -4
- package/dist/lib/reporting/ledger/row-encoding.mjs +6 -3
- package/dist/lib/reporting/ledger/row-storage-errors.d.mts +11 -1
- package/dist/lib/reporting/ledger/row-storage-errors.d.ts +11 -1
- package/dist/lib/reporting/ledger/row-storage-migration.d.mts +19 -1
- package/dist/lib/reporting/ledger/row-storage-migration.d.ts +19 -1
- package/dist/lib/reporting/ledger/row-storage-migration.js +133 -18
- package/dist/lib/reporting/ledger/row-storage-migration.mjs +133 -18
- package/dist/lib/reporting/ledger/row-storage-object.d.mts +103 -12
- package/dist/lib/reporting/ledger/row-storage-object.d.ts +103 -12
- package/dist/lib/reporting/ledger/row-storage-object.js +106 -31
- package/dist/lib/reporting/ledger/row-storage-object.mjs +104 -31
- package/dist/lib/reporting/ledger/row-storage.d.mts +87 -20
- package/dist/lib/reporting/ledger/row-storage.d.ts +87 -20
- package/dist/lib/reporting/ledger/row-storage.js +126 -66
- package/dist/lib/reporting/ledger/row-storage.mjs +129 -67
- package/dist/lib/reporting/ledger/schedule.d.mts +13 -0
- package/dist/lib/reporting/ledger/schedule.d.ts +13 -0
- package/dist/lib/reporting/ledger/schedule.js +24 -0
- package/dist/lib/reporting/ledger/schedule.mjs +23 -0
- package/dist/lib/reporting/ledger/types.d.mts +23 -1
- package/dist/lib/reporting/ledger/types.d.ts +23 -1
- package/dist/lib/reporting/s3/index.d.mts +5 -0
- package/dist/lib/reporting/s3/index.d.ts +5 -0
- package/dist/lib/reporting/s3/index.js +37 -14
- package/dist/lib/reporting/s3/index.mjs +37 -14
- package/dist/lib/reporting/service/index.d.mts +10 -0
- package/dist/lib/reporting/service/index.d.ts +10 -0
- package/dist/lib/reporting/service/maintenance.d.mts +28 -2
- package/dist/lib/reporting/service/maintenance.d.ts +28 -2
- package/dist/lib/schemas-data/v2.5/_provenance.json +1 -1
- package/dist/lib/server/account-sync-contract.d.mts +14 -0
- package/dist/lib/server/account-sync-contract.d.ts +14 -0
- package/dist/lib/server/account-sync-contract.js +225 -0
- package/dist/lib/server/account-sync-contract.mjs +197 -0
- package/dist/lib/server/adcp-server.js +5 -0
- package/dist/lib/server/adcp-server.mjs +10 -0
- package/dist/lib/server/auth-signature.d.mts +10 -0
- package/dist/lib/server/auth-signature.d.ts +10 -0
- package/dist/lib/server/auth-signature.js +61 -2
- package/dist/lib/server/auth-signature.mjs +65 -2
- package/dist/lib/server/auth.d.mts +6 -0
- package/dist/lib/server/auth.d.ts +6 -0
- package/dist/lib/server/auth.js +6 -0
- package/dist/lib/server/auth.mjs +6 -0
- package/dist/lib/server/create-adcp-server.d.mts +19 -5
- package/dist/lib/server/create-adcp-server.d.ts +19 -5
- package/dist/lib/server/create-adcp-server.js +238 -19
- package/dist/lib/server/create-adcp-server.mjs +240 -10
- package/dist/lib/server/decisioning/account.d.mts +24 -1
- package/dist/lib/server/decisioning/account.d.ts +24 -1
- package/dist/lib/server/decisioning/index.d.mts +1 -1
- package/dist/lib/server/decisioning/index.d.ts +1 -1
- package/dist/lib/server/decisioning/runtime/from-platform.d.mts +0 -50
- package/dist/lib/server/decisioning/runtime/from-platform.d.ts +0 -50
- package/dist/lib/server/decisioning/runtime/from-platform.js +61 -11
- package/dist/lib/server/decisioning/runtime/from-platform.mjs +65 -12
- package/dist/lib/server/index.d.mts +2 -0
- package/dist/lib/server/index.d.ts +2 -0
- package/dist/lib/server/index.js +12 -0
- package/dist/lib/server/index.mjs +12 -0
- package/dist/lib/server/notification-subscriptions/runtime.js +9 -1
- package/dist/lib/server/notification-subscriptions/runtime.mjs +9 -1
- package/dist/lib/server/notification-subscriptions/types.d.mts +5 -0
- package/dist/lib/server/notification-subscriptions/types.d.ts +5 -0
- package/dist/lib/server/principal/types.d.mts +1 -1
- package/dist/lib/server/principal/types.d.ts +1 -1
- package/dist/lib/server/serve.js +5 -0
- package/dist/lib/server/serve.mjs +5 -0
- package/dist/lib/server/webhook-delivery/recovery.d.mts +1 -0
- package/dist/lib/server/webhook-delivery/recovery.d.ts +1 -0
- package/dist/lib/server/webhook-delivery/recovery.js +4 -0
- package/dist/lib/server/webhook-delivery/recovery.mjs +4 -0
- package/dist/lib/server/webhook-emitter.d.mts +10 -0
- package/dist/lib/server/webhook-emitter.d.ts +10 -0
- package/dist/lib/server/webhook-emitter.js +22 -0
- package/dist/lib/server/webhook-emitter.mjs +22 -0
- package/dist/lib/signing/agent-context.d.mts +0 -5
- package/dist/lib/signing/agent-context.d.ts +0 -5
- package/dist/lib/signing/agent-context.js +9 -1
- package/dist/lib/signing/agent-context.mjs +9 -1
- package/dist/lib/signing/agent-fetch.js +27 -2
- package/dist/lib/signing/agent-fetch.mjs +32 -2
- package/dist/lib/signing/agent-resolver/canonicalize.d.mts +10 -15
- package/dist/lib/signing/agent-resolver/canonicalize.d.ts +10 -15
- package/dist/lib/signing/agent-resolver/canonicalize.js +17 -5
- package/dist/lib/signing/agent-resolver/canonicalize.mjs +16 -5
- package/dist/lib/signing/agent-resolver/index.d.mts +1 -0
- package/dist/lib/signing/agent-resolver/index.d.ts +1 -0
- package/dist/lib/signing/agent-resolver/index.js +5 -0
- package/dist/lib/signing/agent-resolver/index.mjs +3 -0
- package/dist/lib/signing/agent-resolver/resolved-agent-jwks.d.mts +3 -2
- package/dist/lib/signing/agent-resolver/resolved-agent-jwks.d.ts +3 -2
- package/dist/lib/signing/agent-resolver/resolved-agent-jwks.js +30 -3
- package/dist/lib/signing/agent-resolver/resolved-agent-jwks.mjs +30 -3
- package/dist/lib/signing/agent-resolver/strict-json.d.mts +2 -2
- package/dist/lib/signing/agent-resolver/strict-json.d.ts +2 -2
- package/dist/lib/signing/agent-resolver/strict-json.js +5 -3
- package/dist/lib/signing/agent-resolver/strict-json.mjs +5 -3
- package/dist/lib/signing/brand-jwks.d.mts +2 -2
- package/dist/lib/signing/brand-jwks.d.ts +2 -2
- package/dist/lib/signing/brand-jwks.js +4 -4
- package/dist/lib/signing/brand-jwks.mjs +4 -4
- package/dist/lib/signing/client.d.mts +1 -0
- package/dist/lib/signing/client.d.ts +1 -0
- package/dist/lib/signing/client.js +5 -0
- package/dist/lib/signing/client.mjs +3 -0
- package/dist/lib/signing/jwks-https.d.mts +1 -1
- package/dist/lib/signing/jwks-https.d.ts +1 -1
- package/dist/lib/signing/jwks-https.js +1 -1
- package/dist/lib/signing/jwks-https.mjs +1 -1
- package/dist/lib/signing/jwks.d.mts +11 -3
- package/dist/lib/signing/jwks.d.ts +11 -3
- package/dist/lib/signing/jwks.js +1 -1
- package/dist/lib/signing/jwks.mjs +1 -1
- package/dist/lib/signing/parser.d.mts +1 -1
- package/dist/lib/signing/parser.d.ts +1 -1
- package/dist/lib/signing/parser.js +5 -3
- package/dist/lib/signing/parser.mjs +6 -4
- package/dist/lib/signing/revocation.d.mts +4 -1
- package/dist/lib/signing/revocation.d.ts +4 -1
- package/dist/lib/signing/revocation.js +33 -3
- package/dist/lib/signing/revocation.mjs +31 -2
- package/dist/lib/signing/server.d.mts +1 -1
- package/dist/lib/signing/server.d.ts +1 -1
- package/dist/lib/signing/server.js +4 -0
- package/dist/lib/signing/server.mjs +4 -0
- package/dist/lib/signing/types.d.mts +3 -0
- package/dist/lib/signing/types.d.ts +3 -0
- package/dist/lib/signing/web-bot-auth.d.mts +117 -0
- package/dist/lib/signing/web-bot-auth.d.ts +117 -0
- package/dist/lib/signing/web-bot-auth.js +660 -0
- package/dist/lib/signing/web-bot-auth.mjs +624 -0
- package/dist/lib/testing/client.d.mts +1 -4
- package/dist/lib/testing/client.d.ts +1 -4
- package/dist/lib/testing/client.js +141 -20
- package/dist/lib/testing/client.mjs +137 -19
- package/dist/lib/testing/compliance/comply.js +29 -10
- package/dist/lib/testing/compliance/comply.mjs +37 -11
- package/dist/lib/testing/storyboard/account-sync-contract.d.mts +3 -0
- package/dist/lib/testing/storyboard/account-sync-contract.d.ts +3 -0
- package/dist/lib/testing/storyboard/account-sync-contract.js +79 -0
- package/dist/lib/testing/storyboard/account-sync-contract.mjs +55 -0
- package/dist/lib/testing/storyboard/default-invariants.js +2 -0
- package/dist/lib/testing/storyboard/default-invariants.mjs +2 -0
- package/dist/lib/testing/storyboard/runner.js +23 -8
- package/dist/lib/testing/storyboard/runner.mjs +24 -8
- package/dist/lib/testing/storyboard/validations.d.mts +1 -1
- package/dist/lib/testing/storyboard/validations.d.ts +1 -1
- package/dist/lib/types/adcp.d.mts +4 -0
- package/dist/lib/types/adcp.d.ts +4 -0
- package/dist/lib/types/schemas.generated.d.ts +6 -6
- package/dist/lib/utils/capabilities.d.mts +1 -0
- package/dist/lib/utils/capabilities.d.ts +1 -0
- package/dist/lib/utils/capabilities.js +5 -0
- package/dist/lib/utils/capabilities.mjs +5 -0
- package/dist/lib/v2/projection/creative-delivery.d.mts +3 -1
- package/dist/lib/v2/projection/creative-delivery.d.ts +3 -1
- package/dist/lib/v2/projection/creative-delivery.js +26 -10
- package/dist/lib/v2/projection/creative-delivery.mjs +26 -10
- package/dist/lib/v2/projection/index.d.mts +1 -1
- package/dist/lib/v2/projection/index.d.ts +1 -1
- package/dist/lib/v2/projection/legacy-routes.d.mts +24 -2
- package/dist/lib/v2/projection/legacy-routes.d.ts +24 -2
- package/dist/lib/v2/projection/legacy-routes.js +28 -2
- package/dist/lib/v2/projection/legacy-routes.mjs +26 -2
- package/dist/lib/validation/schema-loader.d.mts +2 -0
- package/dist/lib/validation/schema-loader.d.ts +2 -0
- package/dist/lib/validation/schema-loader.js +43 -4
- package/dist/lib/validation/schema-loader.mjs +39 -3
- package/dist/lib/version.d.mts +3 -3
- package/dist/lib/version.d.ts +3 -3
- package/dist/lib/version.js +3 -3
- package/dist/lib/version.mjs +3 -3
- package/docs/TYPE-SUMMARY.md +2 -2
- package/docs/guides/DISCOVERY-CACHE-AND-SESSION-REUSE.md +4 -0
- package/docs/guides/REPORTING-LEDGER-CUTOVER.md +1 -1
- package/docs/guides/REPORTING-LEDGER.md +132 -46
- package/docs/guides/REPORTING-OPERATIONS.md +25 -4
- package/docs/guides/REPORTING-STABILITY.md +76 -0
- package/docs/guides/account-resolution.md +101 -0
- package/docs/llms.txt +3 -2
- package/docs/migration-12-to-13.md +7 -0
- package/docs/migration-14.x-rc-worksheet.md +4 -4
- package/docs/migration-agent-identity-3.3.md +355 -0
- package/docs/migration-agent-resolution-3.3.md +5 -0
- package/docs/migration-reporting-row-storage-alignment.md +137 -0
- package/examples/storyboards/account-sync-contract.yaml +57 -0
- package/package.json +15 -1
|
@@ -21,6 +21,7 @@ __export(webhook_registration_exports, {
|
|
|
21
21
|
InMemoryWebhookRegistrationStore: () => InMemoryWebhookRegistrationStore,
|
|
22
22
|
WebhookRegistrationIntegrityError: () => WebhookRegistrationIntegrityError,
|
|
23
23
|
canonicalDelegatedOperatorAuthorization: () => canonicalDelegatedOperatorAuthorization,
|
|
24
|
+
deliveryWebhookRegistrationId: () => deliveryWebhookRegistrationId,
|
|
24
25
|
freezeWebhookRegistration: () => freezeWebhookRegistration,
|
|
25
26
|
parseWebhookRegistration: () => parseWebhookRegistration,
|
|
26
27
|
sameWebhookRegistration: () => sameWebhookRegistration,
|
|
@@ -31,6 +32,7 @@ __export(webhook_registration_exports, {
|
|
|
31
32
|
webhookRegistrationStorageDigest: () => webhookRegistrationStorageDigest
|
|
32
33
|
});
|
|
33
34
|
module.exports = __toCommonJS(webhook_registration_exports);
|
|
35
|
+
var import_canonicalize = require('../signing/canonicalize.js');
|
|
34
36
|
var import_node_crypto = require("node:crypto");
|
|
35
37
|
var import_errors = require('../errors/index.js');
|
|
36
38
|
var import_webhook_verifier = require('../signing/webhook-verifier.js');
|
|
@@ -68,7 +70,11 @@ class InMemoryWebhookRegistrationStore {
|
|
|
68
70
|
const key = registrationKey(parsed.agentId, parsed.operationId);
|
|
69
71
|
const existing = this.entries.get(key);
|
|
70
72
|
if (existing) {
|
|
71
|
-
if (sameWebhookRegistration(existing, parsed))
|
|
73
|
+
if (sameWebhookRegistration(existing, parsed)) {
|
|
74
|
+
if (parsed.deliveryKind && parsed.expiresAt > existing.expiresAt)
|
|
75
|
+
this.entries.set(key, freezeWebhookRegistration({ ...existing, expiresAt: parsed.expiresAt }));
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
72
78
|
throw new import_errors.ConfigurationError(
|
|
73
79
|
"Webhook operation id is already registered with different trusted provenance.",
|
|
74
80
|
"operationId"
|
|
@@ -170,6 +176,8 @@ function parseWebhookRegistration(value, expectedKey) {
|
|
|
170
176
|
if (input.requiresDurableSettlement !== void 0 && typeof input.requiresDurableSettlement !== "boolean") {
|
|
171
177
|
throw new TypeError("Webhook registration requiresDurableSettlement must be boolean.");
|
|
172
178
|
}
|
|
179
|
+
if (input.signingProfile !== void 0 && (input.mode !== "rfc9421" || !["adcp/webhook-signing/v1", "web-bot-auth"].includes(input.signingProfile)))
|
|
180
|
+
throw new TypeError("Invalid registered webhook signing profile");
|
|
173
181
|
const createdAt = requireEpochMs("createdAt", input.createdAt);
|
|
174
182
|
const expiresAt = requireEpochMs("expiresAt", input.expiresAt);
|
|
175
183
|
if (expiresAt <= createdAt) {
|
|
@@ -198,6 +206,8 @@ function parseWebhookRegistration(value, expectedKey) {
|
|
|
198
206
|
if (agent.username || agent.password || agent.hash) {
|
|
199
207
|
throw new TypeError("Webhook agentUrl cannot contain userinfo credentials or a fragment.");
|
|
200
208
|
}
|
|
209
|
+
if (input.deliveryKind !== void 0 && (!["reporting", "artifact"].includes(input.deliveryKind) || input.mode !== "rfc9421"))
|
|
210
|
+
throw new TypeError("Invalid delivery registration kind");
|
|
201
211
|
const parsed = {
|
|
202
212
|
agentId,
|
|
203
213
|
agentUrl,
|
|
@@ -207,6 +217,12 @@ function parseWebhookRegistration(value, expectedKey) {
|
|
|
207
217
|
callbackUrl,
|
|
208
218
|
method: "POST",
|
|
209
219
|
mode: input.mode,
|
|
220
|
+
...input.signingProfile !== void 0 && {
|
|
221
|
+
signingProfile: input.signingProfile
|
|
222
|
+
},
|
|
223
|
+
...input.deliveryKind !== void 0 && {
|
|
224
|
+
deliveryKind: input.deliveryKind
|
|
225
|
+
},
|
|
210
226
|
...input.authorizationContextVersion === 1 && { authorizationContextVersion: 1 },
|
|
211
227
|
...delegatedOperatorAuthorization !== void 0 && {
|
|
212
228
|
delegatedOperatorAuthorization: { ...delegatedOperatorAuthorization }
|
|
@@ -289,7 +305,9 @@ function webhookRegistrationFingerprint(registration) {
|
|
|
289
305
|
parsed.mode,
|
|
290
306
|
parsed.previewMode ?? null,
|
|
291
307
|
parsed.authorizationContextVersion ?? null,
|
|
292
|
-
canonicalDelegatedOperatorAuthorization(parsed.delegatedOperatorAuthorization)
|
|
308
|
+
canonicalDelegatedOperatorAuthorization(parsed.delegatedOperatorAuthorization),
|
|
309
|
+
...parsed.signingProfile === "web-bot-auth" ? [parsed.signingProfile] : [],
|
|
310
|
+
...parsed.deliveryKind !== void 0 ? ["delivery", parsed.deliveryKind] : []
|
|
293
311
|
]);
|
|
294
312
|
}
|
|
295
313
|
function sameWebhookRegistration(a, b) {
|
|
@@ -299,11 +317,15 @@ function webhookRegistrationStorageDigest(agentId, operationId) {
|
|
|
299
317
|
validateWebhookRegistrationKey(agentId, operationId);
|
|
300
318
|
return (0, import_node_crypto.createHash)("sha256").update(JSON.stringify([agentId, operationId])).digest("hex");
|
|
301
319
|
}
|
|
320
|
+
function deliveryWebhookRegistrationId(kind, url) {
|
|
321
|
+
return `delivery_route:${kind}:` + (0, import_node_crypto.createHash)("sha256").update((0, import_canonicalize.canonicalTargetUri)(url, "3.2")).digest("hex");
|
|
322
|
+
}
|
|
302
323
|
// Annotate the CommonJS export names for ESM import in node:
|
|
303
324
|
0 && (module.exports = {
|
|
304
325
|
InMemoryWebhookRegistrationStore,
|
|
305
326
|
WebhookRegistrationIntegrityError,
|
|
306
327
|
canonicalDelegatedOperatorAuthorization,
|
|
328
|
+
deliveryWebhookRegistrationId,
|
|
307
329
|
freezeWebhookRegistration,
|
|
308
330
|
parseWebhookRegistration,
|
|
309
331
|
sameWebhookRegistration,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { canonicalTargetUri } from "../signing/canonicalize.mjs";
|
|
1
2
|
import { createHash } from "node:crypto";
|
|
2
3
|
import { ConfigurationError } from "../errors/index.mjs";
|
|
3
4
|
import { isWebhookLoopbackHost } from "../signing/webhook-verifier.mjs";
|
|
@@ -35,7 +36,11 @@ class InMemoryWebhookRegistrationStore {
|
|
|
35
36
|
const key = registrationKey(parsed.agentId, parsed.operationId);
|
|
36
37
|
const existing = this.entries.get(key);
|
|
37
38
|
if (existing) {
|
|
38
|
-
if (sameWebhookRegistration(existing, parsed))
|
|
39
|
+
if (sameWebhookRegistration(existing, parsed)) {
|
|
40
|
+
if (parsed.deliveryKind && parsed.expiresAt > existing.expiresAt)
|
|
41
|
+
this.entries.set(key, freezeWebhookRegistration({ ...existing, expiresAt: parsed.expiresAt }));
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
39
44
|
throw new ConfigurationError(
|
|
40
45
|
"Webhook operation id is already registered with different trusted provenance.",
|
|
41
46
|
"operationId"
|
|
@@ -137,6 +142,8 @@ function parseWebhookRegistration(value, expectedKey) {
|
|
|
137
142
|
if (input.requiresDurableSettlement !== void 0 && typeof input.requiresDurableSettlement !== "boolean") {
|
|
138
143
|
throw new TypeError("Webhook registration requiresDurableSettlement must be boolean.");
|
|
139
144
|
}
|
|
145
|
+
if (input.signingProfile !== void 0 && (input.mode !== "rfc9421" || !["adcp/webhook-signing/v1", "web-bot-auth"].includes(input.signingProfile)))
|
|
146
|
+
throw new TypeError("Invalid registered webhook signing profile");
|
|
140
147
|
const createdAt = requireEpochMs("createdAt", input.createdAt);
|
|
141
148
|
const expiresAt = requireEpochMs("expiresAt", input.expiresAt);
|
|
142
149
|
if (expiresAt <= createdAt) {
|
|
@@ -165,6 +172,8 @@ function parseWebhookRegistration(value, expectedKey) {
|
|
|
165
172
|
if (agent.username || agent.password || agent.hash) {
|
|
166
173
|
throw new TypeError("Webhook agentUrl cannot contain userinfo credentials or a fragment.");
|
|
167
174
|
}
|
|
175
|
+
if (input.deliveryKind !== void 0 && (!["reporting", "artifact"].includes(input.deliveryKind) || input.mode !== "rfc9421"))
|
|
176
|
+
throw new TypeError("Invalid delivery registration kind");
|
|
168
177
|
const parsed = {
|
|
169
178
|
agentId,
|
|
170
179
|
agentUrl,
|
|
@@ -174,6 +183,12 @@ function parseWebhookRegistration(value, expectedKey) {
|
|
|
174
183
|
callbackUrl,
|
|
175
184
|
method: "POST",
|
|
176
185
|
mode: input.mode,
|
|
186
|
+
...input.signingProfile !== void 0 && {
|
|
187
|
+
signingProfile: input.signingProfile
|
|
188
|
+
},
|
|
189
|
+
...input.deliveryKind !== void 0 && {
|
|
190
|
+
deliveryKind: input.deliveryKind
|
|
191
|
+
},
|
|
177
192
|
...input.authorizationContextVersion === 1 && { authorizationContextVersion: 1 },
|
|
178
193
|
...delegatedOperatorAuthorization !== void 0 && {
|
|
179
194
|
delegatedOperatorAuthorization: { ...delegatedOperatorAuthorization }
|
|
@@ -256,7 +271,9 @@ function webhookRegistrationFingerprint(registration) {
|
|
|
256
271
|
parsed.mode,
|
|
257
272
|
parsed.previewMode ?? null,
|
|
258
273
|
parsed.authorizationContextVersion ?? null,
|
|
259
|
-
canonicalDelegatedOperatorAuthorization(parsed.delegatedOperatorAuthorization)
|
|
274
|
+
canonicalDelegatedOperatorAuthorization(parsed.delegatedOperatorAuthorization),
|
|
275
|
+
...parsed.signingProfile === "web-bot-auth" ? [parsed.signingProfile] : [],
|
|
276
|
+
...parsed.deliveryKind !== void 0 ? ["delivery", parsed.deliveryKind] : []
|
|
260
277
|
]);
|
|
261
278
|
}
|
|
262
279
|
function sameWebhookRegistration(a, b) {
|
|
@@ -266,10 +283,14 @@ function webhookRegistrationStorageDigest(agentId, operationId) {
|
|
|
266
283
|
validateWebhookRegistrationKey(agentId, operationId);
|
|
267
284
|
return createHash("sha256").update(JSON.stringify([agentId, operationId])).digest("hex");
|
|
268
285
|
}
|
|
286
|
+
function deliveryWebhookRegistrationId(kind, url) {
|
|
287
|
+
return `delivery_route:${kind}:` + createHash("sha256").update(canonicalTargetUri(url, "3.2")).digest("hex");
|
|
288
|
+
}
|
|
269
289
|
export {
|
|
270
290
|
InMemoryWebhookRegistrationStore,
|
|
271
291
|
WebhookRegistrationIntegrityError,
|
|
272
292
|
canonicalDelegatedOperatorAuthorization,
|
|
293
|
+
deliveryWebhookRegistrationId,
|
|
273
294
|
freezeWebhookRegistration,
|
|
274
295
|
parseWebhookRegistration,
|
|
275
296
|
sameWebhookRegistration,
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from './types.mjs';
|
|
2
|
+
export * from './trust.mjs';
|
|
3
|
+
export * from './lifecycle.mjs';
|
|
4
|
+
export * from './revocation.mjs';
|
|
5
|
+
export { WEB_BOT_AUTH_DRAFT_REVISION, verifyWebBotAuth, signWebBotAuth, createWebBotAuthFetch, createSignedSignatureDirectory, SignatureDirectoryResolver, verifySignatureDirectory, selectSignatureProfile, jwkThumbprint, WebBotAuthError, } from '../signing/web-bot-auth.mjs';
|
|
6
|
+
export type { WebBotSigningKey, WebBotSigningOptions, VerifiedWebBotSigner, VerifyWebBotAuthOptions, } from '../signing/web-bot-auth.mjs';
|
|
7
|
+
export { validateIdentity33Payload } from './validation.mjs';
|
|
8
|
+
export { createIdentity33PrincipalResolver, createIdentity33PrincipalScopeResolver, createIdentity33Authorization, withIdentity33PrincipalHandlers, isIdentity33UnboundContext, } from './server.mjs';
|
|
9
|
+
export { createIdentity33StateStores } from './store.mjs';
|
|
10
|
+
export { deliveryWebhookRegistrationId } from '../core/webhook-registration.mjs';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from './types';
|
|
2
|
+
export * from './trust';
|
|
3
|
+
export * from './lifecycle';
|
|
4
|
+
export * from './revocation';
|
|
5
|
+
export { WEB_BOT_AUTH_DRAFT_REVISION, verifyWebBotAuth, signWebBotAuth, createWebBotAuthFetch, createSignedSignatureDirectory, SignatureDirectoryResolver, verifySignatureDirectory, selectSignatureProfile, jwkThumbprint, WebBotAuthError, } from '../signing/web-bot-auth';
|
|
6
|
+
export type { WebBotSigningKey, WebBotSigningOptions, VerifiedWebBotSigner, VerifyWebBotAuthOptions, } from '../signing/web-bot-auth';
|
|
7
|
+
export { validateIdentity33Payload } from './validation';
|
|
8
|
+
export { createIdentity33PrincipalResolver, createIdentity33PrincipalScopeResolver, createIdentity33Authorization, withIdentity33PrincipalHandlers, isIdentity33UnboundContext, } from './server';
|
|
9
|
+
export { createIdentity33StateStores } from './store';
|
|
10
|
+
export { deliveryWebhookRegistrationId } from '../core/webhook-registration';
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
var identity_3_exports = {};
|
|
21
|
+
__export(identity_3_exports, {
|
|
22
|
+
SignatureDirectoryResolver: () => import_web_bot_auth.SignatureDirectoryResolver,
|
|
23
|
+
WEB_BOT_AUTH_DRAFT_REVISION: () => import_web_bot_auth.WEB_BOT_AUTH_DRAFT_REVISION,
|
|
24
|
+
WebBotAuthError: () => import_web_bot_auth.WebBotAuthError,
|
|
25
|
+
createIdentity33Authorization: () => import_server.createIdentity33Authorization,
|
|
26
|
+
createIdentity33PrincipalResolver: () => import_server.createIdentity33PrincipalResolver,
|
|
27
|
+
createIdentity33PrincipalScopeResolver: () => import_server.createIdentity33PrincipalScopeResolver,
|
|
28
|
+
createIdentity33StateStores: () => import_store.createIdentity33StateStores,
|
|
29
|
+
createSignedSignatureDirectory: () => import_web_bot_auth.createSignedSignatureDirectory,
|
|
30
|
+
createWebBotAuthFetch: () => import_web_bot_auth.createWebBotAuthFetch,
|
|
31
|
+
deliveryWebhookRegistrationId: () => import_webhook_registration.deliveryWebhookRegistrationId,
|
|
32
|
+
isIdentity33UnboundContext: () => import_server.isIdentity33UnboundContext,
|
|
33
|
+
jwkThumbprint: () => import_web_bot_auth.jwkThumbprint,
|
|
34
|
+
selectSignatureProfile: () => import_web_bot_auth.selectSignatureProfile,
|
|
35
|
+
signWebBotAuth: () => import_web_bot_auth.signWebBotAuth,
|
|
36
|
+
validateIdentity33Payload: () => import_validation.validateIdentity33Payload,
|
|
37
|
+
verifySignatureDirectory: () => import_web_bot_auth.verifySignatureDirectory,
|
|
38
|
+
verifyWebBotAuth: () => import_web_bot_auth.verifyWebBotAuth,
|
|
39
|
+
withIdentity33PrincipalHandlers: () => import_server.withIdentity33PrincipalHandlers
|
|
40
|
+
});
|
|
41
|
+
module.exports = __toCommonJS(identity_3_exports);
|
|
42
|
+
__reExport(identity_3_exports, require('./types.js'), module.exports);
|
|
43
|
+
__reExport(identity_3_exports, require('./trust.js'), module.exports);
|
|
44
|
+
__reExport(identity_3_exports, require('./lifecycle.js'), module.exports);
|
|
45
|
+
__reExport(identity_3_exports, require('./revocation.js'), module.exports);
|
|
46
|
+
var import_web_bot_auth = require('../signing/web-bot-auth.js');
|
|
47
|
+
var import_validation = require('./validation.js');
|
|
48
|
+
var import_server = require('./server.js');
|
|
49
|
+
var import_store = require('./store.js');
|
|
50
|
+
var import_webhook_registration = require('../core/webhook-registration.js');
|
|
51
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
52
|
+
0 && (module.exports = {
|
|
53
|
+
SignatureDirectoryResolver,
|
|
54
|
+
WEB_BOT_AUTH_DRAFT_REVISION,
|
|
55
|
+
WebBotAuthError,
|
|
56
|
+
createIdentity33Authorization,
|
|
57
|
+
createIdentity33PrincipalResolver,
|
|
58
|
+
createIdentity33PrincipalScopeResolver,
|
|
59
|
+
createIdentity33StateStores,
|
|
60
|
+
createSignedSignatureDirectory,
|
|
61
|
+
createWebBotAuthFetch,
|
|
62
|
+
deliveryWebhookRegistrationId,
|
|
63
|
+
isIdentity33UnboundContext,
|
|
64
|
+
jwkThumbprint,
|
|
65
|
+
selectSignatureProfile,
|
|
66
|
+
signWebBotAuth,
|
|
67
|
+
validateIdentity33Payload,
|
|
68
|
+
verifySignatureDirectory,
|
|
69
|
+
verifyWebBotAuth,
|
|
70
|
+
withIdentity33PrincipalHandlers,
|
|
71
|
+
...require('./types.js'),
|
|
72
|
+
...require('./trust.js'),
|
|
73
|
+
...require('./lifecycle.js'),
|
|
74
|
+
...require('./revocation.js')
|
|
75
|
+
});
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export * from "./types.mjs";
|
|
2
|
+
export * from "./trust.mjs";
|
|
3
|
+
export * from "./lifecycle.mjs";
|
|
4
|
+
export * from "./revocation.mjs";
|
|
5
|
+
import {
|
|
6
|
+
WEB_BOT_AUTH_DRAFT_REVISION,
|
|
7
|
+
verifyWebBotAuth,
|
|
8
|
+
signWebBotAuth,
|
|
9
|
+
createWebBotAuthFetch,
|
|
10
|
+
createSignedSignatureDirectory,
|
|
11
|
+
SignatureDirectoryResolver,
|
|
12
|
+
verifySignatureDirectory,
|
|
13
|
+
selectSignatureProfile,
|
|
14
|
+
jwkThumbprint,
|
|
15
|
+
WebBotAuthError
|
|
16
|
+
} from "../signing/web-bot-auth.mjs";
|
|
17
|
+
import { validateIdentity33Payload } from "./validation.mjs";
|
|
18
|
+
import {
|
|
19
|
+
createIdentity33PrincipalResolver,
|
|
20
|
+
createIdentity33PrincipalScopeResolver,
|
|
21
|
+
createIdentity33Authorization,
|
|
22
|
+
withIdentity33PrincipalHandlers,
|
|
23
|
+
isIdentity33UnboundContext
|
|
24
|
+
} from "./server.mjs";
|
|
25
|
+
import { createIdentity33StateStores } from "./store.mjs";
|
|
26
|
+
import { deliveryWebhookRegistrationId } from "../core/webhook-registration.mjs";
|
|
27
|
+
export {
|
|
28
|
+
SignatureDirectoryResolver,
|
|
29
|
+
WEB_BOT_AUTH_DRAFT_REVISION,
|
|
30
|
+
WebBotAuthError,
|
|
31
|
+
createIdentity33Authorization,
|
|
32
|
+
createIdentity33PrincipalResolver,
|
|
33
|
+
createIdentity33PrincipalScopeResolver,
|
|
34
|
+
createIdentity33StateStores,
|
|
35
|
+
createSignedSignatureDirectory,
|
|
36
|
+
createWebBotAuthFetch,
|
|
37
|
+
deliveryWebhookRegistrationId,
|
|
38
|
+
isIdentity33UnboundContext,
|
|
39
|
+
jwkThumbprint,
|
|
40
|
+
selectSignatureProfile,
|
|
41
|
+
signWebBotAuth,
|
|
42
|
+
validateIdentity33Payload,
|
|
43
|
+
verifySignatureDirectory,
|
|
44
|
+
verifyWebBotAuth,
|
|
45
|
+
withIdentity33PrincipalHandlers
|
|
46
|
+
};
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import type { PrincipalKind } from '../server/principal/types.mjs';
|
|
2
|
+
import { TrustEvaluator } from './trust.mjs';
|
|
3
|
+
import type { AgentOnboarding, AgentOnboardingRequirement, BillingParty, PrincipalRelationship, IdentityPrincipalChangedReason } from './types.mjs';
|
|
4
|
+
export interface OriginBinding {
|
|
5
|
+
origin: string;
|
|
6
|
+
operator: string;
|
|
7
|
+
principalId: string;
|
|
8
|
+
principalKind?: PrincipalKind;
|
|
9
|
+
audit: {
|
|
10
|
+
approvedBy: string;
|
|
11
|
+
approvedAt: string;
|
|
12
|
+
reason: string;
|
|
13
|
+
migrationApproved?: boolean;
|
|
14
|
+
};
|
|
15
|
+
/** Restricts a newly auto-created principal to the specifically opened tiers. */
|
|
16
|
+
openAccess?: {
|
|
17
|
+
sandbox?: true;
|
|
18
|
+
billing?: BillingParty[];
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export interface IdentityApplication {
|
|
22
|
+
relationship: PrincipalRelationship;
|
|
23
|
+
revision: number;
|
|
24
|
+
expiryNotified?: string;
|
|
25
|
+
pendingNotifications?: Array<{
|
|
26
|
+
id: string;
|
|
27
|
+
reason: IdentityPrincipalChangedReason;
|
|
28
|
+
}>;
|
|
29
|
+
}
|
|
30
|
+
/** Every write must be atomic. Namespace this store to one seller and tenant. */
|
|
31
|
+
export interface OriginIdentityStore {
|
|
32
|
+
getBinding(origin: string): Promise<OriginBinding | undefined>;
|
|
33
|
+
/** Must enforce one principal per origin, including concurrent migrations. */
|
|
34
|
+
bind(binding: OriginBinding): Promise<void>;
|
|
35
|
+
/** Must atomically enforce operator-domain quota and allocate a NEW principal. */
|
|
36
|
+
bindOpen(binding: OriginBinding, maxPerOperator: number): Promise<OriginBinding>;
|
|
37
|
+
getApplication(origin: string): Promise<IdentityApplication | undefined>;
|
|
38
|
+
compareAndSetApplication(origin: string, expectedRevision: number | undefined, application: IdentityApplication): Promise<boolean>;
|
|
39
|
+
}
|
|
40
|
+
export declare class InMemoryOriginIdentityStore implements OriginIdentityStore {
|
|
41
|
+
readonly durability: "process-local";
|
|
42
|
+
private readonly bindings;
|
|
43
|
+
private readonly applications;
|
|
44
|
+
getBinding(origin: string): Promise<OriginBinding | undefined>;
|
|
45
|
+
bind(binding: OriginBinding): Promise<void>;
|
|
46
|
+
bindOpen(binding: OriginBinding, maxPerOperator: number): Promise<OriginBinding>;
|
|
47
|
+
getApplication(origin: string): Promise<IdentityApplication | undefined>;
|
|
48
|
+
compareAndSetApplication(origin: string, expectedRevision: number | undefined, application: IdentityApplication): Promise<boolean>;
|
|
49
|
+
}
|
|
50
|
+
/** Wrong-direction gates are ignored; unknown gates remain unsatisfied. */
|
|
51
|
+
export declare function evaluateOnboardingRequirements(requirements: readonly AgentOnboardingRequirement[], direction: 'seller' | 'buyer', check: (requirement: AgentOnboardingRequirement) => Promise<boolean>): Promise<{
|
|
52
|
+
satisfied: boolean;
|
|
53
|
+
unsatisfied: AgentOnboardingRequirement[];
|
|
54
|
+
}>;
|
|
55
|
+
export declare function validateAgentOnboarding(posture: AgentOnboarding, account: {
|
|
56
|
+
sandbox?: boolean;
|
|
57
|
+
supported_billing?: readonly BillingParty[];
|
|
58
|
+
}, experimentalFeatures: readonly string[]): void;
|
|
59
|
+
export interface OriginIdentityLifecycleOptions {
|
|
60
|
+
store: OriginIdentityStore;
|
|
61
|
+
trust: TrustEvaluator;
|
|
62
|
+
now?: () => number;
|
|
63
|
+
/** Supply for open onboarding only. */
|
|
64
|
+
onboarding?: AgentOnboarding;
|
|
65
|
+
maxOpenPrincipalsPerOperator?: number;
|
|
66
|
+
checkRequirement?: (origin: string, requirement: AgentOnboardingRequirement) => Promise<boolean>;
|
|
67
|
+
hasBillingRelationship?: (billedPartyDomain: string, billing: BillingParty) => Promise<boolean>;
|
|
68
|
+
/** Publish only after the new application state is durable; duplicate notifications are allowed. */
|
|
69
|
+
notify?: (origin: string, reason: IdentityPrincipalChangedReason, notificationId: string) => Promise<void>;
|
|
70
|
+
/** Seller ledger lookup, required before automatic creation to prevent RFC principal splitting. */
|
|
71
|
+
lookupLegacyPrincipals?: (origin: string) => Promise<readonly string[]>;
|
|
72
|
+
}
|
|
73
|
+
export declare class OriginIdentityLifecycle {
|
|
74
|
+
private readonly options;
|
|
75
|
+
constructor(options: OriginIdentityLifecycleOptions);
|
|
76
|
+
/** Identity-established origins get no durable identifier. Reads never create. */
|
|
77
|
+
getPrincipal(originUrl: string): Promise<{
|
|
78
|
+
binding?: OriginBinding;
|
|
79
|
+
result: {
|
|
80
|
+
kind: 'unconfigured' | 'recognized';
|
|
81
|
+
principal_id?: string;
|
|
82
|
+
principal_kind?: PrincipalKind;
|
|
83
|
+
relationship?: PrincipalRelationship;
|
|
84
|
+
};
|
|
85
|
+
}>;
|
|
86
|
+
bindPrincipal(input: {
|
|
87
|
+
origin: string;
|
|
88
|
+
principalId: string;
|
|
89
|
+
approvedBy: string;
|
|
90
|
+
reason: string;
|
|
91
|
+
principalKind?: PrincipalKind;
|
|
92
|
+
existingRfcPrincipal?: boolean;
|
|
93
|
+
migrationApproved?: boolean;
|
|
94
|
+
sharedOrigin?: boolean;
|
|
95
|
+
}): Promise<OriginBinding>;
|
|
96
|
+
/** Cryptographic verification does not call this. Authorization revalidates delisting. */
|
|
97
|
+
authorizeBound(originUrl: string, access?: {
|
|
98
|
+
readOnly?: true;
|
|
99
|
+
identityConfiguration?: true;
|
|
100
|
+
sandbox?: boolean;
|
|
101
|
+
billing?: BillingParty;
|
|
102
|
+
brandDomain?: string;
|
|
103
|
+
}): Promise<OriginBinding | undefined>;
|
|
104
|
+
/** Called by explicit sync_principal only; allocates new identities, never migrates existing ones. */
|
|
105
|
+
syncOpen(originUrl: string, options?: {
|
|
106
|
+
dryRun?: boolean;
|
|
107
|
+
}): Promise<OriginBinding>;
|
|
108
|
+
setRelationship(originUrl: string, relationship: PrincipalRelationship): Promise<void>;
|
|
109
|
+
notifyRelationshipExpiring(originUrl: string, leadSeconds: number): Promise<boolean>;
|
|
110
|
+
flushRelationshipNotifications(originUrl: string): Promise<void>;
|
|
111
|
+
assertLegacyAllowed(agentUrl: string): Promise<void>;
|
|
112
|
+
private now;
|
|
113
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import type { PrincipalKind } from '../server/principal/types';
|
|
2
|
+
import { TrustEvaluator } from './trust';
|
|
3
|
+
import type { AgentOnboarding, AgentOnboardingRequirement, BillingParty, PrincipalRelationship, IdentityPrincipalChangedReason } from './types';
|
|
4
|
+
export interface OriginBinding {
|
|
5
|
+
origin: string;
|
|
6
|
+
operator: string;
|
|
7
|
+
principalId: string;
|
|
8
|
+
principalKind?: PrincipalKind;
|
|
9
|
+
audit: {
|
|
10
|
+
approvedBy: string;
|
|
11
|
+
approvedAt: string;
|
|
12
|
+
reason: string;
|
|
13
|
+
migrationApproved?: boolean;
|
|
14
|
+
};
|
|
15
|
+
/** Restricts a newly auto-created principal to the specifically opened tiers. */
|
|
16
|
+
openAccess?: {
|
|
17
|
+
sandbox?: true;
|
|
18
|
+
billing?: BillingParty[];
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export interface IdentityApplication {
|
|
22
|
+
relationship: PrincipalRelationship;
|
|
23
|
+
revision: number;
|
|
24
|
+
expiryNotified?: string;
|
|
25
|
+
pendingNotifications?: Array<{
|
|
26
|
+
id: string;
|
|
27
|
+
reason: IdentityPrincipalChangedReason;
|
|
28
|
+
}>;
|
|
29
|
+
}
|
|
30
|
+
/** Every write must be atomic. Namespace this store to one seller and tenant. */
|
|
31
|
+
export interface OriginIdentityStore {
|
|
32
|
+
getBinding(origin: string): Promise<OriginBinding | undefined>;
|
|
33
|
+
/** Must enforce one principal per origin, including concurrent migrations. */
|
|
34
|
+
bind(binding: OriginBinding): Promise<void>;
|
|
35
|
+
/** Must atomically enforce operator-domain quota and allocate a NEW principal. */
|
|
36
|
+
bindOpen(binding: OriginBinding, maxPerOperator: number): Promise<OriginBinding>;
|
|
37
|
+
getApplication(origin: string): Promise<IdentityApplication | undefined>;
|
|
38
|
+
compareAndSetApplication(origin: string, expectedRevision: number | undefined, application: IdentityApplication): Promise<boolean>;
|
|
39
|
+
}
|
|
40
|
+
export declare class InMemoryOriginIdentityStore implements OriginIdentityStore {
|
|
41
|
+
readonly durability: "process-local";
|
|
42
|
+
private readonly bindings;
|
|
43
|
+
private readonly applications;
|
|
44
|
+
getBinding(origin: string): Promise<OriginBinding | undefined>;
|
|
45
|
+
bind(binding: OriginBinding): Promise<void>;
|
|
46
|
+
bindOpen(binding: OriginBinding, maxPerOperator: number): Promise<OriginBinding>;
|
|
47
|
+
getApplication(origin: string): Promise<IdentityApplication | undefined>;
|
|
48
|
+
compareAndSetApplication(origin: string, expectedRevision: number | undefined, application: IdentityApplication): Promise<boolean>;
|
|
49
|
+
}
|
|
50
|
+
/** Wrong-direction gates are ignored; unknown gates remain unsatisfied. */
|
|
51
|
+
export declare function evaluateOnboardingRequirements(requirements: readonly AgentOnboardingRequirement[], direction: 'seller' | 'buyer', check: (requirement: AgentOnboardingRequirement) => Promise<boolean>): Promise<{
|
|
52
|
+
satisfied: boolean;
|
|
53
|
+
unsatisfied: AgentOnboardingRequirement[];
|
|
54
|
+
}>;
|
|
55
|
+
export declare function validateAgentOnboarding(posture: AgentOnboarding, account: {
|
|
56
|
+
sandbox?: boolean;
|
|
57
|
+
supported_billing?: readonly BillingParty[];
|
|
58
|
+
}, experimentalFeatures: readonly string[]): void;
|
|
59
|
+
export interface OriginIdentityLifecycleOptions {
|
|
60
|
+
store: OriginIdentityStore;
|
|
61
|
+
trust: TrustEvaluator;
|
|
62
|
+
now?: () => number;
|
|
63
|
+
/** Supply for open onboarding only. */
|
|
64
|
+
onboarding?: AgentOnboarding;
|
|
65
|
+
maxOpenPrincipalsPerOperator?: number;
|
|
66
|
+
checkRequirement?: (origin: string, requirement: AgentOnboardingRequirement) => Promise<boolean>;
|
|
67
|
+
hasBillingRelationship?: (billedPartyDomain: string, billing: BillingParty) => Promise<boolean>;
|
|
68
|
+
/** Publish only after the new application state is durable; duplicate notifications are allowed. */
|
|
69
|
+
notify?: (origin: string, reason: IdentityPrincipalChangedReason, notificationId: string) => Promise<void>;
|
|
70
|
+
/** Seller ledger lookup, required before automatic creation to prevent RFC principal splitting. */
|
|
71
|
+
lookupLegacyPrincipals?: (origin: string) => Promise<readonly string[]>;
|
|
72
|
+
}
|
|
73
|
+
export declare class OriginIdentityLifecycle {
|
|
74
|
+
private readonly options;
|
|
75
|
+
constructor(options: OriginIdentityLifecycleOptions);
|
|
76
|
+
/** Identity-established origins get no durable identifier. Reads never create. */
|
|
77
|
+
getPrincipal(originUrl: string): Promise<{
|
|
78
|
+
binding?: OriginBinding;
|
|
79
|
+
result: {
|
|
80
|
+
kind: 'unconfigured' | 'recognized';
|
|
81
|
+
principal_id?: string;
|
|
82
|
+
principal_kind?: PrincipalKind;
|
|
83
|
+
relationship?: PrincipalRelationship;
|
|
84
|
+
};
|
|
85
|
+
}>;
|
|
86
|
+
bindPrincipal(input: {
|
|
87
|
+
origin: string;
|
|
88
|
+
principalId: string;
|
|
89
|
+
approvedBy: string;
|
|
90
|
+
reason: string;
|
|
91
|
+
principalKind?: PrincipalKind;
|
|
92
|
+
existingRfcPrincipal?: boolean;
|
|
93
|
+
migrationApproved?: boolean;
|
|
94
|
+
sharedOrigin?: boolean;
|
|
95
|
+
}): Promise<OriginBinding>;
|
|
96
|
+
/** Cryptographic verification does not call this. Authorization revalidates delisting. */
|
|
97
|
+
authorizeBound(originUrl: string, access?: {
|
|
98
|
+
readOnly?: true;
|
|
99
|
+
identityConfiguration?: true;
|
|
100
|
+
sandbox?: boolean;
|
|
101
|
+
billing?: BillingParty;
|
|
102
|
+
brandDomain?: string;
|
|
103
|
+
}): Promise<OriginBinding | undefined>;
|
|
104
|
+
/** Called by explicit sync_principal only; allocates new identities, never migrates existing ones. */
|
|
105
|
+
syncOpen(originUrl: string, options?: {
|
|
106
|
+
dryRun?: boolean;
|
|
107
|
+
}): Promise<OriginBinding>;
|
|
108
|
+
setRelationship(originUrl: string, relationship: PrincipalRelationship): Promise<void>;
|
|
109
|
+
notifyRelationshipExpiring(originUrl: string, leadSeconds: number): Promise<boolean>;
|
|
110
|
+
flushRelationshipNotifications(originUrl: string): Promise<void>;
|
|
111
|
+
assertLegacyAllowed(agentUrl: string): Promise<void>;
|
|
112
|
+
private now;
|
|
113
|
+
}
|