@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,4 @@
|
|
|
1
|
-
import { ParseError, parseDictionary, serializeInnerList } from "structured-headers";
|
|
1
|
+
import { ParseError, parseDictionary, serializeInnerList, serializeItem } from "structured-headers";
|
|
2
2
|
import { RequestSignatureError } from "./errors.mjs";
|
|
3
3
|
import { isPaddedStandardBase64 } from "./content-digest.mjs";
|
|
4
4
|
const STRING_PARAMS = /* @__PURE__ */ new Set(["nonce", "keyid", "alg", "tag"]);
|
|
@@ -6,7 +6,7 @@ const INTEGER_PARAMS = /* @__PURE__ */ new Set(["created", "expires"]);
|
|
|
6
6
|
function malformed(message) {
|
|
7
7
|
throw new RequestSignatureError("request_signature_header_malformed", 1, message);
|
|
8
8
|
}
|
|
9
|
-
function parseSignatureInput(headerValue) {
|
|
9
|
+
function parseSignatureInput(headerValue, expectedLabel) {
|
|
10
10
|
rejectDuplicateDictionaryKeys(headerValue, "Signature-Input");
|
|
11
11
|
let dict;
|
|
12
12
|
try {
|
|
@@ -16,7 +16,8 @@ function parseSignatureInput(headerValue) {
|
|
|
16
16
|
throw e;
|
|
17
17
|
}
|
|
18
18
|
if (dict.size === 0) malformed("Signature-Input header is empty");
|
|
19
|
-
const label = dict.has("sig1") ? "sig1" : dict.keys().next().value;
|
|
19
|
+
const label = expectedLabel ?? (dict.has("sig1") ? "sig1" : dict.keys().next().value);
|
|
20
|
+
if (!dict.has(label)) malformed("Signature-Input label is missing");
|
|
20
21
|
const entry = dict.get(label);
|
|
21
22
|
if (!isInnerList(entry)) {
|
|
22
23
|
malformed("Signature-Input value must be a parenthesized component list");
|
|
@@ -24,7 +25,8 @@ function parseSignatureInput(headerValue) {
|
|
|
24
25
|
const components = [];
|
|
25
26
|
for (const [bare, itemParams] of entry[0]) {
|
|
26
27
|
if (typeof bare !== "string") malformed("Signature-Input components must all be strings");
|
|
27
|
-
|
|
28
|
+
const serialized = serializeItem([bare, itemParams]);
|
|
29
|
+
components.push(`${bare}${serialized.slice(serialized.indexOf('"', 1) + 1)}`);
|
|
28
30
|
}
|
|
29
31
|
const params = {};
|
|
30
32
|
for (const [key, value] of entry[1]) {
|
|
@@ -84,85 +86,101 @@ function isInnerList(entry) {
|
|
|
84
86
|
return Array.isArray(entry) && Array.isArray(entry[0]);
|
|
85
87
|
}
|
|
86
88
|
function rejectDuplicateDictionaryKeys(headerValue, headerName) {
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
if (seen.has(key)) {
|
|
91
|
-
malformed(`${headerName} header declares key "${key}" more than once`);
|
|
92
|
-
}
|
|
93
|
-
seen.add(key);
|
|
94
|
-
}
|
|
89
|
+
const duplicate = findDuplicateStructuredKey(headerValue);
|
|
90
|
+
if (duplicate?.kind === "member") malformed(`${headerName} header declares key "${duplicate.key}" more than once`);
|
|
91
|
+
if (duplicate) malformed(`${headerName} header declares parameter "${duplicate.key}" more than once`);
|
|
95
92
|
}
|
|
96
|
-
function
|
|
97
|
-
const keys = [];
|
|
93
|
+
function findDuplicateStructuredKey(input) {
|
|
98
94
|
let i = 0;
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
95
|
+
const n = input.length;
|
|
96
|
+
const ows = () => {
|
|
97
|
+
while (i < n && (input[i] === " " || input[i] === " ")) i++;
|
|
98
|
+
};
|
|
99
|
+
const key = () => {
|
|
100
|
+
const start = i;
|
|
101
|
+
while (i < n && /[A-Za-z0-9_.*-]/.test(input[i])) i++;
|
|
102
|
+
return input.slice(start, i).toLowerCase();
|
|
103
|
+
};
|
|
104
|
+
const bareItem = () => {
|
|
105
|
+
if (input[i] === "%" && input[i + 1] === '"') {
|
|
106
|
+
i += 2;
|
|
107
|
+
while (i < n && input[i] !== '"') i++;
|
|
108
|
+
i++;
|
|
109
|
+
return;
|
|
109
110
|
}
|
|
110
|
-
|
|
111
|
-
if (ch === '"') {
|
|
111
|
+
if (input[i] === '"') {
|
|
112
112
|
i++;
|
|
113
|
-
while (i <
|
|
114
|
-
if (input[i] === "\\"
|
|
113
|
+
while (i < n) {
|
|
114
|
+
if (input[i] === "\\") {
|
|
115
115
|
i += 2;
|
|
116
116
|
continue;
|
|
117
117
|
}
|
|
118
|
-
if (input[i] === '"')
|
|
119
|
-
i++;
|
|
120
|
-
break;
|
|
121
|
-
}
|
|
122
|
-
i++;
|
|
118
|
+
if (input[i++] === '"') return;
|
|
123
119
|
}
|
|
124
|
-
|
|
120
|
+
return;
|
|
125
121
|
}
|
|
126
|
-
if (
|
|
122
|
+
if (input[i] === ":") {
|
|
127
123
|
i++;
|
|
128
|
-
while (i <
|
|
129
|
-
|
|
130
|
-
|
|
124
|
+
while (i < n && input[i] !== ":") i++;
|
|
125
|
+
i++;
|
|
126
|
+
return;
|
|
131
127
|
}
|
|
132
|
-
|
|
128
|
+
while (i < n && !/[;,()\s"]/.test(input[i])) i++;
|
|
129
|
+
};
|
|
130
|
+
const parameters = () => {
|
|
131
|
+
const seen = /* @__PURE__ */ new Set();
|
|
132
|
+
while (i < n && input[i] === ";") {
|
|
133
133
|
i++;
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
if (input[i] === "\\" && i + 1 < len) {
|
|
141
|
-
i += 2;
|
|
142
|
-
continue;
|
|
143
|
-
}
|
|
144
|
-
if (input[i] === '"') {
|
|
145
|
-
i++;
|
|
146
|
-
break;
|
|
147
|
-
}
|
|
148
|
-
i++;
|
|
149
|
-
}
|
|
150
|
-
continue;
|
|
151
|
-
}
|
|
152
|
-
if (c === "(") depth++;
|
|
153
|
-
else if (c === ")") depth--;
|
|
134
|
+
ows();
|
|
135
|
+
const k = key();
|
|
136
|
+
if (!k) return void 0;
|
|
137
|
+
if (seen.has(k)) return k;
|
|
138
|
+
seen.add(k);
|
|
139
|
+
if (input[i] === "=") {
|
|
154
140
|
i++;
|
|
141
|
+
bareItem();
|
|
155
142
|
}
|
|
156
|
-
continue;
|
|
157
143
|
}
|
|
158
|
-
|
|
159
|
-
|
|
144
|
+
return void 0;
|
|
145
|
+
};
|
|
146
|
+
const members = /* @__PURE__ */ new Set();
|
|
147
|
+
while (i < n) {
|
|
148
|
+
ows();
|
|
149
|
+
const k = key();
|
|
150
|
+
if (!k) return void 0;
|
|
151
|
+
if (members.has(k)) return { kind: "member", key: k };
|
|
152
|
+
members.add(k);
|
|
153
|
+
let duplicate;
|
|
154
|
+
if (input[i] === "=") {
|
|
160
155
|
i++;
|
|
161
|
-
|
|
162
|
-
|
|
156
|
+
if (input[i] === "(") {
|
|
157
|
+
i++;
|
|
158
|
+
for (; ; ) {
|
|
159
|
+
while (i < n && input[i] === " ") i++;
|
|
160
|
+
if (i >= n) return void 0;
|
|
161
|
+
if (input[i] === ")") {
|
|
162
|
+
i++;
|
|
163
|
+
break;
|
|
164
|
+
}
|
|
165
|
+
const before = i;
|
|
166
|
+
bareItem();
|
|
167
|
+
duplicate = parameters();
|
|
168
|
+
if (duplicate) return { kind: "parameter", key: `${k}: ${duplicate}` };
|
|
169
|
+
if (i === before) return void 0;
|
|
170
|
+
}
|
|
171
|
+
duplicate = parameters();
|
|
172
|
+
} else {
|
|
173
|
+
bareItem();
|
|
174
|
+
duplicate = parameters();
|
|
175
|
+
}
|
|
176
|
+
} else duplicate = parameters();
|
|
177
|
+
if (duplicate) return { kind: "parameter", key: `${k}: ${duplicate}` };
|
|
178
|
+
ows();
|
|
179
|
+
if (i >= n) return void 0;
|
|
180
|
+
if (input[i] !== ",") return void 0;
|
|
163
181
|
i++;
|
|
164
182
|
}
|
|
165
|
-
return
|
|
183
|
+
return void 0;
|
|
166
184
|
}
|
|
167
185
|
function normalizeByteSequenceBase64(input) {
|
|
168
186
|
let out = "";
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
+
import type { RevocationDetail } from '../identity-3.3/types.mjs';
|
|
1
2
|
import type { RevocationSnapshot } from './types.mjs';
|
|
2
3
|
export interface RevocationStore {
|
|
3
4
|
isRevoked(keyid: string): Promise<boolean>;
|
|
4
5
|
}
|
|
5
6
|
export declare class InMemoryRevocationStore implements RevocationStore {
|
|
6
|
-
private revokedKids;
|
|
7
|
+
private readonly revokedKids;
|
|
8
|
+
private readonly details;
|
|
7
9
|
constructor(snapshot?: RevocationSnapshot);
|
|
8
10
|
load(snapshot: RevocationSnapshot): void;
|
|
11
|
+
getDetails(keyid: string): RevocationDetail | undefined;
|
|
9
12
|
isRevoked(keyid: string): Promise<boolean>;
|
|
10
13
|
}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
+
import type { RevocationDetail } from '../identity-3.3/types';
|
|
1
2
|
import type { RevocationSnapshot } from './types';
|
|
2
3
|
export interface RevocationStore {
|
|
3
4
|
isRevoked(keyid: string): Promise<boolean>;
|
|
4
5
|
}
|
|
5
6
|
export declare class InMemoryRevocationStore implements RevocationStore {
|
|
6
|
-
private revokedKids;
|
|
7
|
+
private readonly revokedKids;
|
|
8
|
+
private readonly details;
|
|
7
9
|
constructor(snapshot?: RevocationSnapshot);
|
|
8
10
|
load(snapshot: RevocationSnapshot): void;
|
|
11
|
+
getDetails(keyid: string): RevocationDetail | undefined;
|
|
9
12
|
isRevoked(keyid: string): Promise<boolean>;
|
|
10
13
|
}
|
|
@@ -18,22 +18,55 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var revocation_exports = {};
|
|
20
20
|
__export(revocation_exports, {
|
|
21
|
-
InMemoryRevocationStore: () => InMemoryRevocationStore
|
|
21
|
+
InMemoryRevocationStore: () => InMemoryRevocationStore,
|
|
22
|
+
mergeRevocationDetails: () => mergeRevocationDetails
|
|
22
23
|
});
|
|
23
24
|
module.exports = __toCommonJS(revocation_exports);
|
|
24
25
|
class InMemoryRevocationStore {
|
|
25
26
|
revokedKids = /* @__PURE__ */ new Set();
|
|
27
|
+
details = /* @__PURE__ */ new Map();
|
|
26
28
|
constructor(snapshot) {
|
|
27
29
|
if (snapshot) this.load(snapshot);
|
|
28
30
|
}
|
|
29
31
|
load(snapshot) {
|
|
30
|
-
|
|
32
|
+
if ((/* @__PURE__ */ new Set([...this.revokedKids, ...snapshot.revoked_kids])).size > 1e5)
|
|
33
|
+
throw new RangeError("Revocation store capacity exceeded");
|
|
34
|
+
for (const kid of snapshot.revoked_kids) {
|
|
35
|
+
this.revokedKids.add(kid);
|
|
36
|
+
const detail = snapshot.revocation_details?.[kid];
|
|
37
|
+
this.details.set(kid, mergeRevocationDetails(this.details.get(kid), detail ?? {}));
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
getDetails(keyid) {
|
|
41
|
+
const detail = this.details.get(keyid);
|
|
42
|
+
return detail && { ...detail };
|
|
31
43
|
}
|
|
32
44
|
async isRevoked(keyid) {
|
|
33
45
|
return this.revokedKids.has(keyid);
|
|
34
46
|
}
|
|
35
47
|
}
|
|
48
|
+
const REASONS = [
|
|
49
|
+
"removeFromCRL",
|
|
50
|
+
"unspecified",
|
|
51
|
+
"superseded",
|
|
52
|
+
"cessationOfOperation",
|
|
53
|
+
"affiliationChanged",
|
|
54
|
+
"certificateHold",
|
|
55
|
+
"privilegeWithdrawn",
|
|
56
|
+
"aACompromise",
|
|
57
|
+
"cACompromise",
|
|
58
|
+
"keyCompromise"
|
|
59
|
+
];
|
|
60
|
+
function mergeRevocationDetails(prior, detail) {
|
|
61
|
+
const reason = REASONS.indexOf(detail.reason ?? "unspecified") > REASONS.indexOf(prior?.reason ?? "unspecified") ? detail.reason : prior?.reason ?? detail.reason;
|
|
62
|
+
const hasValidDate = (entry) => !!entry?.invalidity_date && Number.isFinite(Date.parse(entry.invalidity_date));
|
|
63
|
+
if (reason === "keyCompromise" && [prior, detail].some((entry) => entry?.reason === "keyCompromise" && !hasValidDate(entry)))
|
|
64
|
+
return { reason };
|
|
65
|
+
const dates = [prior?.invalidity_date, detail.invalidity_date].filter((s) => !!s && Number.isFinite(Date.parse(s))).sort((a, b) => Date.parse(a) - Date.parse(b));
|
|
66
|
+
return { ...reason ? { reason } : {}, ...dates[0] ? { invalidity_date: dates[0] } : {} };
|
|
67
|
+
}
|
|
36
68
|
// Annotate the CommonJS export names for ESM import in node:
|
|
37
69
|
0 && (module.exports = {
|
|
38
|
-
InMemoryRevocationStore
|
|
70
|
+
InMemoryRevocationStore,
|
|
71
|
+
mergeRevocationDetails
|
|
39
72
|
});
|
|
@@ -1,15 +1,47 @@
|
|
|
1
1
|
class InMemoryRevocationStore {
|
|
2
2
|
revokedKids = /* @__PURE__ */ new Set();
|
|
3
|
+
details = /* @__PURE__ */ new Map();
|
|
3
4
|
constructor(snapshot) {
|
|
4
5
|
if (snapshot) this.load(snapshot);
|
|
5
6
|
}
|
|
6
7
|
load(snapshot) {
|
|
7
|
-
|
|
8
|
+
if ((/* @__PURE__ */ new Set([...this.revokedKids, ...snapshot.revoked_kids])).size > 1e5)
|
|
9
|
+
throw new RangeError("Revocation store capacity exceeded");
|
|
10
|
+
for (const kid of snapshot.revoked_kids) {
|
|
11
|
+
this.revokedKids.add(kid);
|
|
12
|
+
const detail = snapshot.revocation_details?.[kid];
|
|
13
|
+
this.details.set(kid, mergeRevocationDetails(this.details.get(kid), detail ?? {}));
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
getDetails(keyid) {
|
|
17
|
+
const detail = this.details.get(keyid);
|
|
18
|
+
return detail && { ...detail };
|
|
8
19
|
}
|
|
9
20
|
async isRevoked(keyid) {
|
|
10
21
|
return this.revokedKids.has(keyid);
|
|
11
22
|
}
|
|
12
23
|
}
|
|
24
|
+
const REASONS = [
|
|
25
|
+
"removeFromCRL",
|
|
26
|
+
"unspecified",
|
|
27
|
+
"superseded",
|
|
28
|
+
"cessationOfOperation",
|
|
29
|
+
"affiliationChanged",
|
|
30
|
+
"certificateHold",
|
|
31
|
+
"privilegeWithdrawn",
|
|
32
|
+
"aACompromise",
|
|
33
|
+
"cACompromise",
|
|
34
|
+
"keyCompromise"
|
|
35
|
+
];
|
|
36
|
+
function mergeRevocationDetails(prior, detail) {
|
|
37
|
+
const reason = REASONS.indexOf(detail.reason ?? "unspecified") > REASONS.indexOf(prior?.reason ?? "unspecified") ? detail.reason : prior?.reason ?? detail.reason;
|
|
38
|
+
const hasValidDate = (entry) => !!entry?.invalidity_date && Number.isFinite(Date.parse(entry.invalidity_date));
|
|
39
|
+
if (reason === "keyCompromise" && [prior, detail].some((entry) => entry?.reason === "keyCompromise" && !hasValidDate(entry)))
|
|
40
|
+
return { reason };
|
|
41
|
+
const dates = [prior?.invalidity_date, detail.invalidity_date].filter((s) => !!s && Number.isFinite(Date.parse(s))).sort((a, b) => Date.parse(a) - Date.parse(b));
|
|
42
|
+
return { ...reason ? { reason } : {}, ...dates[0] ? { invalidity_date: dates[0] } : {} };
|
|
43
|
+
}
|
|
13
44
|
export {
|
|
14
|
-
InMemoryRevocationStore
|
|
45
|
+
InMemoryRevocationStore,
|
|
46
|
+
mergeRevocationDetails
|
|
15
47
|
};
|
|
@@ -30,5 +30,5 @@ export { createWebhookVerifier, isWebhookLoopbackHost, verifyWebhookSignature, W
|
|
|
30
30
|
export { createExpressVerifier, type ExpressLike, type ExpressMiddlewareOptions } from './middleware.mjs';
|
|
31
31
|
export { finalizeResponseSignature, prepareResponseSignature, signResponse, type PreparedResponseSignature, type SignedResponse, type SignResponseOptions, } from './signer.mjs';
|
|
32
32
|
export { signResponseAsync } from './signer-async.mjs';
|
|
33
|
-
export { resolveAgent, ResolvedAgentJwksResolver, getAgentJwks, createAgentJwksSet, AgentResolverError, attackerInfluencedFields, ATTACKER_INFLUENCED, readBrandJsonUrl, readIdentityPosture, type AgentResolution, type AgentProtocol, type AuthorizedOperatorScope, type DelegatedOperatorAuthorizationContext, type AgentResolverErrorCode, type AgentResolverErrorDetail, type AgentEntry, type AgentJwksResult, type CapabilitiesWithBrandJsonUrl, type CreateAgentJwksSetOptions, type FetchCapabilitiesFn, type GetAgentJwksOptions, type IdentityKeyOriginPurpose, type IdentityKeyOrigins, type IdentityPosture, type ResolveAgentOptions, type ResolvedAgentJwksResolverOptions, type TraceStep, } from './agent-resolver/index.mjs';
|
|
33
|
+
export { resolveAgent, ResolvedAgentJwksResolver, canonicalAgentOrigin, CanonicalizeError, getAgentJwks, createAgentJwksSet, AgentResolverError, attackerInfluencedFields, ATTACKER_INFLUENCED, readBrandJsonUrl, readIdentityPosture, type AgentResolution, type AgentProtocol, type AuthorizedOperatorScope, type DelegatedOperatorAuthorizationContext, type AgentResolverErrorCode, type AgentResolverErrorDetail, type AgentEntry, type AgentJwksResult, type CapabilitiesWithBrandJsonUrl, type CreateAgentJwksSetOptions, type FetchCapabilitiesFn, type GetAgentJwksOptions, type IdentityKeyOriginPurpose, type IdentityKeyOrigins, type IdentityPosture, type ResolveAgentOptions, type ResolvedAgentJwksResolverOptions, type TraceStep, } from './agent-resolver/index.mjs';
|
|
34
34
|
export type { PublisherSigningKeyPin } from './publisher-pins.mjs';
|
|
@@ -30,5 +30,5 @@ export { createWebhookVerifier, isWebhookLoopbackHost, verifyWebhookSignature, W
|
|
|
30
30
|
export { createExpressVerifier, type ExpressLike, type ExpressMiddlewareOptions } from './middleware';
|
|
31
31
|
export { finalizeResponseSignature, prepareResponseSignature, signResponse, type PreparedResponseSignature, type SignedResponse, type SignResponseOptions, } from './signer';
|
|
32
32
|
export { signResponseAsync } from './signer-async';
|
|
33
|
-
export { resolveAgent, ResolvedAgentJwksResolver, getAgentJwks, createAgentJwksSet, AgentResolverError, attackerInfluencedFields, ATTACKER_INFLUENCED, readBrandJsonUrl, readIdentityPosture, type AgentResolution, type AgentProtocol, type AuthorizedOperatorScope, type DelegatedOperatorAuthorizationContext, type AgentResolverErrorCode, type AgentResolverErrorDetail, type AgentEntry, type AgentJwksResult, type CapabilitiesWithBrandJsonUrl, type CreateAgentJwksSetOptions, type FetchCapabilitiesFn, type GetAgentJwksOptions, type IdentityKeyOriginPurpose, type IdentityKeyOrigins, type IdentityPosture, type ResolveAgentOptions, type ResolvedAgentJwksResolverOptions, type TraceStep, } from './agent-resolver';
|
|
33
|
+
export { resolveAgent, ResolvedAgentJwksResolver, canonicalAgentOrigin, CanonicalizeError, getAgentJwks, createAgentJwksSet, AgentResolverError, attackerInfluencedFields, ATTACKER_INFLUENCED, readBrandJsonUrl, readIdentityPosture, type AgentResolution, type AgentProtocol, type AuthorizedOperatorScope, type DelegatedOperatorAuthorizationContext, type AgentResolverErrorCode, type AgentResolverErrorDetail, type AgentEntry, type AgentJwksResult, type CapabilitiesWithBrandJsonUrl, type CreateAgentJwksSetOptions, type FetchCapabilitiesFn, type GetAgentJwksOptions, type IdentityKeyOriginPurpose, type IdentityKeyOrigins, type IdentityPosture, type ResolveAgentOptions, type ResolvedAgentJwksResolverOptions, type TraceStep, } from './agent-resolver';
|
|
34
34
|
export type { PublisherSigningKeyPin } from './publisher-pins';
|
|
@@ -24,6 +24,7 @@ __export(server_exports, {
|
|
|
24
24
|
BrandJsonJwksResolver: () => import_brand_jwks.BrandJsonJwksResolver,
|
|
25
25
|
BrandJsonResolverError: () => import_brand_jwks.BrandJsonResolverError,
|
|
26
26
|
CLOCK_SKEW_TOLERANCE_SECONDS: () => import_types.CLOCK_SKEW_TOLERANCE_SECONDS,
|
|
27
|
+
CanonicalizeError: () => import_agent_resolver.CanonicalizeError,
|
|
27
28
|
HttpsJwksResolver: () => import_jwks_https.HttpsJwksResolver,
|
|
28
29
|
HttpsRevocationStore: () => import_revocation_https.HttpsRevocationStore,
|
|
29
30
|
InMemoryReplayStore: () => import_replay.InMemoryReplayStore,
|
|
@@ -48,6 +49,7 @@ __export(server_exports, {
|
|
|
48
49
|
attackerInfluencedFields: () => import_agent_resolver.attackerInfluencedFields,
|
|
49
50
|
buildResponseSignatureBase: () => import_canonicalize.buildResponseSignatureBase,
|
|
50
51
|
buildSignatureBase: () => import_canonicalize.buildSignatureBase,
|
|
52
|
+
canonicalAgentOrigin: () => import_agent_resolver.canonicalAgentOrigin,
|
|
51
53
|
canonicalAuthority: () => import_canonicalize.canonicalAuthority,
|
|
52
54
|
canonicalMethod: () => import_canonicalize.canonicalMethod,
|
|
53
55
|
canonicalTargetUri: () => import_canonicalize.canonicalTargetUri,
|
|
@@ -114,6 +116,7 @@ var import_agent_resolver = require('./agent-resolver/index.js');
|
|
|
114
116
|
BrandJsonJwksResolver,
|
|
115
117
|
BrandJsonResolverError,
|
|
116
118
|
CLOCK_SKEW_TOLERANCE_SECONDS,
|
|
119
|
+
CanonicalizeError,
|
|
117
120
|
HttpsJwksResolver,
|
|
118
121
|
HttpsRevocationStore,
|
|
119
122
|
InMemoryReplayStore,
|
|
@@ -138,6 +141,7 @@ var import_agent_resolver = require('./agent-resolver/index.js');
|
|
|
138
141
|
attackerInfluencedFields,
|
|
139
142
|
buildResponseSignatureBase,
|
|
140
143
|
buildSignatureBase,
|
|
144
|
+
canonicalAgentOrigin,
|
|
141
145
|
canonicalAuthority,
|
|
142
146
|
canonicalMethod,
|
|
143
147
|
canonicalTargetUri,
|
|
@@ -74,6 +74,8 @@ import { signResponseAsync } from "./signer-async.mjs";
|
|
|
74
74
|
import {
|
|
75
75
|
resolveAgent,
|
|
76
76
|
ResolvedAgentJwksResolver,
|
|
77
|
+
canonicalAgentOrigin,
|
|
78
|
+
CanonicalizeError,
|
|
77
79
|
getAgentJwks,
|
|
78
80
|
createAgentJwksSet,
|
|
79
81
|
AgentResolverError,
|
|
@@ -89,6 +91,7 @@ export {
|
|
|
89
91
|
BrandJsonJwksResolver,
|
|
90
92
|
BrandJsonResolverError,
|
|
91
93
|
CLOCK_SKEW_TOLERANCE_SECONDS,
|
|
94
|
+
CanonicalizeError,
|
|
92
95
|
HttpsJwksResolver,
|
|
93
96
|
HttpsRevocationStore,
|
|
94
97
|
InMemoryReplayStore,
|
|
@@ -113,6 +116,7 @@ export {
|
|
|
113
116
|
attackerInfluencedFields,
|
|
114
117
|
buildResponseSignatureBase,
|
|
115
118
|
buildSignatureBase,
|
|
119
|
+
canonicalAgentOrigin,
|
|
116
120
|
canonicalAuthority,
|
|
117
121
|
canonicalMethod,
|
|
118
122
|
canonicalTargetUri,
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export type ContentDigestPolicy = 'required' | 'forbidden' | 'either';
|
|
2
2
|
export interface VerifierCapability {
|
|
3
|
+
profiles?: ('adcp/request-signing/v1' | 'web-bot-auth')[];
|
|
4
|
+
wba_draft_revision?: string;
|
|
3
5
|
supported: boolean;
|
|
4
6
|
covers_content_digest: ContentDigestPolicy;
|
|
5
7
|
required_for: string[];
|
|
@@ -46,6 +48,7 @@ export interface RevocationSnapshot {
|
|
|
46
48
|
next_update: string;
|
|
47
49
|
revoked_kids: string[];
|
|
48
50
|
revoked_jtis: string[];
|
|
51
|
+
revocation_details?: Record<string, import('../identity-3.3/types.mjs').RevocationDetail>;
|
|
49
52
|
}
|
|
50
53
|
/**
|
|
51
54
|
* Narrow "successfully verified" shape. Middleware sets `req.verifiedSigner`
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export type ContentDigestPolicy = 'required' | 'forbidden' | 'either';
|
|
2
2
|
export interface VerifierCapability {
|
|
3
|
+
profiles?: ('adcp/request-signing/v1' | 'web-bot-auth')[];
|
|
4
|
+
wba_draft_revision?: string;
|
|
3
5
|
supported: boolean;
|
|
4
6
|
covers_content_digest: ContentDigestPolicy;
|
|
5
7
|
required_for: string[];
|
|
@@ -46,6 +48,7 @@ export interface RevocationSnapshot {
|
|
|
46
48
|
next_update: string;
|
|
47
49
|
revoked_kids: string[];
|
|
48
50
|
revoked_jtis: string[];
|
|
51
|
+
revocation_details?: Record<string, import('../identity-3.3/types').RevocationDetail>;
|
|
49
52
|
}
|
|
50
53
|
/**
|
|
51
54
|
* Narrow "successfully verified" shape. Middleware sets `req.verifiedSigner`
|
|
@@ -239,7 +239,7 @@ async function verifyRequestSignature(request, options) {
|
|
|
239
239
|
"Delegated operator authorization expired during verification"
|
|
240
240
|
);
|
|
241
241
|
}
|
|
242
|
-
const remaining = parsedInput.params.expires - now + import_types.CLOCK_SKEW_TOLERANCE_SECONDS;
|
|
242
|
+
const remaining = parsedInput.params.expires - now + import_types.CLOCK_SKEW_TOLERANCE_SECONDS + 1;
|
|
243
243
|
const ttl = Math.max(remaining, import_types.MAX_SIGNATURE_WINDOW_SECONDS + import_types.CLOCK_SKEW_TOLERANCE_SECONDS);
|
|
244
244
|
const insertResult = await options.replayStore.insert(jwk.kid, replayScope, parsedInput.params.nonce, ttl, now);
|
|
245
245
|
if (insertResult === "replayed") {
|
|
@@ -228,7 +228,7 @@ async function verifyRequestSignature(request, options) {
|
|
|
228
228
|
"Delegated operator authorization expired during verification"
|
|
229
229
|
);
|
|
230
230
|
}
|
|
231
|
-
const remaining = parsedInput.params.expires - now + CLOCK_SKEW_TOLERANCE_SECONDS;
|
|
231
|
+
const remaining = parsedInput.params.expires - now + CLOCK_SKEW_TOLERANCE_SECONDS + 1;
|
|
232
232
|
const ttl = Math.max(remaining, MAX_SIGNATURE_WINDOW_SECONDS + CLOCK_SKEW_TOLERANCE_SECONDS);
|
|
233
233
|
const insertResult = await options.replayStore.insert(jwk.kid, replayScope, parsedInput.params.nonce, ttl, now);
|
|
234
234
|
if (insertResult === "replayed") {
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { type SsrfFetchOptions } from '../net/index.mjs';
|
|
2
|
+
import { type RequestLike, type ResponseLike } from './canonicalize.mjs';
|
|
3
|
+
import { type ParsedSignatureInput } from './parser.mjs';
|
|
4
|
+
import type { JwksResolver } from './jwks.mjs';
|
|
5
|
+
import type { ReplayStore } from './replay.mjs';
|
|
6
|
+
import type { AdcpJsonWebKey } from './types.mjs';
|
|
7
|
+
import type { SigningProvider } from './provider.mjs';
|
|
8
|
+
export declare const WEB_BOT_AUTH_PROFILE: "web-bot-auth";
|
|
9
|
+
export declare const WEB_BOT_AUTH_DRAFT_REVISION: "draft-ietf-webbotauth-httpsig-protocol-00";
|
|
10
|
+
export declare const SIGNATURE_DIRECTORY_PATH = "/.well-known/http-message-signatures-directory";
|
|
11
|
+
export declare const SIGNATURE_DIRECTORY_MEDIA_TYPE = "application/http-message-signatures-directory+json";
|
|
12
|
+
/**
|
|
13
|
+
* Signature-path outcome (WBA §4, DR-0023): 400 for a field that does not
|
|
14
|
+
* parse, 403 for a signature that does not verify (with `Accept-Signature`
|
|
15
|
+
* unless the key is revoked), 429 for a replay. Any AdCP body is the generic
|
|
16
|
+
* authentication error; signature-specific detail stays in `reason` (logs).
|
|
17
|
+
* Infrastructure the verifier depends on is reported separately by
|
|
18
|
+
* {@link WebBotAuthUnavailableError}.
|
|
19
|
+
*/
|
|
20
|
+
export declare class WebBotAuthError extends Error {
|
|
21
|
+
readonly status: 400 | 403 | 429;
|
|
22
|
+
readonly reason: string;
|
|
23
|
+
readonly headers: Record<string, string>;
|
|
24
|
+
get body(): Record<string, unknown>;
|
|
25
|
+
/**
|
|
26
|
+
* The signer's identity could not be established because key discovery
|
|
27
|
+
* failed (WBA §6.10) or its revocation status is unknown. The request is
|
|
28
|
+
* unverified; servers apply their unverified-request policy.
|
|
29
|
+
*/
|
|
30
|
+
get unverified(): boolean;
|
|
31
|
+
constructor(status: 400 | 403 | 429, reason: string);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Infrastructure the verifier depends on failed (replay store, revocation
|
|
35
|
+
* history store). Not a signature outcome and never answered as one: the
|
|
36
|
+
* application layer decides how to report the outage (the SDK's server
|
|
37
|
+
* integrations answer 503 SERVICE_UNAVAILABLE).
|
|
38
|
+
*/
|
|
39
|
+
export declare class WebBotAuthUnavailableError extends Error {
|
|
40
|
+
readonly reason: string;
|
|
41
|
+
constructor(reason: string, cause?: unknown);
|
|
42
|
+
}
|
|
43
|
+
export declare function selectSignatureProfile(request: Pick<RequestLike, 'headers'>): 'web-bot-auth' | 'rfc9421';
|
|
44
|
+
/**
|
|
45
|
+
* RFC 7638 JWK SHA-256 thumbprint, synchronous. Byte-identical to jose's
|
|
46
|
+
* `calculateJwkThumbprint` for OKP, EC and RSA keys (tested).
|
|
47
|
+
*/
|
|
48
|
+
export declare function jwkThumbprint(jwk: Partial<Pick<AdcpJsonWebKey, 'kty' | 'crv' | 'x' | 'y'>> & {
|
|
49
|
+
n?: unknown;
|
|
50
|
+
e?: unknown;
|
|
51
|
+
}): string;
|
|
52
|
+
/** Reject authority normalization differentials on received identifiers. */
|
|
53
|
+
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
|
+
export declare function getWebBotAuthLegacyOriginGate(resolver: Function | undefined): ((origin: string) => Promise<void>) | undefined;
|
|
57
|
+
export interface WebBotAuthAuthorizationFailure {
|
|
58
|
+
code: 'PERMISSION_DENIED' | 'SERVICE_UNAVAILABLE';
|
|
59
|
+
message: string;
|
|
60
|
+
recovery: 'correctable' | 'transient';
|
|
61
|
+
}
|
|
62
|
+
declare const AUTHORIZATION_FAILURE_MESSAGES: {
|
|
63
|
+
readonly key_revoked: "Agent identity key is revoked";
|
|
64
|
+
readonly identity_not_bound: "Agent identity is not onboarded for this operation";
|
|
65
|
+
readonly revocation_unavailable: "Identity revocation information is unavailable";
|
|
66
|
+
readonly authorization_failed: "Agent authorization failed";
|
|
67
|
+
readonly authorization_unavailable: "Agent authorization is temporarily unavailable";
|
|
68
|
+
};
|
|
69
|
+
export declare function createWebBotAuthAuthorizationFailure(reason: keyof typeof AUTHORIZATION_FAILURE_MESSAGES): WebBotAuthAuthorizationFailure;
|
|
70
|
+
export declare function getWebBotAuthAuthorizationFailure(extra: Record<string, unknown> | undefined): WebBotAuthAuthorizationFailure | undefined;
|
|
71
|
+
export declare function webBotAuthToolFailure(failure: WebBotAuthAuthorizationFailure, version?: string): {
|
|
72
|
+
isError: true;
|
|
73
|
+
content: Array<{
|
|
74
|
+
type: 'text';
|
|
75
|
+
text: string;
|
|
76
|
+
}>;
|
|
77
|
+
};
|
|
78
|
+
export declare function isVerifiedWebBotSigner(value: unknown): value is VerifiedWebBotSigner;
|
|
79
|
+
export interface VerifiedWebBotSigner {
|
|
80
|
+
profile: 'web-bot-auth';
|
|
81
|
+
origin: string;
|
|
82
|
+
keyid: string;
|
|
83
|
+
label: string;
|
|
84
|
+
verified_at: number;
|
|
85
|
+
authorizationFailure?: WebBotAuthAuthorizationFailure;
|
|
86
|
+
}
|
|
87
|
+
export interface VerifyWebBotAuthOptions {
|
|
88
|
+
/** Key discovery (WBA §5.5). The only network dependency of verification. */
|
|
89
|
+
directory: SignatureDirectoryResolver;
|
|
90
|
+
/** Published fixture keys are allowed only outside production. */
|
|
91
|
+
allowTestKeys?: boolean;
|
|
92
|
+
/** Atomic, shared across endpoints and replicas. Nonce scope is the identity origin, not the rotating kid. */
|
|
93
|
+
replayStore: ReplayStore;
|
|
94
|
+
now?: () => number;
|
|
95
|
+
/** Older #7894 vector draft expects 403; ratified R2 defaults to 429. */
|
|
96
|
+
replayStatus?: 403 | 429;
|
|
97
|
+
/**
|
|
98
|
+
* @deprecated Revocation is an identity and authorization check, not part of
|
|
99
|
+
* signature verification: call `OriginRevocationResolver.status()` after
|
|
100
|
+
* verification (`createIdentity33PrincipalResolver({ revocation })` does).
|
|
101
|
+
* When supplied it is still consulted: a revoked key is a 403 without
|
|
102
|
+
* `Accept-Signature`, unknown status leaves the identity unverified, and a
|
|
103
|
+
* history-store failure is a {@link WebBotAuthUnavailableError}.
|
|
104
|
+
*/
|
|
105
|
+
isRevoked?: (origin: string, keyid: string) => Promise<boolean>;
|
|
106
|
+
/** @deprecated Only affects the deprecated `isRevoked` path: `false` tolerates unknown status. */
|
|
107
|
+
requireFreshRevocation?: boolean;
|
|
108
|
+
/** @deprecated No effect; revocation outcomes are no longer deferred into tool errors. */
|
|
109
|
+
deferAuthorizationErrors?: boolean;
|
|
110
|
+
}
|
|
111
|
+
export declare function verifyWebBotAuth(request: RequestLike, options: VerifyWebBotAuthOptions): Promise<VerifiedWebBotSigner[]>;
|
|
112
|
+
export interface VerifiedSignatureDirectory {
|
|
113
|
+
keys: AdcpJsonWebKey[];
|
|
114
|
+
/** Signed: the earliest proof expiry. Unsigned: verification time plus the unsigned-age bound. */
|
|
115
|
+
expires: number;
|
|
116
|
+
/** Whether every key carried an Appendix B signature. */
|
|
117
|
+
signed: boolean;
|
|
118
|
+
/** Preserve exact bytes and response headers for auditing. */
|
|
119
|
+
proof: ResponseLike;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Verify a key directory response (draft-meunier-http-message-signatures-directory).
|
|
123
|
+
* Appendix B signatures are a SHOULD there: a directory without
|
|
124
|
+
* `Signature-Input` is accepted as a plain JWKS unless `requireSigned`, with
|
|
125
|
+
* every key checked against its RFC 7638 thumbprint. When signatures are
|
|
126
|
+
* present, every key must carry a valid one.
|
|
127
|
+
*/
|
|
128
|
+
export declare function verifyKeyDirectory(response: ResponseLike, now?: number, options?: {
|
|
129
|
+
allowTestKeys?: boolean;
|
|
130
|
+
requireSigned?: boolean;
|
|
131
|
+
maxUnsignedAgeSeconds?: number;
|
|
132
|
+
}): VerifiedSignatureDirectory;
|
|
133
|
+
/** Signed directories only (Appendix B). Prefer {@link verifyKeyDirectory}. */
|
|
134
|
+
export declare function verifySignatureDirectory(response: ResponseLike, now?: number, allowTestKeys?: boolean): VerifiedSignatureDirectory;
|
|
135
|
+
export interface SignatureDirectoryResolverOptions {
|
|
136
|
+
now?: () => number;
|
|
137
|
+
fetchOptions?: Pick<SsrfFetchOptions, 'lookup' | 'trustedFetchFn'>;
|
|
138
|
+
allowTestKeys?: boolean;
|
|
139
|
+
maxOrigins?: number;
|
|
140
|
+
/** Globally bound concurrency across attacker-selected origins. */
|
|
141
|
+
maxConcurrentFetches?: number;
|
|
142
|
+
/** Refuse plain JWKS directories without Appendix B signatures. Default false. */
|
|
143
|
+
requireSignedDirectories?: boolean;
|
|
144
|
+
/** How long an unsigned directory may keep verifying after a failed refresh (seconds). Default 86400. */
|
|
145
|
+
maxUnsignedDirectoryAgeSeconds?: number;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Multi-origin key discovery. Cache keys never collapse origins sharing a
|
|
149
|
+
* kid. A failed refresh (any transport error or non-200, 404/410 included) is
|
|
150
|
+
* a discovery failure: it never evicts a cached, unexpired directory, which
|
|
151
|
+
* keeps verifying (WBA §6.10). Without one, the request is unverified.
|
|
152
|
+
*/
|
|
153
|
+
export declare class SignatureDirectoryResolver implements JwksResolver {
|
|
154
|
+
private readonly options;
|
|
155
|
+
private readonly cache;
|
|
156
|
+
private readonly failures;
|
|
157
|
+
private readonly keyMissCooldown;
|
|
158
|
+
private readonly pending;
|
|
159
|
+
constructor(options?: SignatureDirectoryResolverOptions);
|
|
160
|
+
resolve(keyid: string, signerOrigin?: string): Promise<AdcpJsonWebKey | null>;
|
|
161
|
+
private fetch;
|
|
162
|
+
get allowsTestKeys(): boolean;
|
|
163
|
+
/** The directory currently used to verify `origin`, including one kept through a failed refresh. */
|
|
164
|
+
getVerifiedDirectory(origin: string): VerifiedSignatureDirectory | undefined;
|
|
165
|
+
getAuditProof(origin: string): ResponseLike | undefined;
|
|
166
|
+
}
|
|
167
|
+
export interface WebBotSigningOptions {
|
|
168
|
+
origin: string;
|
|
169
|
+
label?: string;
|
|
170
|
+
now?: () => number;
|
|
171
|
+
nonce?: string;
|
|
172
|
+
windowSeconds?: number;
|
|
173
|
+
relay?: boolean;
|
|
174
|
+
}
|
|
175
|
+
export type WebBotSigningKey = {
|
|
176
|
+
privateKey: AdcpJsonWebKey;
|
|
177
|
+
} | {
|
|
178
|
+
publicKey: AdcpJsonWebKey;
|
|
179
|
+
provider: SigningProvider;
|
|
180
|
+
};
|
|
181
|
+
export declare function signWebBotAuth(request: RequestLike, key: WebBotSigningKey, options: WebBotSigningOptions): Promise<Record<string, string>>;
|
|
182
|
+
/** Regenerate after rotation and periodically before proofs expire. No private material is published. */
|
|
183
|
+
export declare function createSignedSignatureDirectory(originUrl: string, signingKeys: WebBotSigningKey[], options?: {
|
|
184
|
+
now?: () => number;
|
|
185
|
+
lifetimeSeconds?: number;
|
|
186
|
+
}): Promise<ResponseLike>;
|
|
187
|
+
/** Inject into the official MCP/A2A transport; signs the final outgoing bytes. */
|
|
188
|
+
export declare function createWebBotAuthFetch(upstream: typeof fetch, key: WebBotSigningKey, options: WebBotSigningOptions & {
|
|
189
|
+
shouldSign?: (url: string, init?: RequestInit) => boolean;
|
|
190
|
+
}): typeof fetch;
|
|
191
|
+
export {};
|