@adcp/sdk 15.9.1 → 16.0.0-beta.2
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 +25 -2
- package/dist/lib/core/SingleAgentClient.d.ts +25 -2
- package/dist/lib/core/SingleAgentClient.js +280 -62
- package/dist/lib/core/SingleAgentClient.mjs +282 -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/generated-compat.d.mts +34 -0
- package/dist/lib/identity-3.3/generated-compat.d.ts +34 -0
- package/dist/lib/identity-3.3/generated-compat.js +16 -0
- package/dist/lib/identity-3.3/generated-compat.mjs +0 -0
- 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 +79 -0
- package/dist/lib/identity-3.3/index.mjs +50 -0
- package/dist/lib/identity-3.3/lifecycle.d.mts +125 -0
- package/dist/lib/identity-3.3/lifecycle.d.ts +125 -0
- package/dist/lib/identity-3.3/lifecycle.js +294 -0
- package/dist/lib/identity-3.3/lifecycle.mjs +272 -0
- package/dist/lib/identity-3.3/revocation.d.mts +86 -0
- package/dist/lib/identity-3.3/revocation.d.ts +86 -0
- package/dist/lib/identity-3.3/revocation.js +308 -0
- package/dist/lib/identity-3.3/revocation.mjs +286 -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 +46 -0
- package/dist/lib/identity-3.3/server.d.ts +46 -0
- package/dist/lib/identity-3.3/server.js +279 -0
- package/dist/lib/identity-3.3/server.mjs +260 -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 +155 -0
- package/dist/lib/identity-3.3/trust.d.ts +155 -0
- package/dist/lib/identity-3.3/trust.js +383 -0
- package/dist/lib/identity-3.3/trust.mjs +342 -0
- package/dist/lib/identity-3.3/types.d.mts +155 -0
- package/dist/lib/identity-3.3/types.d.ts +155 -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/index.js +2 -0
- package/dist/lib/index.mjs +2 -0
- package/dist/lib/protocols/index.d.mts +1 -1
- package/dist/lib/protocols/index.d.ts +1 -1
- package/dist/lib/protocols/index.js +2 -2
- package/dist/lib/protocols/index.mjs +2 -2
- 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 +39 -5
- package/dist/lib/reporting/bigquery/index.d.ts +39 -5
- package/dist/lib/reporting/bigquery/index.js +26 -20
- package/dist/lib/reporting/bigquery/index.mjs +26 -20
- 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 +15 -0
- package/dist/lib/server/auth-signature.d.ts +15 -0
- package/dist/lib/server/auth-signature.js +72 -2
- package/dist/lib/server/auth-signature.mjs +81 -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 +259 -19
- package/dist/lib/server/create-adcp-server.mjs +266 -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/crypto.js +8 -0
- package/dist/lib/signing/crypto.mjs +9 -1
- package/dist/lib/signing/fetch-async.js +1 -1
- package/dist/lib/signing/fetch-async.mjs +1 -1
- package/dist/lib/signing/fetch.js +1 -1
- package/dist/lib/signing/fetch.mjs +1 -1
- 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/middleware.js +9 -0
- package/dist/lib/signing/middleware.mjs +14 -0
- package/dist/lib/signing/parser.d.mts +9 -6
- package/dist/lib/signing/parser.d.ts +9 -6
- package/dist/lib/signing/parser.js +82 -64
- package/dist/lib/signing/parser.mjs +83 -65
- package/dist/lib/signing/revocation.d.mts +4 -1
- package/dist/lib/signing/revocation.d.ts +4 -1
- package/dist/lib/signing/revocation.js +36 -3
- package/dist/lib/signing/revocation.mjs +34 -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/verifier.js +1 -1
- package/dist/lib/signing/verifier.mjs +1 -1
- package/dist/lib/signing/web-bot-auth.d.mts +191 -0
- package/dist/lib/signing/web-bot-auth.d.ts +191 -0
- package/dist/lib/signing/web-bot-auth.js +837 -0
- package/dist/lib/signing/web-bot-auth.mjs +796 -0
- package/dist/lib/signing/webhook-verifier.js +1 -1
- package/dist/lib/signing/webhook-verifier.mjs +1 -1
- 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/catalog-snapshot.js +3 -1
- package/dist/lib/v2/projection/catalog-snapshot.mjs +3 -1
- package/dist/lib/v2/projection/creative-delivery.d.mts +34 -10
- package/dist/lib/v2/projection/creative-delivery.d.ts +34 -10
- 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/index.js +2 -0
- package/dist/lib/v2/projection/index.mjs +2 -0
- package/dist/lib/v2/projection/legacy-routes.d.mts +34 -2
- package/dist/lib/v2/projection/legacy-routes.d.ts +34 -2
- package/dist/lib/v2/projection/legacy-routes.js +35 -2
- package/dist/lib/v2/projection/legacy-routes.mjs +32 -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 +99 -29
- package/docs/guides/REPORTING-OPERATIONS.md +29 -13
- 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 +15 -0
- package/docs/migration-14.x-rc-worksheet.md +4 -4
- package/docs/migration-agent-identity-3.3.md +494 -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 +17 -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,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bridges the experimental AdCP 3.3 preview types to the generated wire types.
|
|
3
|
+
*
|
|
4
|
+
* The released SDK pins an AdCP schema version that predates the 3.3 identity
|
|
5
|
+
* drafts, so the preview types in `./types` start from hand-written drafts. Once
|
|
6
|
+
* the pinned schemas (or a candidate spec bundle built by the spec repo's
|
|
7
|
+
* "Generate TypeScript SDK" check) define a shape, the generated type wins: the
|
|
8
|
+
* preview type becomes an alias of it, so the two cannot drift apart and a
|
|
9
|
+
* server that accepts the preview shape always emits a generated-valid payload.
|
|
10
|
+
*
|
|
11
|
+
* Internal: not re-exported from `@adcp/sdk/identity-3.3`.
|
|
12
|
+
*/
|
|
13
|
+
import type { GetAdCPCapabilitiesResponse } from '../types/tools.generated.mjs';
|
|
14
|
+
/**
|
|
15
|
+
* The value type of an optional property `K` on `T`, or `unknown` when `T`
|
|
16
|
+
* does not declare it. An object type without `K` is assignable to
|
|
17
|
+
* `{ K?: V }`, so the absent case infers `unknown` rather than failing.
|
|
18
|
+
* Non-distributive, so a union `T` resolves to the property's union rather
|
|
19
|
+
* than silently falling back when one member lacks it.
|
|
20
|
+
*/
|
|
21
|
+
export type OptionalPropertyOf<T, K extends PropertyKey> = [T] extends [{
|
|
22
|
+
[P in K]?: infer V;
|
|
23
|
+
}] ? V : unknown;
|
|
24
|
+
/** `Generated` when the pinned schemas define it, otherwise `Draft`. */
|
|
25
|
+
export type PreferGenerated<Generated, Draft> = unknown extends Generated ? Draft : [NonNullable<Generated>] extends [never] ? Draft : NonNullable<Generated>;
|
|
26
|
+
/**
|
|
27
|
+
* Resolves `account.agent_onboarding` from a `get_adcp_capabilities` account
|
|
28
|
+
* shape, falling back to the draft when that shape does not declare it.
|
|
29
|
+
* Parameterised so type tests can exercise it against fixtures of newer
|
|
30
|
+
* generated shapes without regenerating the SDK.
|
|
31
|
+
*/
|
|
32
|
+
export type ResolveAgentOnboarding<Account, Draft> = PreferGenerated<OptionalPropertyOf<NonNullable<Account>, 'agent_onboarding'>, Draft>;
|
|
33
|
+
/** `account` in the pinned `get_adcp_capabilities` response. */
|
|
34
|
+
export type GeneratedAccountCapabilities = NonNullable<GetAdCPCapabilitiesResponse['account']>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bridges the experimental AdCP 3.3 preview types to the generated wire types.
|
|
3
|
+
*
|
|
4
|
+
* The released SDK pins an AdCP schema version that predates the 3.3 identity
|
|
5
|
+
* drafts, so the preview types in `./types` start from hand-written drafts. Once
|
|
6
|
+
* the pinned schemas (or a candidate spec bundle built by the spec repo's
|
|
7
|
+
* "Generate TypeScript SDK" check) define a shape, the generated type wins: the
|
|
8
|
+
* preview type becomes an alias of it, so the two cannot drift apart and a
|
|
9
|
+
* server that accepts the preview shape always emits a generated-valid payload.
|
|
10
|
+
*
|
|
11
|
+
* Internal: not re-exported from `@adcp/sdk/identity-3.3`.
|
|
12
|
+
*/
|
|
13
|
+
import type { GetAdCPCapabilitiesResponse } from '../types/tools.generated';
|
|
14
|
+
/**
|
|
15
|
+
* The value type of an optional property `K` on `T`, or `unknown` when `T`
|
|
16
|
+
* does not declare it. An object type without `K` is assignable to
|
|
17
|
+
* `{ K?: V }`, so the absent case infers `unknown` rather than failing.
|
|
18
|
+
* Non-distributive, so a union `T` resolves to the property's union rather
|
|
19
|
+
* than silently falling back when one member lacks it.
|
|
20
|
+
*/
|
|
21
|
+
export type OptionalPropertyOf<T, K extends PropertyKey> = [T] extends [{
|
|
22
|
+
[P in K]?: infer V;
|
|
23
|
+
}] ? V : unknown;
|
|
24
|
+
/** `Generated` when the pinned schemas define it, otherwise `Draft`. */
|
|
25
|
+
export type PreferGenerated<Generated, Draft> = unknown extends Generated ? Draft : [NonNullable<Generated>] extends [never] ? Draft : NonNullable<Generated>;
|
|
26
|
+
/**
|
|
27
|
+
* Resolves `account.agent_onboarding` from a `get_adcp_capabilities` account
|
|
28
|
+
* shape, falling back to the draft when that shape does not declare it.
|
|
29
|
+
* Parameterised so type tests can exercise it against fixtures of newer
|
|
30
|
+
* generated shapes without regenerating the SDK.
|
|
31
|
+
*/
|
|
32
|
+
export type ResolveAgentOnboarding<Account, Draft> = PreferGenerated<OptionalPropertyOf<NonNullable<Account>, 'agent_onboarding'>, Draft>;
|
|
33
|
+
/** `account` in the pinned `get_adcp_capabilities` response. */
|
|
34
|
+
export type GeneratedAccountCapabilities = NonNullable<GetAdCPCapabilitiesResponse['account']>;
|
|
@@ -0,0 +1,16 @@
|
|
|
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 __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var generated_compat_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(generated_compat_exports);
|
|
File without changes
|
|
@@ -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, verifyKeyDirectory, selectSignatureProfile, jwkThumbprint, WebBotAuthError, WebBotAuthUnavailableError, } from '../signing/web-bot-auth.mjs';
|
|
6
|
+
export type { WebBotSigningKey, WebBotSigningOptions, VerifiedWebBotSigner, VerifyWebBotAuthOptions, VerifiedSignatureDirectory, SignatureDirectoryResolverOptions, } 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, verifyKeyDirectory, selectSignatureProfile, jwkThumbprint, WebBotAuthError, WebBotAuthUnavailableError, } from '../signing/web-bot-auth';
|
|
6
|
+
export type { WebBotSigningKey, WebBotSigningOptions, VerifiedWebBotSigner, VerifyWebBotAuthOptions, VerifiedSignatureDirectory, SignatureDirectoryResolverOptions, } 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,79 @@
|
|
|
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
|
+
WebBotAuthUnavailableError: () => import_web_bot_auth.WebBotAuthUnavailableError,
|
|
26
|
+
createIdentity33Authorization: () => import_server.createIdentity33Authorization,
|
|
27
|
+
createIdentity33PrincipalResolver: () => import_server.createIdentity33PrincipalResolver,
|
|
28
|
+
createIdentity33PrincipalScopeResolver: () => import_server.createIdentity33PrincipalScopeResolver,
|
|
29
|
+
createIdentity33StateStores: () => import_store.createIdentity33StateStores,
|
|
30
|
+
createSignedSignatureDirectory: () => import_web_bot_auth.createSignedSignatureDirectory,
|
|
31
|
+
createWebBotAuthFetch: () => import_web_bot_auth.createWebBotAuthFetch,
|
|
32
|
+
deliveryWebhookRegistrationId: () => import_webhook_registration.deliveryWebhookRegistrationId,
|
|
33
|
+
isIdentity33UnboundContext: () => import_server.isIdentity33UnboundContext,
|
|
34
|
+
jwkThumbprint: () => import_web_bot_auth.jwkThumbprint,
|
|
35
|
+
selectSignatureProfile: () => import_web_bot_auth.selectSignatureProfile,
|
|
36
|
+
signWebBotAuth: () => import_web_bot_auth.signWebBotAuth,
|
|
37
|
+
validateIdentity33Payload: () => import_validation.validateIdentity33Payload,
|
|
38
|
+
verifyKeyDirectory: () => import_web_bot_auth.verifyKeyDirectory,
|
|
39
|
+
verifySignatureDirectory: () => import_web_bot_auth.verifySignatureDirectory,
|
|
40
|
+
verifyWebBotAuth: () => import_web_bot_auth.verifyWebBotAuth,
|
|
41
|
+
withIdentity33PrincipalHandlers: () => import_server.withIdentity33PrincipalHandlers
|
|
42
|
+
});
|
|
43
|
+
module.exports = __toCommonJS(identity_3_exports);
|
|
44
|
+
__reExport(identity_3_exports, require('./types.js'), module.exports);
|
|
45
|
+
__reExport(identity_3_exports, require('./trust.js'), module.exports);
|
|
46
|
+
__reExport(identity_3_exports, require('./lifecycle.js'), module.exports);
|
|
47
|
+
__reExport(identity_3_exports, require('./revocation.js'), module.exports);
|
|
48
|
+
var import_web_bot_auth = require('../signing/web-bot-auth.js');
|
|
49
|
+
var import_validation = require('./validation.js');
|
|
50
|
+
var import_server = require('./server.js');
|
|
51
|
+
var import_store = require('./store.js');
|
|
52
|
+
var import_webhook_registration = require('../core/webhook-registration.js');
|
|
53
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
54
|
+
0 && (module.exports = {
|
|
55
|
+
SignatureDirectoryResolver,
|
|
56
|
+
WEB_BOT_AUTH_DRAFT_REVISION,
|
|
57
|
+
WebBotAuthError,
|
|
58
|
+
WebBotAuthUnavailableError,
|
|
59
|
+
createIdentity33Authorization,
|
|
60
|
+
createIdentity33PrincipalResolver,
|
|
61
|
+
createIdentity33PrincipalScopeResolver,
|
|
62
|
+
createIdentity33StateStores,
|
|
63
|
+
createSignedSignatureDirectory,
|
|
64
|
+
createWebBotAuthFetch,
|
|
65
|
+
deliveryWebhookRegistrationId,
|
|
66
|
+
isIdentity33UnboundContext,
|
|
67
|
+
jwkThumbprint,
|
|
68
|
+
selectSignatureProfile,
|
|
69
|
+
signWebBotAuth,
|
|
70
|
+
validateIdentity33Payload,
|
|
71
|
+
verifyKeyDirectory,
|
|
72
|
+
verifySignatureDirectory,
|
|
73
|
+
verifyWebBotAuth,
|
|
74
|
+
withIdentity33PrincipalHandlers,
|
|
75
|
+
...require('./types.js'),
|
|
76
|
+
...require('./trust.js'),
|
|
77
|
+
...require('./lifecycle.js'),
|
|
78
|
+
...require('./revocation.js')
|
|
79
|
+
});
|
|
@@ -0,0 +1,50 @@
|
|
|
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
|
+
verifyKeyDirectory,
|
|
14
|
+
selectSignatureProfile,
|
|
15
|
+
jwkThumbprint,
|
|
16
|
+
WebBotAuthError,
|
|
17
|
+
WebBotAuthUnavailableError
|
|
18
|
+
} from "../signing/web-bot-auth.mjs";
|
|
19
|
+
import { validateIdentity33Payload } from "./validation.mjs";
|
|
20
|
+
import {
|
|
21
|
+
createIdentity33PrincipalResolver,
|
|
22
|
+
createIdentity33PrincipalScopeResolver,
|
|
23
|
+
createIdentity33Authorization,
|
|
24
|
+
withIdentity33PrincipalHandlers,
|
|
25
|
+
isIdentity33UnboundContext
|
|
26
|
+
} from "./server.mjs";
|
|
27
|
+
import { createIdentity33StateStores } from "./store.mjs";
|
|
28
|
+
import { deliveryWebhookRegistrationId } from "../core/webhook-registration.mjs";
|
|
29
|
+
export {
|
|
30
|
+
SignatureDirectoryResolver,
|
|
31
|
+
WEB_BOT_AUTH_DRAFT_REVISION,
|
|
32
|
+
WebBotAuthError,
|
|
33
|
+
WebBotAuthUnavailableError,
|
|
34
|
+
createIdentity33Authorization,
|
|
35
|
+
createIdentity33PrincipalResolver,
|
|
36
|
+
createIdentity33PrincipalScopeResolver,
|
|
37
|
+
createIdentity33StateStores,
|
|
38
|
+
createSignedSignatureDirectory,
|
|
39
|
+
createWebBotAuthFetch,
|
|
40
|
+
deliveryWebhookRegistrationId,
|
|
41
|
+
isIdentity33UnboundContext,
|
|
42
|
+
jwkThumbprint,
|
|
43
|
+
selectSignatureProfile,
|
|
44
|
+
signWebBotAuth,
|
|
45
|
+
validateIdentity33Payload,
|
|
46
|
+
verifyKeyDirectory,
|
|
47
|
+
verifySignatureDirectory,
|
|
48
|
+
verifyWebBotAuth,
|
|
49
|
+
withIdentity33PrincipalHandlers
|
|
50
|
+
};
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import type { PrincipalKind } from '../server/principal/types.mjs';
|
|
2
|
+
import { TrustEvaluator } from './trust.mjs';
|
|
3
|
+
import type { AgentOnboarding, AgentOnboardingRequirement, ObservedAgentOnboardingRequirement, 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
|
+
/**
|
|
51
|
+
* Wrong-direction gates are ignored; unknown gates remain unsatisfied. Accepts
|
|
52
|
+
* requirements read off the wire, whose `kind` may be one this SDK does not know.
|
|
53
|
+
*/
|
|
54
|
+
export declare function evaluateOnboardingRequirements<R extends ObservedAgentOnboardingRequirement = AgentOnboardingRequirement>(requirements: readonly R[], direction: 'seller' | 'buyer', check: (requirement: R) => Promise<boolean>): Promise<{
|
|
55
|
+
satisfied: boolean;
|
|
56
|
+
unsatisfied: R[];
|
|
57
|
+
}>;
|
|
58
|
+
export declare function validateAgentOnboarding(posture: AgentOnboarding, account: {
|
|
59
|
+
sandbox?: boolean;
|
|
60
|
+
supported_billing?: readonly BillingParty[];
|
|
61
|
+
}, experimentalFeatures: readonly string[]): void;
|
|
62
|
+
export interface OriginIdentityLifecycleOptions {
|
|
63
|
+
store: OriginIdentityStore;
|
|
64
|
+
trust: TrustEvaluator;
|
|
65
|
+
now?: () => number;
|
|
66
|
+
/** Supply for open onboarding only. */
|
|
67
|
+
onboarding?: AgentOnboarding;
|
|
68
|
+
maxOpenPrincipalsPerOperator?: number;
|
|
69
|
+
checkRequirement?: (origin: string, requirement: AgentOnboardingRequirement) => Promise<boolean>;
|
|
70
|
+
hasBillingRelationship?: (billedPartyDomain: string, billing: BillingParty) => Promise<boolean>;
|
|
71
|
+
/** Publish only after the new application state is durable; duplicate notifications are allowed. */
|
|
72
|
+
notify?: (origin: string, reason: IdentityPrincipalChangedReason, notificationId: string) => Promise<void>;
|
|
73
|
+
/** Seller ledger lookup, required before automatic creation to prevent RFC principal splitting. */
|
|
74
|
+
lookupLegacyPrincipals?: (origin: string) => Promise<readonly string[]>;
|
|
75
|
+
}
|
|
76
|
+
export declare class OriginIdentityLifecycle {
|
|
77
|
+
private readonly options;
|
|
78
|
+
constructor(options: OriginIdentityLifecycleOptions);
|
|
79
|
+
/** Identity-established origins get no durable identifier. Reads never create. */
|
|
80
|
+
getPrincipal(originUrl: string): Promise<{
|
|
81
|
+
binding?: OriginBinding;
|
|
82
|
+
result: {
|
|
83
|
+
kind: 'unconfigured' | 'recognized';
|
|
84
|
+
principal_id?: string;
|
|
85
|
+
principal_kind?: PrincipalKind;
|
|
86
|
+
relationship?: PrincipalRelationship;
|
|
87
|
+
};
|
|
88
|
+
}>;
|
|
89
|
+
bindPrincipal(input: {
|
|
90
|
+
origin: string;
|
|
91
|
+
principalId: string;
|
|
92
|
+
approvedBy: string;
|
|
93
|
+
reason: string;
|
|
94
|
+
principalKind?: PrincipalKind;
|
|
95
|
+
existingRfcPrincipal?: boolean;
|
|
96
|
+
migrationApproved?: boolean;
|
|
97
|
+
sharedOrigin?: boolean;
|
|
98
|
+
}): Promise<OriginBinding>;
|
|
99
|
+
/**
|
|
100
|
+
* Cryptographic verification does not call this. Authorization revalidates
|
|
101
|
+
* delisting: the last record read does not list the origin (an empty
|
|
102
|
+
* `agents[]` retires it; a known delisting stays delisted through a failed
|
|
103
|
+
* refresh) and throws {@link TrustMembershipError}. An unreadable record
|
|
104
|
+
* (404/410 included) throws {@link TrustRecordUnavailableError} for spend;
|
|
105
|
+
* read-only and identity-configuration calls continue under the binding only
|
|
106
|
+
* while the last record read listed the origin and is within the evaluator's
|
|
107
|
+
* `maxOutageContinuationSeconds`.
|
|
108
|
+
*/
|
|
109
|
+
authorizeBound(originUrl: string, access?: {
|
|
110
|
+
readOnly?: true;
|
|
111
|
+
identityConfiguration?: true;
|
|
112
|
+
sandbox?: boolean;
|
|
113
|
+
billing?: BillingParty;
|
|
114
|
+
brandDomain?: string;
|
|
115
|
+
}): Promise<OriginBinding | undefined>;
|
|
116
|
+
/** Called by explicit sync_principal only; allocates new identities, never migrates existing ones. */
|
|
117
|
+
syncOpen(originUrl: string, options?: {
|
|
118
|
+
dryRun?: boolean;
|
|
119
|
+
}): Promise<OriginBinding>;
|
|
120
|
+
setRelationship(originUrl: string, relationship: PrincipalRelationship): Promise<void>;
|
|
121
|
+
notifyRelationshipExpiring(originUrl: string, leadSeconds: number): Promise<boolean>;
|
|
122
|
+
flushRelationshipNotifications(originUrl: string): Promise<void>;
|
|
123
|
+
assertLegacyAllowed(agentUrl: string): Promise<void>;
|
|
124
|
+
private now;
|
|
125
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import type { PrincipalKind } from '../server/principal/types';
|
|
2
|
+
import { TrustEvaluator } from './trust';
|
|
3
|
+
import type { AgentOnboarding, AgentOnboardingRequirement, ObservedAgentOnboardingRequirement, 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
|
+
/**
|
|
51
|
+
* Wrong-direction gates are ignored; unknown gates remain unsatisfied. Accepts
|
|
52
|
+
* requirements read off the wire, whose `kind` may be one this SDK does not know.
|
|
53
|
+
*/
|
|
54
|
+
export declare function evaluateOnboardingRequirements<R extends ObservedAgentOnboardingRequirement = AgentOnboardingRequirement>(requirements: readonly R[], direction: 'seller' | 'buyer', check: (requirement: R) => Promise<boolean>): Promise<{
|
|
55
|
+
satisfied: boolean;
|
|
56
|
+
unsatisfied: R[];
|
|
57
|
+
}>;
|
|
58
|
+
export declare function validateAgentOnboarding(posture: AgentOnboarding, account: {
|
|
59
|
+
sandbox?: boolean;
|
|
60
|
+
supported_billing?: readonly BillingParty[];
|
|
61
|
+
}, experimentalFeatures: readonly string[]): void;
|
|
62
|
+
export interface OriginIdentityLifecycleOptions {
|
|
63
|
+
store: OriginIdentityStore;
|
|
64
|
+
trust: TrustEvaluator;
|
|
65
|
+
now?: () => number;
|
|
66
|
+
/** Supply for open onboarding only. */
|
|
67
|
+
onboarding?: AgentOnboarding;
|
|
68
|
+
maxOpenPrincipalsPerOperator?: number;
|
|
69
|
+
checkRequirement?: (origin: string, requirement: AgentOnboardingRequirement) => Promise<boolean>;
|
|
70
|
+
hasBillingRelationship?: (billedPartyDomain: string, billing: BillingParty) => Promise<boolean>;
|
|
71
|
+
/** Publish only after the new application state is durable; duplicate notifications are allowed. */
|
|
72
|
+
notify?: (origin: string, reason: IdentityPrincipalChangedReason, notificationId: string) => Promise<void>;
|
|
73
|
+
/** Seller ledger lookup, required before automatic creation to prevent RFC principal splitting. */
|
|
74
|
+
lookupLegacyPrincipals?: (origin: string) => Promise<readonly string[]>;
|
|
75
|
+
}
|
|
76
|
+
export declare class OriginIdentityLifecycle {
|
|
77
|
+
private readonly options;
|
|
78
|
+
constructor(options: OriginIdentityLifecycleOptions);
|
|
79
|
+
/** Identity-established origins get no durable identifier. Reads never create. */
|
|
80
|
+
getPrincipal(originUrl: string): Promise<{
|
|
81
|
+
binding?: OriginBinding;
|
|
82
|
+
result: {
|
|
83
|
+
kind: 'unconfigured' | 'recognized';
|
|
84
|
+
principal_id?: string;
|
|
85
|
+
principal_kind?: PrincipalKind;
|
|
86
|
+
relationship?: PrincipalRelationship;
|
|
87
|
+
};
|
|
88
|
+
}>;
|
|
89
|
+
bindPrincipal(input: {
|
|
90
|
+
origin: string;
|
|
91
|
+
principalId: string;
|
|
92
|
+
approvedBy: string;
|
|
93
|
+
reason: string;
|
|
94
|
+
principalKind?: PrincipalKind;
|
|
95
|
+
existingRfcPrincipal?: boolean;
|
|
96
|
+
migrationApproved?: boolean;
|
|
97
|
+
sharedOrigin?: boolean;
|
|
98
|
+
}): Promise<OriginBinding>;
|
|
99
|
+
/**
|
|
100
|
+
* Cryptographic verification does not call this. Authorization revalidates
|
|
101
|
+
* delisting: the last record read does not list the origin (an empty
|
|
102
|
+
* `agents[]` retires it; a known delisting stays delisted through a failed
|
|
103
|
+
* refresh) and throws {@link TrustMembershipError}. An unreadable record
|
|
104
|
+
* (404/410 included) throws {@link TrustRecordUnavailableError} for spend;
|
|
105
|
+
* read-only and identity-configuration calls continue under the binding only
|
|
106
|
+
* while the last record read listed the origin and is within the evaluator's
|
|
107
|
+
* `maxOutageContinuationSeconds`.
|
|
108
|
+
*/
|
|
109
|
+
authorizeBound(originUrl: string, access?: {
|
|
110
|
+
readOnly?: true;
|
|
111
|
+
identityConfiguration?: true;
|
|
112
|
+
sandbox?: boolean;
|
|
113
|
+
billing?: BillingParty;
|
|
114
|
+
brandDomain?: string;
|
|
115
|
+
}): Promise<OriginBinding | undefined>;
|
|
116
|
+
/** Called by explicit sync_principal only; allocates new identities, never migrates existing ones. */
|
|
117
|
+
syncOpen(originUrl: string, options?: {
|
|
118
|
+
dryRun?: boolean;
|
|
119
|
+
}): Promise<OriginBinding>;
|
|
120
|
+
setRelationship(originUrl: string, relationship: PrincipalRelationship): Promise<void>;
|
|
121
|
+
notifyRelationshipExpiring(originUrl: string, leadSeconds: number): Promise<boolean>;
|
|
122
|
+
flushRelationshipNotifications(originUrl: string): Promise<void>;
|
|
123
|
+
assertLegacyAllowed(agentUrl: string): Promise<void>;
|
|
124
|
+
private now;
|
|
125
|
+
}
|