@astrasyncai/verification-gateway 5.19.0 → 5.20.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/CHANGELOG.md +83 -0
- package/README.md +51 -2
- package/dist/adapter-interface/interface.d.mts +2 -2
- package/dist/adapter-interface/interface.d.ts +2 -2
- package/dist/adapters/express.d.mts +1 -1
- package/dist/adapters/express.d.ts +1 -1
- package/dist/adapters/express.js +65 -16
- package/dist/adapters/express.js.map +1 -1
- package/dist/adapters/express.mjs +65 -16
- package/dist/adapters/express.mjs.map +1 -1
- package/dist/adapters/mcp.d.mts +23 -1
- package/dist/adapters/mcp.d.ts +23 -1
- package/dist/adapters/mcp.js +91 -16
- package/dist/adapters/mcp.js.map +1 -1
- package/dist/adapters/mcp.mjs +91 -16
- package/dist/adapters/mcp.mjs.map +1 -1
- package/dist/adapters/nextjs.d.mts +1 -1
- package/dist/adapters/nextjs.d.ts +1 -1
- package/dist/adapters/nextjs.js +57 -11
- package/dist/adapters/nextjs.js.map +1 -1
- package/dist/adapters/nextjs.mjs +57 -11
- package/dist/adapters/nextjs.mjs.map +1 -1
- package/dist/adapters/sdk.d.mts +58 -2
- package/dist/adapters/sdk.d.ts +58 -2
- package/dist/adapters/sdk.js +124 -11
- package/dist/adapters/sdk.js.map +1 -1
- package/dist/adapters/sdk.mjs +124 -11
- package/dist/adapters/sdk.mjs.map +1 -1
- package/dist/agent/index.d.mts +1 -1
- package/dist/agent/index.d.ts +1 -1
- package/dist/agent/index.js +1 -1
- package/dist/agent/index.js.map +1 -1
- package/dist/agent/index.mjs +1 -1
- package/dist/agent/index.mjs.map +1 -1
- package/dist/bin/astrasync-claude-hook.js +49 -11
- package/dist/bin/astrasync-codex-hook.js +49 -11
- package/dist/bin/astrasync-guard.js +49 -11
- package/dist/bin/astrasync.js +51 -12
- package/dist/browser/background.js +49 -11
- package/dist/browser/background.js.map +1 -1
- package/dist/browser/background.mjs +49 -11
- package/dist/browser/background.mjs.map +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/index.mjs +1 -1
- package/dist/cli/index.mjs.map +1 -1
- package/dist/codex/index.js +49 -11
- package/dist/codex/index.js.map +1 -1
- package/dist/codex/index.mjs +49 -11
- package/dist/codex/index.mjs.map +1 -1
- package/dist/cursor/extension.js +49 -11
- package/dist/cursor/extension.js.map +1 -1
- package/dist/cursor/extension.mjs +49 -11
- package/dist/cursor/extension.mjs.map +1 -1
- package/dist/edge-config.d.mts +1 -1
- package/dist/edge-config.d.ts +1 -1
- package/dist/edge-config.js +1 -1
- package/dist/edge-config.js.map +1 -1
- package/dist/edge-config.mjs +1 -1
- package/dist/edge-config.mjs.map +1 -1
- package/dist/edge-core/index.d.mts +1 -1
- package/dist/edge-core/index.d.ts +1 -1
- package/dist/edge-core/index.js +49 -11
- package/dist/edge-core/index.js.map +1 -1
- package/dist/edge-core/index.mjs +49 -11
- package/dist/edge-core/index.mjs.map +1 -1
- package/dist/gateway/gateway.d.mts +2 -2
- package/dist/gateway/gateway.d.ts +2 -2
- package/dist/gateway/gateway.js +49 -11
- package/dist/gateway/gateway.js.map +1 -1
- package/dist/gateway/gateway.mjs +49 -11
- package/dist/gateway/gateway.mjs.map +1 -1
- package/dist/git-trigger/git-hooks.d.mts +1 -1
- package/dist/git-trigger/git-hooks.d.ts +1 -1
- package/dist/index.d.mts +168 -8
- package/dist/index.d.ts +168 -8
- package/dist/index.js +229 -31
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +226 -31
- package/dist/index.mjs.map +1 -1
- package/dist/local-evaluator/evaluator.d.mts +2 -2
- package/dist/local-evaluator/evaluator.d.ts +2 -2
- package/dist/registration/index.d.mts +11 -2
- package/dist/registration/index.d.ts +11 -2
- package/dist/registration/index.js +1 -1
- package/dist/registration/index.js.map +1 -1
- package/dist/registration/index.mjs +1 -1
- package/dist/registration/index.mjs.map +1 -1
- package/dist/transport/index.d.mts +1 -1
- package/dist/transport/index.d.ts +1 -1
- package/dist/transport/index.js +1 -1
- package/dist/transport/index.js.map +1 -1
- package/dist/transport/index.mjs +1 -1
- package/dist/transport/index.mjs.map +1 -1
- package/dist/{types-BRz2U0Pn.d.ts → types-B_HLhZ9n.d.ts} +1 -1
- package/dist/{types-BfILnheI.d.mts → types-CU17R4Nr.d.mts} +11 -0
- package/dist/{types-BfILnheI.d.ts → types-CU17R4Nr.d.ts} +11 -0
- package/dist/{types-DqWPkiYl.d.mts → types-CxjqmPl-.d.mts} +25 -1
- package/dist/{types-DqWPkiYl.d.ts → types-CxjqmPl-.d.ts} +25 -1
- package/dist/{types-BoGjyon0.d.mts → types-D37aSQ9c.d.mts} +25 -1
- package/dist/{types-CfBpm3w5.d.mts → types-Djpz-L0w.d.mts} +1 -1
- package/dist/{types-eWyZuz-3.d.ts → types-Dn8tXnei.d.ts} +25 -1
- package/dist/ui/index.d.mts +1 -1
- package/dist/ui/index.d.ts +1 -1
- package/dist/verify.d.mts +28 -3
- package/dist/verify.d.ts +28 -3
- package/dist/verify.js +71 -11
- package/dist/verify.js.map +1 -1
- package/dist/verify.mjs +69 -11
- package/dist/verify.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as next_server from 'next/server';
|
|
2
2
|
import { NextRequest } from 'next/server';
|
|
3
|
-
import { N as NextJsMiddlewareOptions } from '../types-
|
|
3
|
+
import { N as NextJsMiddlewareOptions } from '../types-CxjqmPl-.mjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Create Next.js middleware for agent verification.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as next_server from 'next/server';
|
|
2
2
|
import { NextRequest } from 'next/server';
|
|
3
|
-
import { N as NextJsMiddlewareOptions } from '../types-
|
|
3
|
+
import { N as NextJsMiddlewareOptions } from '../types-CxjqmPl-.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Create Next.js middleware for agent verification.
|
package/dist/adapters/nextjs.js
CHANGED
|
@@ -471,7 +471,7 @@ function routePolicyOf(route) {
|
|
|
471
471
|
}
|
|
472
472
|
|
|
473
473
|
// src/version.ts
|
|
474
|
-
var SDK_VERSION = "5.
|
|
474
|
+
var SDK_VERSION = "5.20.0";
|
|
475
475
|
|
|
476
476
|
// src/http.ts
|
|
477
477
|
var SDK_USER_AGENT = `astrasync-sdk/${SDK_VERSION}`;
|
|
@@ -934,6 +934,9 @@ async function callVerifyAccessAPI(config, request) {
|
|
|
934
934
|
if (requestData.enableRuntimeChallenge)
|
|
935
935
|
body.enableRuntimeChallenge = requestData.enableRuntimeChallenge;
|
|
936
936
|
if (requestData.routePolicy) body.routePolicy = requestData.routePolicy;
|
|
937
|
+
if (config.actingProof?.connectorToken) {
|
|
938
|
+
body.actingProof = { connectorToken: config.actingProof.connectorToken };
|
|
939
|
+
}
|
|
937
940
|
if (requestData.approvalHeldByRoute) body.approvalHeldByRoute = true;
|
|
938
941
|
if (requestData.createSession) body.createSession = requestData.createSession;
|
|
939
942
|
if (requestData.durationRequired) body.durationRequired = requestData.durationRequired;
|
|
@@ -1101,22 +1104,43 @@ async function verify(config, request, options) {
|
|
|
1101
1104
|
"[VerificationGateway] minTrustScore / minTrustScoreForFull are deprecated in v2.3.0 and have no effect. Server is now the single source of truth for access decisions (verified ID + runtime challenge + PDLSS + trust score). To gate access to an endpoint, configure the endpoint's trust_score_requirement server-side."
|
|
1102
1105
|
);
|
|
1103
1106
|
}
|
|
1104
|
-
const uncacheable = Boolean(request.commerceArtifacts);
|
|
1107
|
+
const uncacheable = Boolean(request.commerceArtifacts) || Boolean(mergedConfig.actingProof);
|
|
1105
1108
|
if (mergedConfig.cacheTtl !== 0 && !options?.bypassCache && !uncacheable) {
|
|
1106
1109
|
const cached = getCachedResult(request, mergedConfig.counterpartyId);
|
|
1107
1110
|
if (cached) {
|
|
1108
1111
|
if (mergedConfig.debug) {
|
|
1109
1112
|
console.log("[VerificationGateway] Returning cached result");
|
|
1110
1113
|
}
|
|
1111
|
-
|
|
1112
|
-
if (request.attemptId) {
|
|
1113
|
-
hit.attemptId = request.attemptId;
|
|
1114
|
-
} else {
|
|
1115
|
-
delete hit.attemptId;
|
|
1116
|
-
}
|
|
1117
|
-
return hit;
|
|
1114
|
+
return sharedVerdict(cached, request);
|
|
1118
1115
|
}
|
|
1119
1116
|
}
|
|
1117
|
+
if (mergedConfig.cacheTtl !== 0 && !options?.bypassCache && !uncacheable) {
|
|
1118
|
+
const key = getCacheKey(request, mergedConfig.counterpartyId);
|
|
1119
|
+
const pending = inflightVerifies.get(key);
|
|
1120
|
+
if (pending) return sharedVerdict(await pending, request);
|
|
1121
|
+
const flight = verifyViaApi(mergedConfig, request, urls, uncacheable);
|
|
1122
|
+
inflightVerifies.set(key, flight);
|
|
1123
|
+
try {
|
|
1124
|
+
return await flight;
|
|
1125
|
+
} finally {
|
|
1126
|
+
inflightVerifies.delete(key);
|
|
1127
|
+
}
|
|
1128
|
+
}
|
|
1129
|
+
return verifyViaApi(mergedConfig, request, urls, uncacheable);
|
|
1130
|
+
}
|
|
1131
|
+
var inflightVerifies = /* @__PURE__ */ new Map();
|
|
1132
|
+
var sharedVerdicts = /* @__PURE__ */ new WeakSet();
|
|
1133
|
+
function sharedVerdict(source, request) {
|
|
1134
|
+
const hit = { ...source };
|
|
1135
|
+
if (request.attemptId) {
|
|
1136
|
+
hit.attemptId = request.attemptId;
|
|
1137
|
+
} else {
|
|
1138
|
+
delete hit.attemptId;
|
|
1139
|
+
}
|
|
1140
|
+
sharedVerdicts.add(hit);
|
|
1141
|
+
return hit;
|
|
1142
|
+
}
|
|
1143
|
+
async function verifyViaApi(mergedConfig, request, urls, uncacheable) {
|
|
1120
1144
|
const enrichedRequest = { ...request };
|
|
1121
1145
|
if (!enrichedRequest.counterpartyUrl && mergedConfig.counterpartyUrl) {
|
|
1122
1146
|
enrichedRequest.counterpartyUrl = mergedConfig.counterpartyUrl;
|
|
@@ -1195,7 +1219,9 @@ async function verify(config, request, options) {
|
|
|
1195
1219
|
fulfilment: apiResponse.fulfilment,
|
|
1196
1220
|
mandates: apiResponse.mandates,
|
|
1197
1221
|
kyaToken: apiResponse.kyaToken,
|
|
1198
|
-
aep: apiResponse.aep
|
|
1222
|
+
aep: apiResponse.aep,
|
|
1223
|
+
// 5.20.0 (round 29.1): non-fatal integration warnings (e.g. events_url_missing).
|
|
1224
|
+
warnings: apiResponse.warnings
|
|
1199
1225
|
};
|
|
1200
1226
|
return result2;
|
|
1201
1227
|
}
|
|
@@ -1263,7 +1289,9 @@ async function verify(config, request, options) {
|
|
|
1263
1289
|
// 5.15.0: merchant-lane AP2 mandates + KYAPay identity token.
|
|
1264
1290
|
mandates: apiResponse.mandates,
|
|
1265
1291
|
kyaToken: apiResponse.kyaToken,
|
|
1266
|
-
aep: apiResponse.aep
|
|
1292
|
+
aep: apiResponse.aep,
|
|
1293
|
+
// 5.20.0 (round 29.1): non-fatal integration warnings (e.g. events_url_missing).
|
|
1294
|
+
warnings: apiResponse.warnings
|
|
1267
1295
|
};
|
|
1268
1296
|
if (result.recommendation === "deny") {
|
|
1269
1297
|
result.policyAllowed = false;
|
|
@@ -1289,8 +1317,18 @@ async function verify(config, request, options) {
|
|
|
1289
1317
|
cacheResult(request, result, mergedConfig.cacheTtl, mergedConfig.counterpartyId);
|
|
1290
1318
|
}
|
|
1291
1319
|
}
|
|
1320
|
+
notifyVerificationListeners(request, result);
|
|
1292
1321
|
return result;
|
|
1293
1322
|
}
|
|
1323
|
+
var verificationListeners = /* @__PURE__ */ new Set();
|
|
1324
|
+
function notifyVerificationListeners(request, result) {
|
|
1325
|
+
for (const listener of verificationListeners) {
|
|
1326
|
+
try {
|
|
1327
|
+
listener(result, request);
|
|
1328
|
+
} catch {
|
|
1329
|
+
}
|
|
1330
|
+
}
|
|
1331
|
+
}
|
|
1294
1332
|
var refusedPolicyReads = /* @__PURE__ */ new Set();
|
|
1295
1333
|
async function fetchRoutes(config, counterpartyId, options = {}) {
|
|
1296
1334
|
if (!counterpartyId) return null;
|
|
@@ -1300,6 +1338,7 @@ async function fetchRoutes(config, counterpartyId, options = {}) {
|
|
|
1300
1338
|
headers["X-API-Key"] = config.apiKey;
|
|
1301
1339
|
}
|
|
1302
1340
|
try {
|
|
1341
|
+
headers["X-AstraSync-SDK-Version"] = SDK_VERSION;
|
|
1303
1342
|
const response = await sdkFetch(
|
|
1304
1343
|
`${config.apiBaseUrl}/endpoints/${encodeURIComponent(counterpartyId)}/routes` + (options.codeGates?.length ? `?codeGates=${options.codeGates.map(encodeURIComponent).join(",")}` : ""),
|
|
1305
1344
|
{ method: "GET", headers }
|
|
@@ -1314,6 +1353,13 @@ async function fetchRoutes(config, counterpartyId, options = {}) {
|
|
|
1314
1353
|
return null;
|
|
1315
1354
|
}
|
|
1316
1355
|
const body = await response.json();
|
|
1356
|
+
const type = body.data?.counterpartyType;
|
|
1357
|
+
if (typeof type === "string" && options.onEndpointType) {
|
|
1358
|
+
try {
|
|
1359
|
+
options.onEndpointType(type);
|
|
1360
|
+
} catch {
|
|
1361
|
+
}
|
|
1362
|
+
}
|
|
1317
1363
|
return body.data?.routes ?? [];
|
|
1318
1364
|
} catch {
|
|
1319
1365
|
return null;
|