@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
|
@@ -1,4 +1,15 @@
|
|
|
1
|
+
import { getWebBotAuthLegacyOriginGate } from "../signing/web-bot-auth.mjs";
|
|
1
2
|
import { RequestSignatureError } from "../signing/errors.mjs";
|
|
3
|
+
import {
|
|
4
|
+
selectSignatureProfile,
|
|
5
|
+
verifyWebBotAuth,
|
|
6
|
+
isWebBotAuthRevocationChecked,
|
|
7
|
+
webBotAuthUnavailableResponse,
|
|
8
|
+
WebBotAuthUnavailableError,
|
|
9
|
+
deferWebBotAuthPrincipalFailure,
|
|
10
|
+
webBotAuthPrincipalFailureError,
|
|
11
|
+
WebBotAuthError
|
|
12
|
+
} from "../signing/web-bot-auth.mjs";
|
|
2
13
|
import { InMemoryReplayStore } from "../signing/replay.mjs";
|
|
3
14
|
import { InMemoryRevocationStore } from "../signing/revocation.mjs";
|
|
4
15
|
import {
|
|
@@ -23,6 +34,15 @@ import {
|
|
|
23
34
|
} from "./auth.mjs";
|
|
24
35
|
function verifySignatureAsAuthenticator(options) {
|
|
25
36
|
const replayStore = options.replayStore ?? new InMemoryReplayStore();
|
|
37
|
+
const legacyOriginGate = options.assertLegacyOriginAllowed ?? getWebBotAuthLegacyOriginGate(options.webBotAuth?.resolvePrincipal);
|
|
38
|
+
if (options.webBotAuth && !legacyOriginGate)
|
|
39
|
+
throw new TypeError(
|
|
40
|
+
"Web Bot Auth requires an origin-binding migration fence; use createIdentity33PrincipalResolver or supply assertLegacyOriginAllowed"
|
|
41
|
+
);
|
|
42
|
+
if (options.webBotAuth && !options.webBotAuth.isRevoked && !isWebBotAuthRevocationChecked(options.webBotAuth.resolvePrincipal))
|
|
43
|
+
throw new TypeError(
|
|
44
|
+
"Web Bot Auth requires origin revocation: use createIdentity33PrincipalResolver({ revocation }) or supply isRevoked"
|
|
45
|
+
);
|
|
26
46
|
const revocationStore = options.revocationStore ?? new InMemoryRevocationStore();
|
|
27
47
|
const authenticator = async (req) => {
|
|
28
48
|
if (!hasSignatureHeader(req)) return null;
|
|
@@ -36,6 +56,49 @@ function verifySignatureAsAuthenticator(options) {
|
|
|
36
56
|
};
|
|
37
57
|
let result;
|
|
38
58
|
try {
|
|
59
|
+
if (selectSignatureProfile(requestLike) === "web-bot-auth") {
|
|
60
|
+
if (!options.getUrl && !getServeRequestContext(req)?.publicUrl || !options.webBotAuth || !options.capability.profiles?.includes("web-bot-auth"))
|
|
61
|
+
throw new WebBotAuthError(403, "profile_disabled");
|
|
62
|
+
if (req.method !== "GET" && req.rawBody === void 0)
|
|
63
|
+
throw new WebBotAuthError(403, "raw_body_missing");
|
|
64
|
+
const signers = await verifyWebBotAuth(requestLike, {
|
|
65
|
+
directory: options.webBotAuth.directory,
|
|
66
|
+
replayStore,
|
|
67
|
+
now: options.now,
|
|
68
|
+
...options.webBotAuth.isRevoked && { isRevoked: options.webBotAuth.isRevoked }
|
|
69
|
+
});
|
|
70
|
+
const operation = options.resolveOperation(req);
|
|
71
|
+
let principal2;
|
|
72
|
+
let deferredFailure;
|
|
73
|
+
try {
|
|
74
|
+
principal2 = await options.webBotAuth.resolvePrincipal(signers, operation);
|
|
75
|
+
} catch (error) {
|
|
76
|
+
if (error instanceof WebBotAuthError || error instanceof WebBotAuthUnavailableError) throw error;
|
|
77
|
+
if (typeof operation !== "string") throw webBotAuthPrincipalFailureError(error);
|
|
78
|
+
const deferred = deferWebBotAuthPrincipalFailure(signers, error);
|
|
79
|
+
principal2 = { principal: deferred.principal };
|
|
80
|
+
deferredFailure = deferred.authorizationFailure;
|
|
81
|
+
}
|
|
82
|
+
const signer2 = signers[signers.length - 1];
|
|
83
|
+
req.verifiedSigner = {
|
|
84
|
+
keyid: signer2.keyid,
|
|
85
|
+
agent_url: signer2.origin,
|
|
86
|
+
verified_at: signer2.verified_at
|
|
87
|
+
};
|
|
88
|
+
const failed = signers.find((s) => s.authorizationFailure);
|
|
89
|
+
return {
|
|
90
|
+
...principal2,
|
|
91
|
+
extra: {
|
|
92
|
+
...principal2.extra,
|
|
93
|
+
webBotAuthAuthorization: {
|
|
94
|
+
signer: failed ?? signer2,
|
|
95
|
+
...(failed?.authorizationFailure ?? deferredFailure) && {
|
|
96
|
+
authorizationFailure: failed?.authorizationFailure ?? deferredFailure
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
}
|
|
39
102
|
result = await verifyRequestSignature(requestLike, {
|
|
40
103
|
capability: options.capability,
|
|
41
104
|
jwks: options.jwks,
|
|
@@ -46,7 +109,22 @@ function verifySignatureAsAuthenticator(options) {
|
|
|
46
109
|
operation: options.resolveOperation(req),
|
|
47
110
|
agentUrlForKeyid: options.agentUrlForKeyid
|
|
48
111
|
});
|
|
112
|
+
if (result.status === "verified" && legacyOriginGate) {
|
|
113
|
+
if (!result.agent_url)
|
|
114
|
+
throw new RequestSignatureError(
|
|
115
|
+
"request_signature_key_unknown",
|
|
116
|
+
7,
|
|
117
|
+
"Legacy signer must resolve an agent origin when migration fencing is enabled"
|
|
118
|
+
);
|
|
119
|
+
await legacyOriginGate(result.agent_url);
|
|
120
|
+
}
|
|
49
121
|
} catch (err) {
|
|
122
|
+
if (err instanceof WebBotAuthError)
|
|
123
|
+
throw new AuthError(err.message, { cause: err, status: err.status, headers: err.headers, body: err.body });
|
|
124
|
+
if (err instanceof WebBotAuthUnavailableError) {
|
|
125
|
+
const outage = webBotAuthUnavailableResponse();
|
|
126
|
+
throw new AuthError(err.message, { cause: err, ...outage });
|
|
127
|
+
}
|
|
50
128
|
if (err instanceof RequestSignatureError) {
|
|
51
129
|
throw new AuthError(`Signature rejected (${err.code}).`, { cause: err });
|
|
52
130
|
}
|
|
@@ -67,7 +145,8 @@ function verifySignatureAsAuthenticator(options) {
|
|
|
67
145
|
req.verifiedSigner = signer;
|
|
68
146
|
return principal;
|
|
69
147
|
};
|
|
70
|
-
|
|
148
|
+
const tagged = tagAuthenticatorNeedsRawBody(authenticator);
|
|
149
|
+
return options.webBotAuth ? tagAuthenticatorPresenceGated(tagged) : tagged;
|
|
71
150
|
}
|
|
72
151
|
function principalForVerifiedSigner(signer, makePrincipal) {
|
|
73
152
|
if (!SAFE_KEYID.test(signer.keyid)) {
|
|
@@ -194,7 +273,7 @@ function logUnresolvable(req) {
|
|
|
194
273
|
}
|
|
195
274
|
const SAFE_KEYID = /^[A-Za-z0-9._-]{1,256}$/;
|
|
196
275
|
function hasSignatureHeader(req) {
|
|
197
|
-
return nonEmptyHeader(req.headers["signature-input"]) || nonEmptyHeader(req.headers["signature"]);
|
|
276
|
+
return req.headers["signature-agent"] !== void 0 || nonEmptyHeader(req.headers["signature-input"]) || nonEmptyHeader(req.headers["signature"]);
|
|
198
277
|
}
|
|
199
278
|
function nonEmptyHeader(v) {
|
|
200
279
|
if (typeof v === "string") return v.length > 0;
|
|
@@ -145,8 +145,14 @@ export type Authenticator = (req: IncomingMessage) => AuthResult | Promise<AuthR
|
|
|
145
145
|
*/
|
|
146
146
|
export declare class AuthError extends Error {
|
|
147
147
|
readonly publicMessage: string;
|
|
148
|
+
readonly status?: 400 | 403 | 429 | 503;
|
|
149
|
+
readonly body?: Record<string, unknown>;
|
|
150
|
+
readonly headers?: Record<string, string>;
|
|
148
151
|
constructor(publicMessage: string, options?: {
|
|
149
152
|
cause?: unknown;
|
|
153
|
+
status?: 400 | 403 | 429 | 503;
|
|
154
|
+
headers?: Record<string, string>;
|
|
155
|
+
body?: Record<string, unknown>;
|
|
150
156
|
});
|
|
151
157
|
}
|
|
152
158
|
/**
|
|
@@ -145,8 +145,14 @@ export type Authenticator = (req: IncomingMessage) => AuthResult | Promise<AuthR
|
|
|
145
145
|
*/
|
|
146
146
|
export declare class AuthError extends Error {
|
|
147
147
|
readonly publicMessage: string;
|
|
148
|
+
readonly status?: 400 | 403 | 429 | 503;
|
|
149
|
+
readonly body?: Record<string, unknown>;
|
|
150
|
+
readonly headers?: Record<string, string>;
|
|
148
151
|
constructor(publicMessage: string, options?: {
|
|
149
152
|
cause?: unknown;
|
|
153
|
+
status?: 400 | 403 | 429 | 503;
|
|
154
|
+
headers?: Record<string, string>;
|
|
155
|
+
body?: Record<string, unknown>;
|
|
150
156
|
});
|
|
151
157
|
}
|
|
152
158
|
/**
|
package/dist/lib/server/auth.js
CHANGED
|
@@ -56,10 +56,16 @@ const DEFAULT_JWT_ALGORITHMS = Object.freeze([
|
|
|
56
56
|
const DEFAULT_JWT_CLOCK_TOLERANCE_SECONDS = 30;
|
|
57
57
|
class AuthError extends Error {
|
|
58
58
|
publicMessage;
|
|
59
|
+
status;
|
|
60
|
+
body;
|
|
61
|
+
headers;
|
|
59
62
|
constructor(publicMessage, options) {
|
|
60
63
|
super(publicMessage);
|
|
61
64
|
this.name = "AuthError";
|
|
62
65
|
this.publicMessage = publicMessage;
|
|
66
|
+
this.body = options?.body;
|
|
67
|
+
this.status = options?.status;
|
|
68
|
+
this.headers = options?.headers;
|
|
63
69
|
if (options?.cause !== void 0) this.cause = options.cause;
|
|
64
70
|
}
|
|
65
71
|
}
|
package/dist/lib/server/auth.mjs
CHANGED
|
@@ -17,10 +17,16 @@ const DEFAULT_JWT_ALGORITHMS = Object.freeze([
|
|
|
17
17
|
const DEFAULT_JWT_CLOCK_TOLERANCE_SECONDS = 30;
|
|
18
18
|
class AuthError extends Error {
|
|
19
19
|
publicMessage;
|
|
20
|
+
status;
|
|
21
|
+
body;
|
|
22
|
+
headers;
|
|
20
23
|
constructor(publicMessage, options) {
|
|
21
24
|
super(publicMessage);
|
|
22
25
|
this.name = "AuthError";
|
|
23
26
|
this.publicMessage = publicMessage;
|
|
27
|
+
this.body = options?.body;
|
|
28
|
+
this.status = options?.status;
|
|
29
|
+
this.headers = options?.headers;
|
|
24
30
|
if (options?.cause !== void 0) this.cause = options.cause;
|
|
25
31
|
}
|
|
26
32
|
}
|
|
@@ -795,7 +795,9 @@ export interface AdcpCapabilitiesConfig {
|
|
|
795
795
|
*/
|
|
796
796
|
supported_versions?: string[];
|
|
797
797
|
features?: Partial<MediaBuyFeatures>;
|
|
798
|
-
account?: Partial<AccountCapabilities
|
|
798
|
+
account?: Partial<AccountCapabilities> & {
|
|
799
|
+
agent_onboarding?: import('../identity-3.3/types.mjs').AgentOnboarding;
|
|
800
|
+
};
|
|
799
801
|
creative?: Partial<CreativeCapabilities>;
|
|
800
802
|
extensions_supported?: readonly string[];
|
|
801
803
|
/**
|
|
@@ -812,7 +814,9 @@ export interface AdcpCapabilitiesConfig {
|
|
|
812
814
|
* claim without a working verifier is graded as FAIL by the conformance
|
|
813
815
|
* runner (see `@adcp/sdk/testing/storyboard/request-signing`).
|
|
814
816
|
*/
|
|
815
|
-
request_signing?: NonNullable<GetAdCPCapabilitiesResponse['request_signing']
|
|
817
|
+
request_signing?: NonNullable<GetAdCPCapabilitiesResponse['request_signing']> & {
|
|
818
|
+
profiles?: ('adcp/request-signing/v1' | 'web-bot-auth')[];
|
|
819
|
+
};
|
|
816
820
|
/**
|
|
817
821
|
* Specialism claims the agent supports. Each entry maps to a storyboard
|
|
818
822
|
* bundle under `/compliance/{version}/specialisms/{id}/`; the AAO
|
|
@@ -884,9 +888,13 @@ export interface AdcpCapabilitiesOverrides {
|
|
|
884
888
|
experimental_features?: GetAdCPCapabilitiesResponse['experimental_features'] | null;
|
|
885
889
|
account?: Partial<NonNullable<GetAdCPCapabilitiesResponse['account']>> | null;
|
|
886
890
|
compliance_testing?: GetAdCPCapabilitiesResponse['compliance_testing'] | null;
|
|
887
|
-
webhook_signing?: GetAdCPCapabilitiesResponse['webhook_signing']
|
|
891
|
+
webhook_signing?: (NonNullable<GetAdCPCapabilitiesResponse['webhook_signing']> & {
|
|
892
|
+
profiles?: ('adcp/webhook-signing/v1' | 'web-bot-auth')[];
|
|
893
|
+
}) | null;
|
|
888
894
|
identity?: GetAdCPCapabilitiesResponse['identity'] | null;
|
|
889
|
-
request_signing?: GetAdCPCapabilitiesResponse['request_signing']
|
|
895
|
+
request_signing?: (NonNullable<GetAdCPCapabilitiesResponse['request_signing']> & {
|
|
896
|
+
profiles?: ('adcp/request-signing/v1' | 'web-bot-auth')[];
|
|
897
|
+
}) | null;
|
|
890
898
|
}
|
|
891
899
|
/**
|
|
892
900
|
* Inputs for the auto-wired RFC 9421 request-signature verifier. When set on
|
|
@@ -923,6 +931,8 @@ export interface AdcpCapabilitiesOverrides {
|
|
|
923
931
|
* abuse / replay-detection guards would be per-request (i.e. broken).
|
|
924
932
|
*/
|
|
925
933
|
export interface SignedRequestsConfig {
|
|
934
|
+
webBotAuth?: import('./auth-signature.mjs').VerifySignatureAsAuthenticatorOptions['webBotAuth'];
|
|
935
|
+
assertLegacyOriginAllowed?: (agentUrl: string) => Promise<void>;
|
|
926
936
|
/** Resolves verification keys by `keyid`. */
|
|
927
937
|
jwks: JwksResolver;
|
|
928
938
|
/** Stores `(keyid, signature-bytes, expires)` tuples for replay detection. */
|
|
@@ -1176,7 +1186,7 @@ export interface AdcpCustomToolConfig<InputArgs extends undefined | ZodRawShapeC
|
|
|
1176
1186
|
*
|
|
1177
1187
|
* @public
|
|
1178
1188
|
*/
|
|
1179
|
-
export type WebhooksConfig = Pick<WebhookEmitterOptions, 'signerKey' | 'signerProvider' | 'retries' | 'deliveryStore' | 'idempotencyKeyStore' | 'deliveryRetryHorizonSeconds' | 'deliveryRecovery' | 'generateIdempotencyKey' | 'authorizeAttempt' | 'fetch' | 'userAgent' | 'tag'> & {
|
|
1189
|
+
export type WebhooksConfig = Pick<WebhookEmitterOptions, 'signerKey' | 'signerProvider' | 'webBotAuth' | 'signingProfile' | 'retries' | 'deliveryStore' | 'idempotencyKeyStore' | 'deliveryRetryHorizonSeconds' | 'deliveryRecovery' | 'generateIdempotencyKey' | 'authorizeAttempt' | 'fetch' | 'userAgent' | 'tag'> & {
|
|
1180
1190
|
/** Stable publisher namespace for shared delivery-store keys. Defaults to the trusted server name. */
|
|
1181
1191
|
publisherScope?: string;
|
|
1182
1192
|
/** Trusted fallback namespace for a genuinely single-tenant server. */
|
|
@@ -1189,6 +1199,10 @@ export type WebhooksConfig = Pick<WebhookEmitterOptions, 'signerKey' | 'signerPr
|
|
|
1189
1199
|
onAttemptObserverError?: WebhookEmitterOptions['onAttemptObserverError'];
|
|
1190
1200
|
};
|
|
1191
1201
|
export interface AdcpServerConfig<TAccount = unknown> {
|
|
1202
|
+
/** Experimental 3.3 authorization, invoked before idempotency and handler side effects. */
|
|
1203
|
+
identity33?: {
|
|
1204
|
+
authorize: (ctx: HandlerContext<TAccount>, tool: string, params: unknown) => Promise<void>;
|
|
1205
|
+
};
|
|
1192
1206
|
name: string;
|
|
1193
1207
|
version: string;
|
|
1194
1208
|
/**
|
|
@@ -795,7 +795,9 @@ export interface AdcpCapabilitiesConfig {
|
|
|
795
795
|
*/
|
|
796
796
|
supported_versions?: string[];
|
|
797
797
|
features?: Partial<MediaBuyFeatures>;
|
|
798
|
-
account?: Partial<AccountCapabilities
|
|
798
|
+
account?: Partial<AccountCapabilities> & {
|
|
799
|
+
agent_onboarding?: import('../identity-3.3/types').AgentOnboarding;
|
|
800
|
+
};
|
|
799
801
|
creative?: Partial<CreativeCapabilities>;
|
|
800
802
|
extensions_supported?: readonly string[];
|
|
801
803
|
/**
|
|
@@ -812,7 +814,9 @@ export interface AdcpCapabilitiesConfig {
|
|
|
812
814
|
* claim without a working verifier is graded as FAIL by the conformance
|
|
813
815
|
* runner (see `@adcp/sdk/testing/storyboard/request-signing`).
|
|
814
816
|
*/
|
|
815
|
-
request_signing?: NonNullable<GetAdCPCapabilitiesResponse['request_signing']
|
|
817
|
+
request_signing?: NonNullable<GetAdCPCapabilitiesResponse['request_signing']> & {
|
|
818
|
+
profiles?: ('adcp/request-signing/v1' | 'web-bot-auth')[];
|
|
819
|
+
};
|
|
816
820
|
/**
|
|
817
821
|
* Specialism claims the agent supports. Each entry maps to a storyboard
|
|
818
822
|
* bundle under `/compliance/{version}/specialisms/{id}/`; the AAO
|
|
@@ -884,9 +888,13 @@ export interface AdcpCapabilitiesOverrides {
|
|
|
884
888
|
experimental_features?: GetAdCPCapabilitiesResponse['experimental_features'] | null;
|
|
885
889
|
account?: Partial<NonNullable<GetAdCPCapabilitiesResponse['account']>> | null;
|
|
886
890
|
compliance_testing?: GetAdCPCapabilitiesResponse['compliance_testing'] | null;
|
|
887
|
-
webhook_signing?: GetAdCPCapabilitiesResponse['webhook_signing']
|
|
891
|
+
webhook_signing?: (NonNullable<GetAdCPCapabilitiesResponse['webhook_signing']> & {
|
|
892
|
+
profiles?: ('adcp/webhook-signing/v1' | 'web-bot-auth')[];
|
|
893
|
+
}) | null;
|
|
888
894
|
identity?: GetAdCPCapabilitiesResponse['identity'] | null;
|
|
889
|
-
request_signing?: GetAdCPCapabilitiesResponse['request_signing']
|
|
895
|
+
request_signing?: (NonNullable<GetAdCPCapabilitiesResponse['request_signing']> & {
|
|
896
|
+
profiles?: ('adcp/request-signing/v1' | 'web-bot-auth')[];
|
|
897
|
+
}) | null;
|
|
890
898
|
}
|
|
891
899
|
/**
|
|
892
900
|
* Inputs for the auto-wired RFC 9421 request-signature verifier. When set on
|
|
@@ -923,6 +931,8 @@ export interface AdcpCapabilitiesOverrides {
|
|
|
923
931
|
* abuse / replay-detection guards would be per-request (i.e. broken).
|
|
924
932
|
*/
|
|
925
933
|
export interface SignedRequestsConfig {
|
|
934
|
+
webBotAuth?: import('./auth-signature').VerifySignatureAsAuthenticatorOptions['webBotAuth'];
|
|
935
|
+
assertLegacyOriginAllowed?: (agentUrl: string) => Promise<void>;
|
|
926
936
|
/** Resolves verification keys by `keyid`. */
|
|
927
937
|
jwks: JwksResolver;
|
|
928
938
|
/** Stores `(keyid, signature-bytes, expires)` tuples for replay detection. */
|
|
@@ -1176,7 +1186,7 @@ export interface AdcpCustomToolConfig<InputArgs extends undefined | ZodRawShapeC
|
|
|
1176
1186
|
*
|
|
1177
1187
|
* @public
|
|
1178
1188
|
*/
|
|
1179
|
-
export type WebhooksConfig = Pick<WebhookEmitterOptions, 'signerKey' | 'signerProvider' | 'retries' | 'deliveryStore' | 'idempotencyKeyStore' | 'deliveryRetryHorizonSeconds' | 'deliveryRecovery' | 'generateIdempotencyKey' | 'authorizeAttempt' | 'fetch' | 'userAgent' | 'tag'> & {
|
|
1189
|
+
export type WebhooksConfig = Pick<WebhookEmitterOptions, 'signerKey' | 'signerProvider' | 'webBotAuth' | 'signingProfile' | 'retries' | 'deliveryStore' | 'idempotencyKeyStore' | 'deliveryRetryHorizonSeconds' | 'deliveryRecovery' | 'generateIdempotencyKey' | 'authorizeAttempt' | 'fetch' | 'userAgent' | 'tag'> & {
|
|
1180
1190
|
/** Stable publisher namespace for shared delivery-store keys. Defaults to the trusted server name. */
|
|
1181
1191
|
publisherScope?: string;
|
|
1182
1192
|
/** Trusted fallback namespace for a genuinely single-tenant server. */
|
|
@@ -1189,6 +1199,10 @@ export type WebhooksConfig = Pick<WebhookEmitterOptions, 'signerKey' | 'signerPr
|
|
|
1189
1199
|
onAttemptObserverError?: WebhookEmitterOptions['onAttemptObserverError'];
|
|
1190
1200
|
};
|
|
1191
1201
|
export interface AdcpServerConfig<TAccount = unknown> {
|
|
1202
|
+
/** Experimental 3.3 authorization, invoked before idempotency and handler side effects. */
|
|
1203
|
+
identity33?: {
|
|
1204
|
+
authorize: (ctx: HandlerContext<TAccount>, tool: string, params: unknown) => Promise<void>;
|
|
1205
|
+
};
|
|
1192
1206
|
name: string;
|
|
1193
1207
|
version: string;
|
|
1194
1208
|
/**
|