@adcp/sdk 14.0.0 → 14.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/adapters/implicit-account-store.d.mts +12 -7
- package/dist/lib/adapters/implicit-account-store.d.ts +12 -7
- package/dist/lib/adapters/implicit-account-store.js +69 -15
- package/dist/lib/adapters/implicit-account-store.mjs +69 -15
- package/dist/lib/core/AgentClient.d.mts +1 -0
- package/dist/lib/core/AgentClient.d.ts +1 -0
- package/dist/lib/core/AgentClient.js +3 -0
- package/dist/lib/core/AgentClient.mjs +3 -0
- package/dist/lib/core/SingleAgentClient.d.mts +35 -2
- package/dist/lib/core/SingleAgentClient.d.ts +35 -2
- package/dist/lib/core/SingleAgentClient.js +377 -36
- package/dist/lib/core/SingleAgentClient.mjs +387 -38
- package/dist/lib/core/TaskExecutor.d.mts +3 -1
- package/dist/lib/core/TaskExecutor.d.ts +3 -1
- package/dist/lib/core/TaskExecutor.js +17 -12
- package/dist/lib/core/TaskExecutor.mjs +17 -12
- package/dist/lib/core/account-key.d.mts +3 -0
- package/dist/lib/core/account-key.d.ts +3 -0
- package/dist/lib/core/account-key.js +41 -0
- package/dist/lib/core/account-key.mjs +17 -0
- package/dist/lib/core/account-resolution.d.mts +2 -0
- package/dist/lib/core/account-resolution.d.ts +2 -0
- package/dist/lib/core/buyer-account-registry.d.mts +93 -0
- package/dist/lib/core/buyer-account-registry.d.ts +93 -0
- package/dist/lib/core/buyer-account-registry.js +602 -0
- package/dist/lib/core/buyer-account-registry.mjs +578 -0
- package/dist/lib/core/product-cache.d.mts +18 -0
- package/dist/lib/core/product-cache.d.ts +18 -0
- package/dist/lib/core/product-cache.js +137 -0
- package/dist/lib/core/product-cache.mjs +112 -0
- package/dist/lib/errors/index.d.mts +40 -1
- package/dist/lib/errors/index.d.ts +40 -1
- package/dist/lib/errors/index.js +69 -3
- package/dist/lib/errors/index.mjs +64 -3
- package/dist/lib/governance/authorization.d.mts +17 -1
- package/dist/lib/governance/authorization.d.ts +17 -1
- package/dist/lib/governance/authorization.js +55 -7
- package/dist/lib/governance/authorization.mjs +59 -7
- package/dist/lib/governance/index.d.mts +2 -2
- package/dist/lib/governance/index.d.ts +2 -2
- package/dist/lib/governance/index.js +2 -0
- package/dist/lib/governance/index.mjs +3 -1
- package/dist/lib/index.d.mts +7 -4
- package/dist/lib/index.d.ts +7 -4
- package/dist/lib/index.js +29 -0
- package/dist/lib/index.mjs +31 -1
- package/dist/lib/net/agent-transport-fetch.d.mts +4 -0
- package/dist/lib/net/agent-transport-fetch.d.ts +4 -0
- package/dist/lib/net/agent-transport-fetch.js +18 -5
- package/dist/lib/net/agent-transport-fetch.mjs +17 -5
- package/dist/lib/protocols/a2a.js +9 -1
- package/dist/lib/protocols/a2a.mjs +9 -1
- package/dist/lib/protocols/index.js +9 -2
- package/dist/lib/protocols/index.mjs +9 -2
- package/dist/lib/protocols/mcp-modern.js +2 -1
- package/dist/lib/protocols/mcp-modern.mjs +2 -1
- package/dist/lib/protocols/mcp.js +5 -2
- package/dist/lib/protocols/mcp.mjs +5 -2
- package/dist/lib/protocols/rawResponseCapture.d.mts +6 -0
- package/dist/lib/protocols/rawResponseCapture.d.ts +6 -0
- package/dist/lib/protocols/rawResponseCapture.js +41 -29
- package/dist/lib/protocols/rawResponseCapture.mjs +40 -29
- package/dist/lib/protocols/signedRequestRejection.d.mts +9 -0
- package/dist/lib/protocols/signedRequestRejection.d.ts +9 -0
- package/dist/lib/protocols/signedRequestRejection.js +209 -0
- package/dist/lib/protocols/signedRequestRejection.mjs +189 -0
- package/dist/lib/protocols/transportDiagnostics.d.mts +1 -0
- package/dist/lib/protocols/transportDiagnostics.d.ts +1 -0
- package/dist/lib/protocols/transportDiagnostics.js +2 -0
- package/dist/lib/protocols/transportDiagnostics.mjs +1 -0
- package/dist/lib/registry/types.generated.d.mts +112 -45
- package/dist/lib/registry/types.generated.d.ts +112 -45
- package/dist/lib/schemas-data/v2.5/_provenance.json +1 -1
- package/dist/lib/server/account-provisioning.d.mts +2 -0
- package/dist/lib/server/account-provisioning.d.ts +2 -0
- package/dist/lib/server/account-provisioning.js +30 -0
- package/dist/lib/server/account-provisioning.mjs +6 -0
- package/dist/lib/server/account-reference-warnings.d.mts +12 -0
- package/dist/lib/server/account-reference-warnings.d.ts +12 -0
- package/dist/lib/server/account-reference-warnings.js +48 -0
- package/dist/lib/server/account-reference-warnings.mjs +23 -0
- package/dist/lib/server/auth-signature.js +1 -0
- package/dist/lib/server/auth-signature.mjs +1 -0
- package/dist/lib/server/create-adcp-server.d.mts +34 -0
- package/dist/lib/server/create-adcp-server.d.ts +34 -0
- package/dist/lib/server/create-adcp-server.js +225 -14
- package/dist/lib/server/create-adcp-server.mjs +225 -14
- package/dist/lib/server/decisioning/account.d.mts +2 -0
- package/dist/lib/server/decisioning/account.d.ts +2 -0
- package/dist/lib/server/decisioning/runtime/from-platform.js +49 -10
- package/dist/lib/server/decisioning/runtime/from-platform.mjs +49 -10
- package/dist/lib/server/index.d.mts +2 -2
- package/dist/lib/server/index.d.ts +2 -2
- package/dist/lib/server/index.js +2 -0
- package/dist/lib/server/index.mjs +3 -1
- package/dist/lib/signing/agent-resolver/consistency.d.mts +6 -13
- package/dist/lib/signing/agent-resolver/consistency.d.ts +6 -13
- package/dist/lib/signing/agent-resolver/consistency.js +0 -1
- package/dist/lib/signing/agent-resolver/consistency.mjs +0 -1
- package/dist/lib/signing/agent-resolver/errors.d.mts +3 -1
- package/dist/lib/signing/agent-resolver/errors.d.ts +3 -1
- package/dist/lib/signing/agent-resolver/errors.js +6 -0
- package/dist/lib/signing/agent-resolver/errors.mjs +6 -0
- package/dist/lib/signing/agent-resolver/fetch-helpers.d.mts +11 -0
- package/dist/lib/signing/agent-resolver/fetch-helpers.d.ts +11 -0
- package/dist/lib/signing/agent-resolver/fetch-helpers.js +37 -2
- package/dist/lib/signing/agent-resolver/fetch-helpers.mjs +40 -3
- package/dist/lib/signing/agent-resolver/jwks-set.js +24 -3
- package/dist/lib/signing/agent-resolver/jwks-set.mjs +24 -3
- package/dist/lib/signing/agent-resolver/legacy-brand.d.mts +15 -0
- package/dist/lib/signing/agent-resolver/legacy-brand.d.ts +15 -0
- package/dist/lib/signing/agent-resolver/legacy-brand.js +60 -0
- package/dist/lib/signing/agent-resolver/legacy-brand.mjs +36 -0
- package/dist/lib/signing/agent-resolver/operator-authorization.d.mts +13 -0
- package/dist/lib/signing/agent-resolver/operator-authorization.d.ts +13 -0
- package/dist/lib/signing/agent-resolver/operator-authorization.js +108 -0
- package/dist/lib/signing/agent-resolver/operator-authorization.mjs +84 -0
- package/dist/lib/signing/agent-resolver/resolve-agent.d.mts +14 -4
- package/dist/lib/signing/agent-resolver/resolve-agent.d.ts +14 -4
- package/dist/lib/signing/agent-resolver/resolve-agent.js +148 -137
- package/dist/lib/signing/agent-resolver/resolve-agent.mjs +157 -139
- package/dist/lib/signing/agent-resolver/resolved-agent-jwks.d.mts +7 -1
- package/dist/lib/signing/agent-resolver/resolved-agent-jwks.d.ts +7 -1
- package/dist/lib/signing/agent-resolver/resolved-agent-jwks.js +50 -17
- package/dist/lib/signing/agent-resolver/resolved-agent-jwks.mjs +50 -17
- package/dist/lib/signing/agent-resolver/select-agent.d.mts +14 -15
- package/dist/lib/signing/agent-resolver/select-agent.d.ts +14 -15
- package/dist/lib/signing/agent-resolver/select-agent.js +98 -13
- package/dist/lib/signing/agent-resolver/select-agent.mjs +95 -13
- package/dist/lib/signing/brand-jwks.d.mts +29 -75
- package/dist/lib/signing/brand-jwks.d.ts +29 -75
- package/dist/lib/signing/brand-jwks.js +120 -182
- package/dist/lib/signing/brand-jwks.mjs +120 -182
- package/dist/lib/signing/errors.d.mts +7 -3
- package/dist/lib/signing/errors.d.ts +7 -3
- package/dist/lib/signing/errors.js +7 -2
- package/dist/lib/signing/errors.mjs +7 -2
- package/dist/lib/signing/jwks-https.d.mts +7 -0
- package/dist/lib/signing/jwks-https.d.ts +7 -0
- package/dist/lib/signing/jwks-https.js +31 -8
- package/dist/lib/signing/jwks-https.mjs +31 -8
- package/dist/lib/signing/jwks.d.mts +8 -0
- package/dist/lib/signing/jwks.d.ts +8 -0
- package/dist/lib/signing/middleware.js +2 -1
- package/dist/lib/signing/middleware.mjs +2 -1
- package/dist/lib/signing/publisher-pins.d.mts +11 -0
- package/dist/lib/signing/publisher-pins.d.ts +11 -0
- package/dist/lib/signing/publisher-pins.js +125 -0
- package/dist/lib/signing/publisher-pins.mjs +101 -0
- package/dist/lib/signing/server.d.mts +1 -0
- package/dist/lib/signing/server.d.ts +1 -0
- package/dist/lib/signing/types.d.mts +5 -0
- package/dist/lib/signing/types.d.ts +5 -0
- package/dist/lib/signing/verifier.js +50 -5
- package/dist/lib/signing/verifier.mjs +50 -5
- package/dist/lib/signing/webhook-verifier.d.mts +7 -2
- package/dist/lib/signing/webhook-verifier.d.ts +7 -2
- package/dist/lib/signing/webhook-verifier.js +42 -2
- package/dist/lib/signing/webhook-verifier.mjs +42 -2
- package/dist/lib/testing/storyboard/account-policy.d.mts +2 -0
- package/dist/lib/testing/storyboard/account-policy.d.ts +2 -0
- package/dist/lib/testing/storyboard/account-policy.js +35 -0
- package/dist/lib/testing/storyboard/account-policy.mjs +11 -0
- package/dist/lib/testing/storyboard/context.js +6 -0
- package/dist/lib/testing/storyboard/context.mjs +6 -0
- package/dist/lib/testing/storyboard/request-builder.js +12 -2
- package/dist/lib/testing/storyboard/request-builder.mjs +12 -2
- package/dist/lib/testing/storyboard/runner.js +3 -2
- package/dist/lib/testing/storyboard/runner.mjs +3 -2
- package/dist/lib/testing/storyboard/validations.d.mts +1 -1
- package/dist/lib/testing/storyboard/validations.d.ts +1 -1
- package/dist/lib/types/accept-proposal.d.ts +19 -1
- package/dist/lib/types/buy-products.d.ts +19 -1
- package/dist/lib/types/check-governance.d.ts +19 -1
- package/dist/lib/types/comply-test-controller.d.ts +19 -1
- package/dist/lib/types/control-media-buy.d.ts +19 -1
- package/dist/lib/types/core.generated.d.mts +14 -1
- package/dist/lib/types/core.generated.d.ts +14 -1
- package/dist/lib/types/create-media-buy.d.ts +14 -1
- package/dist/lib/types/get-media-buys.d.ts +14 -1
- package/dist/lib/types/get-products.d.ts +19 -1
- package/dist/lib/types/list-products.d.ts +19 -1
- package/dist/lib/types/refine-proposals.d.ts +19 -1
- package/dist/lib/types/request-proposals.d.ts +19 -1
- package/dist/lib/types/schemas.generated.d.ts +12 -3
- package/dist/lib/types/schemas.generated.js +4 -1
- package/dist/lib/types/schemas.generated.mjs +4 -1
- package/dist/lib/types/tools.generated.d.mts +14 -1
- package/dist/lib/types/tools.generated.d.ts +14 -1
- package/dist/lib/types/update-media-buy.d.ts +14 -1
- 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/dist/lib/webhooks/index.d.mts +24 -0
- package/dist/lib/webhooks/index.d.ts +24 -0
- package/dist/lib/webhooks/index.js +50 -24
- package/dist/lib/webhooks/index.mjs +49 -24
- package/dist/lib/wholesale-feed-sync/index.d.mts +2 -0
- package/dist/lib/wholesale-feed-sync/index.d.ts +2 -0
- package/dist/lib/wholesale-feed-sync/index.js +7 -0
- package/dist/lib/wholesale-feed-sync/index.mjs +4 -0
- package/dist/lib/wholesale-feed-sync/mirror.d.mts +97 -0
- package/dist/lib/wholesale-feed-sync/mirror.d.ts +97 -0
- package/dist/lib/wholesale-feed-sync/mirror.js +350 -0
- package/dist/lib/wholesale-feed-sync/mirror.mjs +322 -0
- package/dist/lib/wholesale-feed-sync/sync.d.mts +13 -29
- package/dist/lib/wholesale-feed-sync/sync.d.ts +13 -29
- package/dist/lib/wholesale-feed-sync/sync.js +208 -281
- package/dist/lib/wholesale-feed-sync/sync.mjs +213 -281
- package/dist/lib/wholesale-feed-sync/types.d.mts +4 -3
- package/dist/lib/wholesale-feed-sync/types.d.ts +4 -3
- package/docs/README.md +6 -0
- package/docs/TYPE-SUMMARY.md +2 -2
- package/docs/guides/BUILD-AN-AGENT.md +2 -2
- package/docs/guides/BUYER-QUICKSTART-3.2.md +2 -0
- package/docs/guides/BUYER-STORAGE.md +3 -0
- package/docs/guides/FIRST-CALL-TO-A-SELLER.md +106 -0
- package/docs/guides/SIGNING-GUIDE.md +16 -7
- package/docs/guides/account-resolution.md +132 -10
- package/docs/llms.txt +3 -2
- package/docs/migration-14.0-to-14.1.md +85 -0
- package/docs/migration-14.x-rc-worksheet.md +4 -4
- package/docs/migration-4.x-to-5.x.md +1 -0
- package/docs/migration-agent-resolution-3.3.md +125 -0
- package/docs/recipes/verifying-inbound-webhooks.md +60 -15
- package/package.json +3 -2
- package/skills/adcp-brand.previous/SKILL.md +0 -200
- package/skills/adcp-creative.previous/SKILL.md +0 -305
- package/skills/adcp-governance.previous/SKILL.md +0 -566
- package/skills/adcp-measurement.previous/SKILL.md +0 -136
- package/skills/adcp-media-buy.previous/SKILL.md +0 -556
- package/skills/adcp-si.previous/SKILL.md +0 -206
- package/skills/adcp-signals.previous/SKILL.md +0 -204
|
@@ -1,32 +1,10 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Receiver-side ergonomic: resolve a sender's JWKS by fetching their
|
|
3
|
-
* `brand.json`, extracting the `jwks_uri` for the agent whose webhooks we're
|
|
4
|
-
* verifying, and delegating to {@link HttpsJwksResolver}.
|
|
5
|
-
*
|
|
6
|
-
* Hand the resulting instance to `verifyWebhookSignature.jwks` (or
|
|
7
|
-
* `verifyRequestSignature.jwks`) and the receiver never has to know where the
|
|
8
|
-
* sender hosts their keys — brand.json is the single source of truth.
|
|
9
|
-
*
|
|
10
|
-
* Follows the two documented redirect variants of `brand.json`
|
|
11
|
-
* (`authoritative_location` and `house`) up to a caller-configurable hop
|
|
12
|
-
* depth. When the selected agent has no `jwks_uri`, falls back to
|
|
13
|
-
* `/.well-known/jwks.json` on the origin of the agent's `url` — but only
|
|
14
|
-
* when that origin matches the final brand.json origin. The spec's
|
|
15
|
-
* well-known fallback exists so publishers hosting brand.json and their
|
|
16
|
-
* agents on the same origin can skip the explicit `jwks_uri`; accepting a
|
|
17
|
-
* cross-origin fallback would let an attacker pivot the trust anchor to a
|
|
18
|
-
* controlled host with a permissive JWKS.
|
|
19
|
-
*
|
|
20
|
-
* Caching is stacked with the inner {@link HttpsJwksResolver}: brand.json
|
|
21
|
-
* honors its own `Cache-Control`/`ETag` (bounded by `maxAgeSeconds`), and
|
|
22
|
-
* unknown-kid refreshes cascade — first to the JWKS endpoint, then (if the
|
|
23
|
-
* JWKS still doesn't have the kid and the brand.json cooldown has elapsed) to
|
|
24
|
-
* brand.json itself, in case the sender rotated `jwks_uri`.
|
|
25
|
-
*/
|
|
1
|
+
/** Capability-confirmed sender key discovery and SSRF-safe brand.json fetching. */
|
|
26
2
|
import { type SsrfDnsLookup } from '../net/index.mjs';
|
|
27
3
|
import type { JwksResolver } from './jwks.mjs';
|
|
28
4
|
import { type HttpsJwksResolverOptions } from './jwks-https.mjs';
|
|
29
5
|
import type { AdcpJsonWebKey } from './types.mjs';
|
|
6
|
+
import type { AgentProtocol, FetchCapabilitiesFn } from './agent-resolver/resolve-agent.mjs';
|
|
7
|
+
import type { JwksResolution } from './jwks.mjs';
|
|
30
8
|
export type BrandAgentType = 'brand' | 'rights' | 'measurement' | 'governance' | 'creative' | 'sales' | 'buying' | 'signals';
|
|
31
9
|
export type BrandJsonResolverErrorCode = 'invalid_url' | 'invalid_house' | 'redirect_loop' | 'redirect_depth_exceeded' | 'fetch_failed' | 'invalid_body' | 'schema_invalid' | 'agent_not_found' | 'agent_ambiguous' | 'jwks_origin_mismatch';
|
|
32
10
|
/**
|
|
@@ -36,6 +14,7 @@ export type BrandJsonResolverErrorCode = 'invalid_url' | 'invalid_house' | 'redi
|
|
|
36
14
|
*/
|
|
37
15
|
export declare class BrandJsonResolverError extends Error {
|
|
38
16
|
readonly code: BrandJsonResolverErrorCode;
|
|
17
|
+
readonly recovery: 'terminal' | 'transient';
|
|
39
18
|
readonly cause?: unknown;
|
|
40
19
|
/** HTTP status for `fetch_failed` responses, when a response was received. */
|
|
41
20
|
readonly httpStatus?: number;
|
|
@@ -45,21 +24,20 @@ export declare class BrandJsonResolverError extends Error {
|
|
|
45
24
|
});
|
|
46
25
|
}
|
|
47
26
|
export interface BrandJsonJwksResolverOptions {
|
|
27
|
+
/** Expected agent URL. Prefer supplying it; legacy configurations infer one onboarding URL, then confirm it through capabilities and canonical matching. */
|
|
28
|
+
agentUrl?: string;
|
|
29
|
+
/** Capabilities transport. Defaults to MCP; A2A integrations must set 'a2a'. */
|
|
30
|
+
protocol?: AgentProtocol;
|
|
31
|
+
/** Enable the 3.x webhook-only domain-derived fallback. Default true. Request verification refuses these keys. */
|
|
32
|
+
legacyWebhookFallback?: boolean;
|
|
33
|
+
fetchCapabilities?: FetchCapabilitiesFn;
|
|
48
34
|
/** Functional role of the agent whose keys we want to resolve. */
|
|
49
35
|
agentType: BrandAgentType;
|
|
50
36
|
/**
|
|
51
|
-
* Agent id from `agents[].id
|
|
52
|
-
* one agent of the requested type (otherwise the selector is ambiguous).
|
|
53
|
-
* Optional when the type is unique.
|
|
37
|
+
* Agent id from `agents[].id`, used only to narrow canonical URL matches.
|
|
54
38
|
*/
|
|
55
39
|
agentId?: string;
|
|
56
|
-
/**
|
|
57
|
-
* Brand id within a house portfolio (`brands[].id`). When omitted on a
|
|
58
|
-
* portfolio brand.json, the resolver looks at `house.agents[]`. When set,
|
|
59
|
-
* the resolver looks at `brands[brandId].agents[]` first and falls back to
|
|
60
|
-
* `house.agents[]` if no agent of the requested type is declared on the
|
|
61
|
-
* brand itself.
|
|
62
|
-
*/
|
|
40
|
+
/** @deprecated Used only to infer an onboarding URL when agentUrl is absent. Canonical verification searches all operator collections. */
|
|
63
41
|
brandId?: string;
|
|
64
42
|
/**
|
|
65
43
|
* Minimum seconds between brand.json refetches. Mirrors the JWKS cooldown
|
|
@@ -73,11 +51,7 @@ export interface BrandJsonJwksResolverOptions {
|
|
|
73
51
|
* allow longer. Default 3600s (1 hour).
|
|
74
52
|
*/
|
|
75
53
|
maxAgeSeconds?: number;
|
|
76
|
-
/**
|
|
77
|
-
* Maximum redirect hops to follow through `authoritative_location` /
|
|
78
|
-
* `house` variants. Default 3 — enough for `authoritative_location → house
|
|
79
|
-
* → portfolio` without inviting loops.
|
|
80
|
-
*/
|
|
54
|
+
/** @deprecated Only controls legacy onboarding indirection. Explicit capability URLs allow no redirects; webhook fallback allows one document hop. */
|
|
81
55
|
maxRedirects?: number;
|
|
82
56
|
/**
|
|
83
57
|
* Allow `http://` / private-IP brand.json and JWKS URLs (dev loops only).
|
|
@@ -90,52 +64,30 @@ export interface BrandJsonJwksResolverOptions {
|
|
|
90
64
|
* address remains subject to SSRF classification and connection pinning.
|
|
91
65
|
*/
|
|
92
66
|
lookup?: SsrfDnsLookup;
|
|
93
|
-
/**
|
|
94
|
-
* Forwarded to the inner {@link HttpsJwksResolver} constructor.
|
|
95
|
-
* `allowPrivateIp`, `lookup`, and `now` are set from the outer options and
|
|
96
|
-
* should not be passed here.
|
|
97
|
-
*/
|
|
67
|
+
/** Existing settings remain accepted. maxAgeSeconds/minCooldownSeconds configure caching; protocol floors and fail-closed behavior replace other settings. */
|
|
98
68
|
jwksOptions?: Omit<HttpsJwksResolverOptions, 'allowPrivateIp' | 'lookup' | 'now'>;
|
|
99
69
|
/** Clock override for deterministic tests. Returns epoch seconds. */
|
|
100
70
|
now?: () => number;
|
|
101
71
|
}
|
|
102
72
|
/**
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
* the
|
|
73
|
+
* Confirmed operator mapping. The supplied brand.json URL must agree with
|
|
74
|
+
* capabilities on every cache refresh. Prefer ResolvedAgentJwksResolver
|
|
75
|
+
* when the application's onboarding record holds only the seller URL.
|
|
106
76
|
*/
|
|
107
77
|
export declare class BrandJsonJwksResolver implements JwksResolver {
|
|
108
|
-
private readonly
|
|
109
|
-
private readonly
|
|
110
|
-
private
|
|
111
|
-
private
|
|
112
|
-
private
|
|
113
|
-
private
|
|
114
|
-
private readonly lookup;
|
|
115
|
-
private readonly jwksOptions;
|
|
116
|
-
private readonly now;
|
|
117
|
-
private snapshot;
|
|
118
|
-
private inner;
|
|
119
|
-
private inFlight;
|
|
78
|
+
private readonly brandJsonUrl;
|
|
79
|
+
private readonly options;
|
|
80
|
+
private resolver?;
|
|
81
|
+
private onboarding?;
|
|
82
|
+
private lastOnboardingAttempt;
|
|
83
|
+
private lastOnboardingError?;
|
|
120
84
|
constructor(brandJsonUrl: string, options: BrandJsonJwksResolverOptions);
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
* expired brand.json snapshot, refreshes respecting the cooldown. Unknown
|
|
124
|
-
* kids cascade: first ask the inner HttpsJwksResolver (which will refetch
|
|
125
|
-
* its own URL if cooldown has elapsed); if still unknown, refresh
|
|
126
|
-
* brand.json in case `jwks_uri` rotated.
|
|
127
|
-
*/
|
|
85
|
+
private createResolver;
|
|
86
|
+
private confirmedResolver;
|
|
128
87
|
resolve(keyid: string): Promise<AdcpJsonWebKey | null>;
|
|
129
|
-
|
|
130
|
-
* The agent URL we resolved `jwks_uri` from. Populated after the first
|
|
131
|
-
* successful refresh; useful for verifier result attribution
|
|
132
|
-
* (`VerifyWebhookOptions.agentUrlForKeyid`).
|
|
133
|
-
*/
|
|
88
|
+
resolveWithMetadata(keyid: string): Promise<JwksResolution>;
|
|
134
89
|
get agentUrl(): string | undefined;
|
|
135
|
-
/** Force a refetch of both brand.json and the inner JWKS, bypassing the cooldown. */
|
|
136
90
|
forceRefresh(): Promise<void>;
|
|
137
|
-
private refresh;
|
|
138
|
-
private doRefresh;
|
|
139
91
|
}
|
|
140
92
|
export interface FetchedBrandJson {
|
|
141
93
|
status: 'ok' | 'not_modified';
|
|
@@ -149,6 +101,8 @@ export interface FetchBrandJsonOptions {
|
|
|
149
101
|
startUrl: string;
|
|
150
102
|
/** ETag sent only to the entry URL for cache revalidation. */
|
|
151
103
|
currentEtag?: string;
|
|
104
|
+
/** Initial domain-derived fetch may redirect only between host and exact www counterpart. */
|
|
105
|
+
domainDerived?: boolean;
|
|
152
106
|
/** Maximum JSON-level `authoritative_location` / `house` hops. Default 3, hard maximum 10. */
|
|
153
107
|
maxRedirects?: number;
|
|
154
108
|
/** Permit HTTP and private addresses for controlled development environments. */
|
|
@@ -1,32 +1,10 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Receiver-side ergonomic: resolve a sender's JWKS by fetching their
|
|
3
|
-
* `brand.json`, extracting the `jwks_uri` for the agent whose webhooks we're
|
|
4
|
-
* verifying, and delegating to {@link HttpsJwksResolver}.
|
|
5
|
-
*
|
|
6
|
-
* Hand the resulting instance to `verifyWebhookSignature.jwks` (or
|
|
7
|
-
* `verifyRequestSignature.jwks`) and the receiver never has to know where the
|
|
8
|
-
* sender hosts their keys — brand.json is the single source of truth.
|
|
9
|
-
*
|
|
10
|
-
* Follows the two documented redirect variants of `brand.json`
|
|
11
|
-
* (`authoritative_location` and `house`) up to a caller-configurable hop
|
|
12
|
-
* depth. When the selected agent has no `jwks_uri`, falls back to
|
|
13
|
-
* `/.well-known/jwks.json` on the origin of the agent's `url` — but only
|
|
14
|
-
* when that origin matches the final brand.json origin. The spec's
|
|
15
|
-
* well-known fallback exists so publishers hosting brand.json and their
|
|
16
|
-
* agents on the same origin can skip the explicit `jwks_uri`; accepting a
|
|
17
|
-
* cross-origin fallback would let an attacker pivot the trust anchor to a
|
|
18
|
-
* controlled host with a permissive JWKS.
|
|
19
|
-
*
|
|
20
|
-
* Caching is stacked with the inner {@link HttpsJwksResolver}: brand.json
|
|
21
|
-
* honors its own `Cache-Control`/`ETag` (bounded by `maxAgeSeconds`), and
|
|
22
|
-
* unknown-kid refreshes cascade — first to the JWKS endpoint, then (if the
|
|
23
|
-
* JWKS still doesn't have the kid and the brand.json cooldown has elapsed) to
|
|
24
|
-
* brand.json itself, in case the sender rotated `jwks_uri`.
|
|
25
|
-
*/
|
|
1
|
+
/** Capability-confirmed sender key discovery and SSRF-safe brand.json fetching. */
|
|
26
2
|
import { type SsrfDnsLookup } from '../net';
|
|
27
3
|
import type { JwksResolver } from './jwks';
|
|
28
4
|
import { type HttpsJwksResolverOptions } from './jwks-https';
|
|
29
5
|
import type { AdcpJsonWebKey } from './types';
|
|
6
|
+
import type { AgentProtocol, FetchCapabilitiesFn } from './agent-resolver/resolve-agent';
|
|
7
|
+
import type { JwksResolution } from './jwks';
|
|
30
8
|
export type BrandAgentType = 'brand' | 'rights' | 'measurement' | 'governance' | 'creative' | 'sales' | 'buying' | 'signals';
|
|
31
9
|
export type BrandJsonResolverErrorCode = 'invalid_url' | 'invalid_house' | 'redirect_loop' | 'redirect_depth_exceeded' | 'fetch_failed' | 'invalid_body' | 'schema_invalid' | 'agent_not_found' | 'agent_ambiguous' | 'jwks_origin_mismatch';
|
|
32
10
|
/**
|
|
@@ -36,6 +14,7 @@ export type BrandJsonResolverErrorCode = 'invalid_url' | 'invalid_house' | 'redi
|
|
|
36
14
|
*/
|
|
37
15
|
export declare class BrandJsonResolverError extends Error {
|
|
38
16
|
readonly code: BrandJsonResolverErrorCode;
|
|
17
|
+
readonly recovery: 'terminal' | 'transient';
|
|
39
18
|
readonly cause?: unknown;
|
|
40
19
|
/** HTTP status for `fetch_failed` responses, when a response was received. */
|
|
41
20
|
readonly httpStatus?: number;
|
|
@@ -45,21 +24,20 @@ export declare class BrandJsonResolverError extends Error {
|
|
|
45
24
|
});
|
|
46
25
|
}
|
|
47
26
|
export interface BrandJsonJwksResolverOptions {
|
|
27
|
+
/** Expected agent URL. Prefer supplying it; legacy configurations infer one onboarding URL, then confirm it through capabilities and canonical matching. */
|
|
28
|
+
agentUrl?: string;
|
|
29
|
+
/** Capabilities transport. Defaults to MCP; A2A integrations must set 'a2a'. */
|
|
30
|
+
protocol?: AgentProtocol;
|
|
31
|
+
/** Enable the 3.x webhook-only domain-derived fallback. Default true. Request verification refuses these keys. */
|
|
32
|
+
legacyWebhookFallback?: boolean;
|
|
33
|
+
fetchCapabilities?: FetchCapabilitiesFn;
|
|
48
34
|
/** Functional role of the agent whose keys we want to resolve. */
|
|
49
35
|
agentType: BrandAgentType;
|
|
50
36
|
/**
|
|
51
|
-
* Agent id from `agents[].id
|
|
52
|
-
* one agent of the requested type (otherwise the selector is ambiguous).
|
|
53
|
-
* Optional when the type is unique.
|
|
37
|
+
* Agent id from `agents[].id`, used only to narrow canonical URL matches.
|
|
54
38
|
*/
|
|
55
39
|
agentId?: string;
|
|
56
|
-
/**
|
|
57
|
-
* Brand id within a house portfolio (`brands[].id`). When omitted on a
|
|
58
|
-
* portfolio brand.json, the resolver looks at `house.agents[]`. When set,
|
|
59
|
-
* the resolver looks at `brands[brandId].agents[]` first and falls back to
|
|
60
|
-
* `house.agents[]` if no agent of the requested type is declared on the
|
|
61
|
-
* brand itself.
|
|
62
|
-
*/
|
|
40
|
+
/** @deprecated Used only to infer an onboarding URL when agentUrl is absent. Canonical verification searches all operator collections. */
|
|
63
41
|
brandId?: string;
|
|
64
42
|
/**
|
|
65
43
|
* Minimum seconds between brand.json refetches. Mirrors the JWKS cooldown
|
|
@@ -73,11 +51,7 @@ export interface BrandJsonJwksResolverOptions {
|
|
|
73
51
|
* allow longer. Default 3600s (1 hour).
|
|
74
52
|
*/
|
|
75
53
|
maxAgeSeconds?: number;
|
|
76
|
-
/**
|
|
77
|
-
* Maximum redirect hops to follow through `authoritative_location` /
|
|
78
|
-
* `house` variants. Default 3 — enough for `authoritative_location → house
|
|
79
|
-
* → portfolio` without inviting loops.
|
|
80
|
-
*/
|
|
54
|
+
/** @deprecated Only controls legacy onboarding indirection. Explicit capability URLs allow no redirects; webhook fallback allows one document hop. */
|
|
81
55
|
maxRedirects?: number;
|
|
82
56
|
/**
|
|
83
57
|
* Allow `http://` / private-IP brand.json and JWKS URLs (dev loops only).
|
|
@@ -90,52 +64,30 @@ export interface BrandJsonJwksResolverOptions {
|
|
|
90
64
|
* address remains subject to SSRF classification and connection pinning.
|
|
91
65
|
*/
|
|
92
66
|
lookup?: SsrfDnsLookup;
|
|
93
|
-
/**
|
|
94
|
-
* Forwarded to the inner {@link HttpsJwksResolver} constructor.
|
|
95
|
-
* `allowPrivateIp`, `lookup`, and `now` are set from the outer options and
|
|
96
|
-
* should not be passed here.
|
|
97
|
-
*/
|
|
67
|
+
/** Existing settings remain accepted. maxAgeSeconds/minCooldownSeconds configure caching; protocol floors and fail-closed behavior replace other settings. */
|
|
98
68
|
jwksOptions?: Omit<HttpsJwksResolverOptions, 'allowPrivateIp' | 'lookup' | 'now'>;
|
|
99
69
|
/** Clock override for deterministic tests. Returns epoch seconds. */
|
|
100
70
|
now?: () => number;
|
|
101
71
|
}
|
|
102
72
|
/**
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
* the
|
|
73
|
+
* Confirmed operator mapping. The supplied brand.json URL must agree with
|
|
74
|
+
* capabilities on every cache refresh. Prefer ResolvedAgentJwksResolver
|
|
75
|
+
* when the application's onboarding record holds only the seller URL.
|
|
106
76
|
*/
|
|
107
77
|
export declare class BrandJsonJwksResolver implements JwksResolver {
|
|
108
|
-
private readonly
|
|
109
|
-
private readonly
|
|
110
|
-
private
|
|
111
|
-
private
|
|
112
|
-
private
|
|
113
|
-
private
|
|
114
|
-
private readonly lookup;
|
|
115
|
-
private readonly jwksOptions;
|
|
116
|
-
private readonly now;
|
|
117
|
-
private snapshot;
|
|
118
|
-
private inner;
|
|
119
|
-
private inFlight;
|
|
78
|
+
private readonly brandJsonUrl;
|
|
79
|
+
private readonly options;
|
|
80
|
+
private resolver?;
|
|
81
|
+
private onboarding?;
|
|
82
|
+
private lastOnboardingAttempt;
|
|
83
|
+
private lastOnboardingError?;
|
|
120
84
|
constructor(brandJsonUrl: string, options: BrandJsonJwksResolverOptions);
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
* expired brand.json snapshot, refreshes respecting the cooldown. Unknown
|
|
124
|
-
* kids cascade: first ask the inner HttpsJwksResolver (which will refetch
|
|
125
|
-
* its own URL if cooldown has elapsed); if still unknown, refresh
|
|
126
|
-
* brand.json in case `jwks_uri` rotated.
|
|
127
|
-
*/
|
|
85
|
+
private createResolver;
|
|
86
|
+
private confirmedResolver;
|
|
128
87
|
resolve(keyid: string): Promise<AdcpJsonWebKey | null>;
|
|
129
|
-
|
|
130
|
-
* The agent URL we resolved `jwks_uri` from. Populated after the first
|
|
131
|
-
* successful refresh; useful for verifier result attribution
|
|
132
|
-
* (`VerifyWebhookOptions.agentUrlForKeyid`).
|
|
133
|
-
*/
|
|
88
|
+
resolveWithMetadata(keyid: string): Promise<JwksResolution>;
|
|
134
89
|
get agentUrl(): string | undefined;
|
|
135
|
-
/** Force a refetch of both brand.json and the inner JWKS, bypassing the cooldown. */
|
|
136
90
|
forceRefresh(): Promise<void>;
|
|
137
|
-
private refresh;
|
|
138
|
-
private doRefresh;
|
|
139
91
|
}
|
|
140
92
|
export interface FetchedBrandJson {
|
|
141
93
|
status: 'ok' | 'not_modified';
|
|
@@ -149,6 +101,8 @@ export interface FetchBrandJsonOptions {
|
|
|
149
101
|
startUrl: string;
|
|
150
102
|
/** ETag sent only to the entry URL for cache revalidation. */
|
|
151
103
|
currentEtag?: string;
|
|
104
|
+
/** Initial domain-derived fetch may redirect only between host and exact www counterpart. */
|
|
105
|
+
domainDerived?: boolean;
|
|
152
106
|
/** Maximum JSON-level `authoritative_location` / `house` hops. Default 3, hard maximum 10. */
|
|
153
107
|
maxRedirects?: number;
|
|
154
108
|
/** Permit HTTP and private addresses for controlled development environments. */
|