@adcp/sdk 16.0.0-beta.6 → 16.0.0-beta.8
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/README.md +17 -0
- package/dist/lib/conformance/index.d.mts +2 -0
- package/dist/lib/conformance/index.d.ts +2 -0
- package/dist/lib/conformance/index.js +3 -0
- package/dist/lib/conformance/index.mjs +2 -0
- package/dist/lib/conformance/property-lists.d.mts +14 -0
- package/dist/lib/conformance/property-lists.d.ts +14 -0
- package/dist/lib/conformance/property-lists.js +45 -0
- package/dist/lib/conformance/property-lists.mjs +21 -0
- package/dist/lib/conformance/runConformance.js +20 -1
- package/dist/lib/conformance/runConformance.mjs +20 -1
- package/dist/lib/conformance/types.d.mts +3 -0
- package/dist/lib/conformance/types.d.ts +3 -0
- package/dist/lib/core/SingleAgentClient.d.mts +13 -3
- package/dist/lib/core/SingleAgentClient.d.ts +13 -3
- package/dist/lib/core/SingleAgentClient.js +109 -21
- package/dist/lib/core/SingleAgentClient.mjs +112 -22
- package/dist/lib/core/TaskExecutor.d.mts +1 -0
- package/dist/lib/core/TaskExecutor.d.ts +1 -0
- package/dist/lib/core/TaskExecutor.js +48 -34
- package/dist/lib/core/TaskExecutor.mjs +49 -35
- package/dist/lib/identifiers.d.mts +53 -0
- package/dist/lib/identifiers.d.ts +53 -0
- package/dist/lib/identifiers.js +212 -0
- package/dist/lib/identifiers.mjs +163 -0
- package/dist/lib/identity-3.3/revocation.js +5 -4
- package/dist/lib/identity-3.3/revocation.mjs +5 -4
- package/dist/lib/index.d.mts +3 -1
- package/dist/lib/index.d.ts +3 -1
- package/dist/lib/index.js +2 -0
- package/dist/lib/index.mjs +1 -0
- package/dist/lib/media-buy/index.d.mts +1 -1
- package/dist/lib/media-buy/index.d.ts +1 -1
- package/dist/lib/media-buy/property-policy.d.mts +15 -1
- package/dist/lib/media-buy/property-policy.d.ts +15 -1
- package/dist/lib/media-buy/property-policy.js +135 -3
- package/dist/lib/media-buy/property-policy.mjs +134 -3
- package/dist/lib/registry/index.d.mts +12 -0
- package/dist/lib/registry/index.d.ts +12 -0
- package/dist/lib/registry/index.js +159 -5
- package/dist/lib/registry/index.mjs +156 -4
- package/dist/lib/registry/types.d.mts +23 -0
- package/dist/lib/registry/types.d.ts +23 -0
- package/dist/lib/schemas-data/v2.5/_provenance.json +1 -1
- package/dist/lib/server/auth-signature.js +23 -2
- package/dist/lib/server/auth-signature.mjs +26 -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.js +19 -3
- package/dist/lib/server/create-adcp-server.mjs +23 -4
- package/dist/lib/server/decisioning/runtime/from-platform.js +6 -2
- package/dist/lib/server/decisioning/runtime/from-platform.mjs +6 -2
- package/dist/lib/server/decisioning/specialisms/lists.d.mts +4 -4
- package/dist/lib/server/decisioning/specialisms/lists.d.ts +4 -4
- package/dist/lib/server/index.d.mts +3 -0
- package/dist/lib/server/index.d.ts +3 -0
- package/dist/lib/server/index.js +8 -1
- package/dist/lib/server/index.mjs +4 -0
- package/dist/lib/server/property-lists.d.mts +36 -0
- package/dist/lib/server/property-lists.d.ts +36 -0
- package/dist/lib/server/property-lists.js +154 -0
- package/dist/lib/server/property-lists.mjs +129 -0
- package/dist/lib/server/serve.js +2 -1
- package/dist/lib/server/serve.mjs +2 -1
- package/dist/lib/server/targeting-helpers.d.mts +2 -0
- package/dist/lib/server/targeting-helpers.d.ts +2 -0
- package/dist/lib/server/targeting-helpers.js +28 -1
- package/dist/lib/server/targeting-helpers.mjs +18 -1
- package/dist/lib/server/webhook-emitter.js +1 -0
- package/dist/lib/server/webhook-emitter.mjs +2 -1
- package/dist/lib/signing/crypto.d.mts +1 -1
- package/dist/lib/signing/crypto.d.ts +1 -1
- package/dist/lib/signing/crypto.js +37 -2
- package/dist/lib/signing/crypto.mjs +37 -2
- package/dist/lib/signing/parser.d.mts +6 -0
- package/dist/lib/signing/parser.d.ts +6 -0
- package/dist/lib/signing/parser.js +7 -3
- package/dist/lib/signing/parser.mjs +6 -3
- package/dist/lib/signing/server.d.mts +1 -1
- package/dist/lib/signing/server.d.ts +1 -1
- package/dist/lib/signing/server.mjs +5 -1
- package/dist/lib/signing/web-bot-auth.d.mts +61 -22
- package/dist/lib/signing/web-bot-auth.d.ts +61 -22
- package/dist/lib/signing/web-bot-auth.js +286 -266
- package/dist/lib/signing/web-bot-auth.mjs +288 -277
- package/dist/lib/signing/webhook-verifier.d.mts +11 -0
- package/dist/lib/signing/webhook-verifier.d.ts +11 -0
- package/dist/lib/signing/webhook-verifier.js +11 -3
- package/dist/lib/signing/webhook-verifier.mjs +11 -3
- package/dist/lib/supply-path/verify.js +12 -2
- package/dist/lib/supply-path/verify.mjs +2 -2
- package/dist/lib/testing/client.js +3 -5
- package/dist/lib/testing/client.mjs +4 -6
- package/dist/lib/testing/compliance/comply.js +7 -2
- package/dist/lib/testing/compliance/comply.mjs +8 -3
- package/dist/lib/testing/index.d.mts +1 -1
- package/dist/lib/testing/index.d.ts +1 -1
- package/dist/lib/testing/index.js +4 -2
- package/dist/lib/testing/index.mjs +8 -2
- package/dist/lib/testing/storyboard/runner.js +12 -12
- package/dist/lib/testing/storyboard/runner.mjs +14 -13
- package/dist/lib/testing/storyboard/validations.d.mts +1 -1
- package/dist/lib/testing/storyboard/validations.d.ts +1 -1
- package/dist/lib/testing/storyboard/validations.js +23 -1
- package/dist/lib/testing/storyboard/validations.mjs +28 -2
- package/dist/lib/testing/types.d.mts +39 -0
- package/dist/lib/testing/types.d.ts +39 -0
- package/dist/lib/v2/projection/augment-response.js +6 -3
- package/dist/lib/v2/projection/augment-response.mjs +8 -5
- package/dist/lib/v2/projection/creative-delivery.js +29 -17
- package/dist/lib/v2/projection/creative-delivery.mjs +31 -18
- package/dist/lib/v2/projection/v1-to-v2.d.mts +7 -0
- package/dist/lib/v2/projection/v1-to-v2.d.ts +7 -0
- package/dist/lib/v2/projection/v1-to-v2.js +70 -2
- package/dist/lib/v2/projection/v1-to-v2.mjs +72 -1
- package/dist/lib/validation/index.d.mts +1 -1
- package/dist/lib/validation/index.d.ts +1 -1
- package/dist/lib/validation/index.js +4 -2
- package/dist/lib/validation/index.mjs +4 -2
- package/dist/lib/validation/schema-loader.d.mts +26 -0
- package/dist/lib/validation/schema-loader.d.ts +26 -0
- package/dist/lib/validation/schema-loader.js +98 -14
- package/dist/lib/validation/schema-loader.mjs +95 -13
- 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/PROPERTY-LISTS.md +264 -0
- package/docs/guides/SIGNING-GUIDE.md +25 -0
- package/docs/guides/VALIDATE-YOUR-AGENT.md +34 -0
- package/docs/llms.txt +2 -2
- package/docs/migration-14.x-rc-worksheet.md +4 -4
- package/docs/migration-agent-identity-3.3.md +60 -23
- package/package.json +1 -1
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { type SsrfFetchOptions } from '../net/index.mjs';
|
|
2
2
|
import { type RequestLike, type ResponseLike } from './canonicalize.mjs';
|
|
3
|
-
import { type ParsedSignatureInput } from './parser.mjs';
|
|
4
3
|
import type { JwksResolver } from './jwks.mjs';
|
|
5
4
|
import type { ReplayStore } from './replay.mjs';
|
|
6
5
|
import type { AdcpJsonWebKey } from './types.mjs';
|
|
@@ -9,11 +8,21 @@ export declare const WEB_BOT_AUTH_PROFILE: "web-bot-auth";
|
|
|
9
8
|
export declare const WEB_BOT_AUTH_DRAFT_REVISION: "draft-ietf-webbotauth-httpsig-protocol-00";
|
|
10
9
|
export declare const SIGNATURE_DIRECTORY_PATH = "/.well-known/http-message-signatures-directory";
|
|
11
10
|
export declare const SIGNATURE_DIRECTORY_MEDIA_TYPE = "application/http-message-signatures-directory+json";
|
|
11
|
+
/** The profile's signature algorithms (wba-profile.mdx "Profile rules"). ES256 is RFC 9421 profile only. */
|
|
12
|
+
export declare const WEB_BOT_AUTH_ALGORITHMS: readonly ["ed25519", "rsa-pss-sha512"];
|
|
12
13
|
/**
|
|
13
|
-
* Signature
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
|
|
14
|
+
* The profile's `Accept-Signature` member (RFC 9421 §5.1): the label, the
|
|
15
|
+
* components the profile requires, and its parameters. A replay challenge
|
|
16
|
+
* carries the fresh `nonce` the signer uses on its next attempt.
|
|
17
|
+
*/
|
|
18
|
+
export declare function webBotAuthAcceptSignature(label?: string, hasBody?: boolean, nonce?: string): string;
|
|
19
|
+
/**
|
|
20
|
+
* Signature-path outcome (wba-profile.mdx "Error responses"): 400 when the
|
|
21
|
+
* signature fields do not parse; 403 with `Accept-Signature` when a signature
|
|
22
|
+
* fails verification or the profile rules (without it for a revoked key); 429
|
|
23
|
+
* with `Accept-Signature` carrying a fresh `nonce` for a reused signature or
|
|
24
|
+
* nonce. A 429 for local load shedding carries `Retry-After` instead. Any AdCP
|
|
25
|
+
* body is the generic authentication error; detail stays in `reason` (logs).
|
|
17
26
|
* Infrastructure the verifier depends on is reported separately by
|
|
18
27
|
* {@link WebBotAuthUnavailableError}.
|
|
19
28
|
*/
|
|
@@ -40,6 +49,16 @@ export declare class WebBotAuthUnavailableError extends Error {
|
|
|
40
49
|
readonly reason: string;
|
|
41
50
|
constructor(reason: string, cause?: unknown);
|
|
42
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* The answer to an unsigned request to an operation in `required_for` from a
|
|
54
|
+
* caller with no other credential the verifier accepts, when the verifier
|
|
55
|
+
* advertises only `web-bot-auth`: 403 with `Accept-Signature`. A verifier that
|
|
56
|
+
* also advertises the AdCP RFC 9421 profile answers as that profile does (401
|
|
57
|
+
* `request_signature_required`) and adds {@link webBotAuthAcceptSignature}.
|
|
58
|
+
*/
|
|
59
|
+
export declare function unsignedWebBotAuthError(hasBody: boolean): WebBotAuthError;
|
|
60
|
+
/** Whether a `request_signing.profiles` advertisement names Web Bot Auth and not the AdCP RFC 9421 profile. */
|
|
61
|
+
export declare function advertisesOnlyWebBotAuth(profiles: readonly string[] | undefined): boolean;
|
|
43
62
|
export declare function selectSignatureProfile(request: Pick<RequestLike, 'headers'>): 'web-bot-auth' | 'rfc9421';
|
|
44
63
|
/**
|
|
45
64
|
* RFC 7638 JWK SHA-256 thumbprint, synchronous. Byte-identical to jose's
|
|
@@ -49,10 +68,13 @@ export declare function jwkThumbprint(jwk: Partial<Pick<AdcpJsonWebKey, 'kty' |
|
|
|
49
68
|
n?: unknown;
|
|
50
69
|
e?: unknown;
|
|
51
70
|
}): string;
|
|
71
|
+
/**
|
|
72
|
+
* Refuse a Web Bot Auth signing key the profile does not allow, at wire-up
|
|
73
|
+
* time rather than on the first request.
|
|
74
|
+
*/
|
|
75
|
+
export declare function assertWebBotAuthSigningKey(key: WebBotSigningKey): void;
|
|
52
76
|
/** Reject authority normalization differentials on received identifiers. */
|
|
53
77
|
export declare function receivedAgentOrigin(value: string): string;
|
|
54
|
-
/** RFC 9421 dictionary-member extraction, including relay member coverage. */
|
|
55
|
-
export declare function buildWebBotAuthSignatureBase(input: ParsedSignatureInput, request: RequestLike, response?: ResponseLike): string;
|
|
56
78
|
export declare function getWebBotAuthLegacyOriginGate(resolver: Function | undefined): ((origin: string) => Promise<void>) | undefined;
|
|
57
79
|
export interface WebBotAuthAuthorizationFailure {
|
|
58
80
|
code: 'PERMISSION_DENIED' | 'SERVICE_UNAVAILABLE';
|
|
@@ -92,7 +114,10 @@ export interface VerifyWebBotAuthOptions {
|
|
|
92
114
|
/** Atomic, shared across endpoints and replicas. Nonce scope is the identity origin, not the rotating kid. */
|
|
93
115
|
replayStore: ReplayStore;
|
|
94
116
|
now?: () => number;
|
|
95
|
-
/**
|
|
117
|
+
/**
|
|
118
|
+
* @deprecated No effect. A reused signature or nonce is always 429 with
|
|
119
|
+
* `Accept-Signature` carrying a fresh nonce (adcp#7894, `negative/002`).
|
|
120
|
+
*/
|
|
96
121
|
replayStatus?: 403 | 429;
|
|
97
122
|
/**
|
|
98
123
|
* @deprecated Revocation is an identity and authorization check, not part of
|
|
@@ -108,30 +133,39 @@ export interface VerifyWebBotAuthOptions {
|
|
|
108
133
|
/** @deprecated No effect; revocation outcomes are no longer deferred into tool errors. */
|
|
109
134
|
deferAuthorizationErrors?: boolean;
|
|
110
135
|
}
|
|
136
|
+
/**
|
|
137
|
+
* Verify a Web Bot Auth request (wba-profile.mdx "Verification"). Resolves to
|
|
138
|
+
* exactly one verified signer: the profile takes one `web-bot-auth` signature
|
|
139
|
+
* and one `Signature-Agent` member per request. The array shape is kept for
|
|
140
|
+
* principal resolvers written against earlier drafts.
|
|
141
|
+
*/
|
|
111
142
|
export declare function verifyWebBotAuth(request: RequestLike, options: VerifyWebBotAuthOptions): Promise<VerifiedWebBotSigner[]>;
|
|
112
143
|
export interface VerifiedSignatureDirectory {
|
|
113
144
|
keys: AdcpJsonWebKey[];
|
|
114
|
-
/**
|
|
145
|
+
/** The earliest proof expiry. */
|
|
115
146
|
expires: number;
|
|
116
|
-
/**
|
|
117
|
-
signed:
|
|
147
|
+
/** @deprecated Always `true`: the profile accepts only signed directories (WBA Appendix B.1). */
|
|
148
|
+
signed: true;
|
|
118
149
|
/** Preserve exact bytes and response headers for auditing. */
|
|
119
150
|
proof: ResponseLike;
|
|
120
151
|
}
|
|
121
152
|
/**
|
|
122
|
-
* Verify a key directory response (
|
|
123
|
-
* Appendix B
|
|
124
|
-
* `
|
|
125
|
-
*
|
|
126
|
-
*
|
|
153
|
+
* Verify a key directory response (wba-profile.mdx "Key directories", WBA
|
|
154
|
+
* Appendix B.1). The response must be signed once per key, each signature
|
|
155
|
+
* covering `"@authority";req` and `content-digest` with `created`, `expires`,
|
|
156
|
+
* the key's thumbprint as `keyid` and `tag="http-message-signatures-directory"`,
|
|
157
|
+
* and verifying under the key the directory itself provides. An unsigned
|
|
158
|
+
* directory is a discovery failure.
|
|
127
159
|
*/
|
|
128
160
|
export declare function verifyKeyDirectory(response: ResponseLike, now?: number, options?: {
|
|
129
161
|
allowTestKeys?: boolean;
|
|
162
|
+
/** @deprecated No effect: directories must always be signed. */
|
|
130
163
|
requireSigned?: boolean;
|
|
164
|
+
/** @deprecated No effect: unsigned directories are refused. */
|
|
131
165
|
maxUnsignedAgeSeconds?: number;
|
|
132
|
-
}): VerifiedSignatureDirectory
|
|
133
|
-
/**
|
|
134
|
-
export declare function verifySignatureDirectory(response: ResponseLike, now?: number, allowTestKeys?: boolean): VerifiedSignatureDirectory
|
|
166
|
+
}): Promise<VerifiedSignatureDirectory>;
|
|
167
|
+
/** @deprecated Same as {@link verifyKeyDirectory}: every directory must be signed. */
|
|
168
|
+
export declare function verifySignatureDirectory(response: ResponseLike, now?: number, allowTestKeys?: boolean): Promise<VerifiedSignatureDirectory>;
|
|
135
169
|
export interface SignatureDirectoryResolverOptions {
|
|
136
170
|
now?: () => number;
|
|
137
171
|
fetchOptions?: Pick<SsrfFetchOptions, 'lookup' | 'trustedFetchFn'>;
|
|
@@ -139,9 +173,9 @@ export interface SignatureDirectoryResolverOptions {
|
|
|
139
173
|
maxOrigins?: number;
|
|
140
174
|
/** Globally bound concurrency across attacker-selected origins. */
|
|
141
175
|
maxConcurrentFetches?: number;
|
|
142
|
-
/**
|
|
176
|
+
/** @deprecated No effect: signed directories (WBA Appendix B.1) are always required. */
|
|
143
177
|
requireSignedDirectories?: boolean;
|
|
144
|
-
/**
|
|
178
|
+
/** @deprecated No effect: unsigned directories are refused. */
|
|
145
179
|
maxUnsignedDirectoryAgeSeconds?: number;
|
|
146
180
|
}
|
|
147
181
|
/**
|
|
@@ -168,9 +202,9 @@ export interface WebBotSigningOptions {
|
|
|
168
202
|
origin: string;
|
|
169
203
|
label?: string;
|
|
170
204
|
now?: () => number;
|
|
205
|
+
/** 64 bytes, unpadded Base64URL or canonical Base64. Defaults to 64 fresh random bytes. */
|
|
171
206
|
nonce?: string;
|
|
172
207
|
windowSeconds?: number;
|
|
173
|
-
relay?: boolean;
|
|
174
208
|
}
|
|
175
209
|
export type WebBotSigningKey = {
|
|
176
210
|
privateKey: AdcpJsonWebKey;
|
|
@@ -178,6 +212,11 @@ export type WebBotSigningKey = {
|
|
|
178
212
|
publicKey: AdcpJsonWebKey;
|
|
179
213
|
provider: SigningProvider;
|
|
180
214
|
};
|
|
215
|
+
/**
|
|
216
|
+
* Sign a request under the profile: one `web-bot-auth` signature labelled
|
|
217
|
+
* `label`, one covered `Signature-Agent` member naming `origin`, a 64-byte
|
|
218
|
+
* nonce, and a lifetime of at most 300 seconds.
|
|
219
|
+
*/
|
|
181
220
|
export declare function signWebBotAuth(request: RequestLike, key: WebBotSigningKey, options: WebBotSigningOptions): Promise<Record<string, string>>;
|
|
182
221
|
/** Regenerate after rotation and periodically before proofs expire. No private material is published. */
|
|
183
222
|
export declare function createSignedSignatureDirectory(originUrl: string, signingKeys: WebBotSigningKey[], options?: {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { type SsrfFetchOptions } from '../net';
|
|
2
2
|
import { type RequestLike, type ResponseLike } from './canonicalize';
|
|
3
|
-
import { type ParsedSignatureInput } from './parser';
|
|
4
3
|
import type { JwksResolver } from './jwks';
|
|
5
4
|
import type { ReplayStore } from './replay';
|
|
6
5
|
import type { AdcpJsonWebKey } from './types';
|
|
@@ -9,11 +8,21 @@ export declare const WEB_BOT_AUTH_PROFILE: "web-bot-auth";
|
|
|
9
8
|
export declare const WEB_BOT_AUTH_DRAFT_REVISION: "draft-ietf-webbotauth-httpsig-protocol-00";
|
|
10
9
|
export declare const SIGNATURE_DIRECTORY_PATH = "/.well-known/http-message-signatures-directory";
|
|
11
10
|
export declare const SIGNATURE_DIRECTORY_MEDIA_TYPE = "application/http-message-signatures-directory+json";
|
|
11
|
+
/** The profile's signature algorithms (wba-profile.mdx "Profile rules"). ES256 is RFC 9421 profile only. */
|
|
12
|
+
export declare const WEB_BOT_AUTH_ALGORITHMS: readonly ["ed25519", "rsa-pss-sha512"];
|
|
12
13
|
/**
|
|
13
|
-
* Signature
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
|
|
14
|
+
* The profile's `Accept-Signature` member (RFC 9421 §5.1): the label, the
|
|
15
|
+
* components the profile requires, and its parameters. A replay challenge
|
|
16
|
+
* carries the fresh `nonce` the signer uses on its next attempt.
|
|
17
|
+
*/
|
|
18
|
+
export declare function webBotAuthAcceptSignature(label?: string, hasBody?: boolean, nonce?: string): string;
|
|
19
|
+
/**
|
|
20
|
+
* Signature-path outcome (wba-profile.mdx "Error responses"): 400 when the
|
|
21
|
+
* signature fields do not parse; 403 with `Accept-Signature` when a signature
|
|
22
|
+
* fails verification or the profile rules (without it for a revoked key); 429
|
|
23
|
+
* with `Accept-Signature` carrying a fresh `nonce` for a reused signature or
|
|
24
|
+
* nonce. A 429 for local load shedding carries `Retry-After` instead. Any AdCP
|
|
25
|
+
* body is the generic authentication error; detail stays in `reason` (logs).
|
|
17
26
|
* Infrastructure the verifier depends on is reported separately by
|
|
18
27
|
* {@link WebBotAuthUnavailableError}.
|
|
19
28
|
*/
|
|
@@ -40,6 +49,16 @@ export declare class WebBotAuthUnavailableError extends Error {
|
|
|
40
49
|
readonly reason: string;
|
|
41
50
|
constructor(reason: string, cause?: unknown);
|
|
42
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* The answer to an unsigned request to an operation in `required_for` from a
|
|
54
|
+
* caller with no other credential the verifier accepts, when the verifier
|
|
55
|
+
* advertises only `web-bot-auth`: 403 with `Accept-Signature`. A verifier that
|
|
56
|
+
* also advertises the AdCP RFC 9421 profile answers as that profile does (401
|
|
57
|
+
* `request_signature_required`) and adds {@link webBotAuthAcceptSignature}.
|
|
58
|
+
*/
|
|
59
|
+
export declare function unsignedWebBotAuthError(hasBody: boolean): WebBotAuthError;
|
|
60
|
+
/** Whether a `request_signing.profiles` advertisement names Web Bot Auth and not the AdCP RFC 9421 profile. */
|
|
61
|
+
export declare function advertisesOnlyWebBotAuth(profiles: readonly string[] | undefined): boolean;
|
|
43
62
|
export declare function selectSignatureProfile(request: Pick<RequestLike, 'headers'>): 'web-bot-auth' | 'rfc9421';
|
|
44
63
|
/**
|
|
45
64
|
* RFC 7638 JWK SHA-256 thumbprint, synchronous. Byte-identical to jose's
|
|
@@ -49,10 +68,13 @@ export declare function jwkThumbprint(jwk: Partial<Pick<AdcpJsonWebKey, 'kty' |
|
|
|
49
68
|
n?: unknown;
|
|
50
69
|
e?: unknown;
|
|
51
70
|
}): string;
|
|
71
|
+
/**
|
|
72
|
+
* Refuse a Web Bot Auth signing key the profile does not allow, at wire-up
|
|
73
|
+
* time rather than on the first request.
|
|
74
|
+
*/
|
|
75
|
+
export declare function assertWebBotAuthSigningKey(key: WebBotSigningKey): void;
|
|
52
76
|
/** Reject authority normalization differentials on received identifiers. */
|
|
53
77
|
export declare function receivedAgentOrigin(value: string): string;
|
|
54
|
-
/** RFC 9421 dictionary-member extraction, including relay member coverage. */
|
|
55
|
-
export declare function buildWebBotAuthSignatureBase(input: ParsedSignatureInput, request: RequestLike, response?: ResponseLike): string;
|
|
56
78
|
export declare function getWebBotAuthLegacyOriginGate(resolver: Function | undefined): ((origin: string) => Promise<void>) | undefined;
|
|
57
79
|
export interface WebBotAuthAuthorizationFailure {
|
|
58
80
|
code: 'PERMISSION_DENIED' | 'SERVICE_UNAVAILABLE';
|
|
@@ -92,7 +114,10 @@ export interface VerifyWebBotAuthOptions {
|
|
|
92
114
|
/** Atomic, shared across endpoints and replicas. Nonce scope is the identity origin, not the rotating kid. */
|
|
93
115
|
replayStore: ReplayStore;
|
|
94
116
|
now?: () => number;
|
|
95
|
-
/**
|
|
117
|
+
/**
|
|
118
|
+
* @deprecated No effect. A reused signature or nonce is always 429 with
|
|
119
|
+
* `Accept-Signature` carrying a fresh nonce (adcp#7894, `negative/002`).
|
|
120
|
+
*/
|
|
96
121
|
replayStatus?: 403 | 429;
|
|
97
122
|
/**
|
|
98
123
|
* @deprecated Revocation is an identity and authorization check, not part of
|
|
@@ -108,30 +133,39 @@ export interface VerifyWebBotAuthOptions {
|
|
|
108
133
|
/** @deprecated No effect; revocation outcomes are no longer deferred into tool errors. */
|
|
109
134
|
deferAuthorizationErrors?: boolean;
|
|
110
135
|
}
|
|
136
|
+
/**
|
|
137
|
+
* Verify a Web Bot Auth request (wba-profile.mdx "Verification"). Resolves to
|
|
138
|
+
* exactly one verified signer: the profile takes one `web-bot-auth` signature
|
|
139
|
+
* and one `Signature-Agent` member per request. The array shape is kept for
|
|
140
|
+
* principal resolvers written against earlier drafts.
|
|
141
|
+
*/
|
|
111
142
|
export declare function verifyWebBotAuth(request: RequestLike, options: VerifyWebBotAuthOptions): Promise<VerifiedWebBotSigner[]>;
|
|
112
143
|
export interface VerifiedSignatureDirectory {
|
|
113
144
|
keys: AdcpJsonWebKey[];
|
|
114
|
-
/**
|
|
145
|
+
/** The earliest proof expiry. */
|
|
115
146
|
expires: number;
|
|
116
|
-
/**
|
|
117
|
-
signed:
|
|
147
|
+
/** @deprecated Always `true`: the profile accepts only signed directories (WBA Appendix B.1). */
|
|
148
|
+
signed: true;
|
|
118
149
|
/** Preserve exact bytes and response headers for auditing. */
|
|
119
150
|
proof: ResponseLike;
|
|
120
151
|
}
|
|
121
152
|
/**
|
|
122
|
-
* Verify a key directory response (
|
|
123
|
-
* Appendix B
|
|
124
|
-
* `
|
|
125
|
-
*
|
|
126
|
-
*
|
|
153
|
+
* Verify a key directory response (wba-profile.mdx "Key directories", WBA
|
|
154
|
+
* Appendix B.1). The response must be signed once per key, each signature
|
|
155
|
+
* covering `"@authority";req` and `content-digest` with `created`, `expires`,
|
|
156
|
+
* the key's thumbprint as `keyid` and `tag="http-message-signatures-directory"`,
|
|
157
|
+
* and verifying under the key the directory itself provides. An unsigned
|
|
158
|
+
* directory is a discovery failure.
|
|
127
159
|
*/
|
|
128
160
|
export declare function verifyKeyDirectory(response: ResponseLike, now?: number, options?: {
|
|
129
161
|
allowTestKeys?: boolean;
|
|
162
|
+
/** @deprecated No effect: directories must always be signed. */
|
|
130
163
|
requireSigned?: boolean;
|
|
164
|
+
/** @deprecated No effect: unsigned directories are refused. */
|
|
131
165
|
maxUnsignedAgeSeconds?: number;
|
|
132
|
-
}): VerifiedSignatureDirectory
|
|
133
|
-
/**
|
|
134
|
-
export declare function verifySignatureDirectory(response: ResponseLike, now?: number, allowTestKeys?: boolean): VerifiedSignatureDirectory
|
|
166
|
+
}): Promise<VerifiedSignatureDirectory>;
|
|
167
|
+
/** @deprecated Same as {@link verifyKeyDirectory}: every directory must be signed. */
|
|
168
|
+
export declare function verifySignatureDirectory(response: ResponseLike, now?: number, allowTestKeys?: boolean): Promise<VerifiedSignatureDirectory>;
|
|
135
169
|
export interface SignatureDirectoryResolverOptions {
|
|
136
170
|
now?: () => number;
|
|
137
171
|
fetchOptions?: Pick<SsrfFetchOptions, 'lookup' | 'trustedFetchFn'>;
|
|
@@ -139,9 +173,9 @@ export interface SignatureDirectoryResolverOptions {
|
|
|
139
173
|
maxOrigins?: number;
|
|
140
174
|
/** Globally bound concurrency across attacker-selected origins. */
|
|
141
175
|
maxConcurrentFetches?: number;
|
|
142
|
-
/**
|
|
176
|
+
/** @deprecated No effect: signed directories (WBA Appendix B.1) are always required. */
|
|
143
177
|
requireSignedDirectories?: boolean;
|
|
144
|
-
/**
|
|
178
|
+
/** @deprecated No effect: unsigned directories are refused. */
|
|
145
179
|
maxUnsignedDirectoryAgeSeconds?: number;
|
|
146
180
|
}
|
|
147
181
|
/**
|
|
@@ -168,9 +202,9 @@ export interface WebBotSigningOptions {
|
|
|
168
202
|
origin: string;
|
|
169
203
|
label?: string;
|
|
170
204
|
now?: () => number;
|
|
205
|
+
/** 64 bytes, unpadded Base64URL or canonical Base64. Defaults to 64 fresh random bytes. */
|
|
171
206
|
nonce?: string;
|
|
172
207
|
windowSeconds?: number;
|
|
173
|
-
relay?: boolean;
|
|
174
208
|
}
|
|
175
209
|
export type WebBotSigningKey = {
|
|
176
210
|
privateKey: AdcpJsonWebKey;
|
|
@@ -178,6 +212,11 @@ export type WebBotSigningKey = {
|
|
|
178
212
|
publicKey: AdcpJsonWebKey;
|
|
179
213
|
provider: SigningProvider;
|
|
180
214
|
};
|
|
215
|
+
/**
|
|
216
|
+
* Sign a request under the profile: one `web-bot-auth` signature labelled
|
|
217
|
+
* `label`, one covered `Signature-Agent` member naming `origin`, a 64-byte
|
|
218
|
+
* nonce, and a lifetime of at most 300 seconds.
|
|
219
|
+
*/
|
|
181
220
|
export declare function signWebBotAuth(request: RequestLike, key: WebBotSigningKey, options: WebBotSigningOptions): Promise<Record<string, string>>;
|
|
182
221
|
/** Regenerate after rotation and periodically before proofs expire. No private material is published. */
|
|
183
222
|
export declare function createSignedSignatureDirectory(originUrl: string, signingKeys: WebBotSigningKey[], options?: {
|