@astrasyncai/verification-gateway 3.5.0 → 3.6.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/README.md +16 -0
- package/dist/adapter-interface/interface.d.mts +2 -2
- package/dist/adapter-interface/interface.d.ts +2 -2
- package/dist/adapters/express.d.mts +2 -2
- package/dist/adapters/express.d.ts +2 -2
- package/dist/adapters/express.js +96 -20
- package/dist/adapters/express.js.map +1 -1
- package/dist/adapters/express.mjs +96 -20
- package/dist/adapters/express.mjs.map +1 -1
- package/dist/adapters/mcp.d.mts +1 -1
- package/dist/adapters/mcp.d.ts +1 -1
- package/dist/adapters/mcp.js +96 -20
- package/dist/adapters/mcp.js.map +1 -1
- package/dist/adapters/mcp.mjs +96 -20
- package/dist/adapters/mcp.mjs.map +1 -1
- package/dist/adapters/nextjs.d.mts +2 -2
- package/dist/adapters/nextjs.d.ts +2 -2
- package/dist/adapters/nextjs.js +101 -20
- package/dist/adapters/nextjs.js.map +1 -1
- package/dist/adapters/nextjs.mjs +101 -20
- package/dist/adapters/nextjs.mjs.map +1 -1
- package/dist/adapters/sdk.d.mts +2 -2
- package/dist/adapters/sdk.d.ts +2 -2
- package/dist/adapters/sdk.js +19 -16
- package/dist/adapters/sdk.js.map +1 -1
- package/dist/adapters/sdk.mjs +19 -16
- package/dist/adapters/sdk.mjs.map +1 -1
- package/dist/agent/index.d.mts +2 -2
- package/dist/agent/index.d.ts +2 -2
- package/dist/browser/background.js +22 -16
- package/dist/browser/background.js.map +1 -1
- package/dist/browser/background.mjs +22 -16
- package/dist/browser/background.mjs.map +1 -1
- package/dist/browser/browser-adapter.d.mts +2 -2
- package/dist/browser/browser-adapter.d.ts +2 -2
- package/dist/cli/index.d.mts +2 -2
- package/dist/cli/index.d.ts +2 -2
- package/dist/cursor/cursor-adapter.d.mts +2 -2
- package/dist/cursor/cursor-adapter.d.ts +2 -2
- package/dist/cursor/extension.d.mts +2 -2
- package/dist/cursor/extension.d.ts +2 -2
- package/dist/cursor/extension.js +22 -16
- package/dist/cursor/extension.js.map +1 -1
- package/dist/cursor/extension.mjs +22 -16
- package/dist/cursor/extension.mjs.map +1 -1
- package/dist/{express-BH5ADAyb.d.mts → express-BnMO-H3y.d.mts} +1 -1
- package/dist/{express-jUzLIoep.d.ts → express-DQhDzNAt.d.ts} +1 -1
- package/dist/gateway/gateway.d.mts +2 -2
- package/dist/gateway/gateway.d.ts +2 -2
- package/dist/gateway/gateway.js +22 -16
- package/dist/gateway/gateway.js.map +1 -1
- package/dist/gateway/gateway.mjs +22 -16
- package/dist/gateway/gateway.mjs.map +1 -1
- package/dist/git-trigger/git-hooks.d.mts +2 -2
- package/dist/git-trigger/git-hooks.d.ts +2 -2
- package/dist/{index-aZHAWujT.d.mts → index-BT_aRn-I.d.mts} +1 -1
- package/dist/{index-DlCnmpJH.d.ts → index-D8-dvUFA.d.ts} +1 -1
- package/dist/{index-BR2nmxBU.d.mts → index-WHKq2v17.d.mts} +1 -1
- package/dist/{index-DEixUCu0.d.ts → index-rftma0ln.d.ts} +1 -1
- package/dist/index.d.mts +55 -9
- package/dist/index.d.ts +55 -9
- package/dist/index.js +145 -30
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +143 -30
- 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/{nextjs-LTeoPqMH.d.mts → nextjs-DFKYhxe6.d.mts} +1 -1
- package/dist/{nextjs-DfXOd0Au.d.ts → nextjs-DPj7ZNlq.d.ts} +1 -1
- package/dist/{sdk-LmvyDVpL.d.ts → sdk-CAcHgB5x.d.ts} +1 -1
- package/dist/{sdk-DKhwVL9X.d.mts → sdk-Cy3wAmDt.d.mts} +1 -1
- package/dist/transport/index.d.mts +2 -2
- package/dist/transport/index.d.ts +2 -2
- package/dist/{types-C8HyQEaz.d.mts → types-B-ubjHER.d.mts} +1 -1
- package/dist/{types-xofemo0G.d.ts → types-Bgn5gxHQ.d.ts} +1 -1
- package/dist/{types-DrDIouvO.d.mts → types-CKe8O0lR.d.mts} +41 -1
- package/dist/{types-DrDIouvO.d.ts → types-CKe8O0lR.d.ts} +41 -1
- package/dist/ui/index.d.mts +1 -1
- package/dist/ui/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RequestHandler, Request } from 'express';
|
|
2
|
-
import {
|
|
2
|
+
import { n as VerificationResult, e as ExpressMiddlewareOptions, c as AstraSyncCredentials } from './types-CKe8O0lR.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* AstraSync Universal Verification Gateway - Express Middleware
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RequestHandler, Request } from 'express';
|
|
2
|
-
import {
|
|
2
|
+
import { n as VerificationResult, e as ExpressMiddlewareOptions, c as AstraSyncCredentials } from './types-CKe8O0lR.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* AstraSync Universal Verification Gateway - Express Middleware
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as AstraSyncGatewayConfig, P as PDLSSContext, V as VerificationDecision } from '../types-
|
|
2
|
-
import '../types-
|
|
1
|
+
import { a as AstraSyncGatewayConfig, P as PDLSSContext, V as VerificationDecision } from '../types-B-ubjHER.mjs';
|
|
2
|
+
import '../types-CKe8O0lR.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* AstraSyncGateway — Primary API surface for agent verification.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as AstraSyncGatewayConfig, P as PDLSSContext, V as VerificationDecision } from '../types-
|
|
2
|
-
import '../types-
|
|
1
|
+
import { a as AstraSyncGatewayConfig, P as PDLSSContext, V as VerificationDecision } from '../types-Bgn5gxHQ.js';
|
|
2
|
+
import '../types-CKe8O0lR.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* AstraSyncGateway — Primary API surface for agent verification.
|
package/dist/gateway/gateway.js
CHANGED
|
@@ -3529,7 +3529,7 @@ function getTrustLevel(score) {
|
|
|
3529
3529
|
}
|
|
3530
3530
|
|
|
3531
3531
|
// src/version.ts
|
|
3532
|
-
var SDK_VERSION = "3.
|
|
3532
|
+
var SDK_VERSION = "3.6.0";
|
|
3533
3533
|
|
|
3534
3534
|
// src/well-known.ts
|
|
3535
3535
|
var CACHE_TTL_MS = 60 * 60 * 1e3;
|
|
@@ -3547,10 +3547,10 @@ var DEFAULT_CONFIG = {
|
|
|
3547
3547
|
// through (`hasMinimumAccess('guidance', 'guidance') === true`).
|
|
3548
3548
|
defaultAccessLevel: "none",
|
|
3549
3549
|
// minTrustScore + minTrustScoreForFull deprecated in v2.3.0 — server decides.
|
|
3550
|
-
//
|
|
3551
|
-
//
|
|
3552
|
-
//
|
|
3553
|
-
// Set cacheTtl: 0 to disable caching entirely.
|
|
3550
|
+
// cacheTtl deliberately unset. When undefined, cacheResult applies the 60s
|
|
3551
|
+
// default; the caller's explicit value is honoured for cacheable results.
|
|
3552
|
+
// Denials and step-up escalations are NEVER cached (3.6.0) regardless of
|
|
3553
|
+
// cacheTtl. Set cacheTtl: 0 to disable caching entirely.
|
|
3554
3554
|
debug: false
|
|
3555
3555
|
};
|
|
3556
3556
|
var initCheckPerformed = false;
|
|
@@ -3637,10 +3637,9 @@ function getCachedResult(request, counterpartyId) {
|
|
|
3637
3637
|
}
|
|
3638
3638
|
return null;
|
|
3639
3639
|
}
|
|
3640
|
-
var
|
|
3641
|
-
var DEFAULT_STEP_UP_TTL_SECONDS = 300;
|
|
3640
|
+
var DEFAULT_CACHE_TTL_SECONDS = 60;
|
|
3642
3641
|
function cacheResult(request, result, configuredTtl, counterpartyId) {
|
|
3643
|
-
const ttlSeconds = configuredTtl && configuredTtl > 0 ? configuredTtl :
|
|
3642
|
+
const ttlSeconds = configuredTtl && configuredTtl > 0 ? configuredTtl : DEFAULT_CACHE_TTL_SECONDS;
|
|
3644
3643
|
const key = getCacheKey(request, counterpartyId);
|
|
3645
3644
|
verificationCache.set(key, {
|
|
3646
3645
|
result,
|
|
@@ -3782,7 +3781,7 @@ async function callVerifyAccessAPI(config, request) {
|
|
|
3782
3781
|
};
|
|
3783
3782
|
}
|
|
3784
3783
|
}
|
|
3785
|
-
async function verify(config, request) {
|
|
3784
|
+
async function verify(config, request, options) {
|
|
3786
3785
|
const mergedConfig = { ...DEFAULT_CONFIG, ...config };
|
|
3787
3786
|
const urls = mergedConfig.apiBaseUrl ? getCachedWellKnownUrls(mergedConfig.apiBaseUrl) : void 0;
|
|
3788
3787
|
if (!initCheckPerformed && !mergedConfig.disableInitChecks && mergedConfig.apiBaseUrl) {
|
|
@@ -3798,7 +3797,7 @@ async function verify(config, request) {
|
|
|
3798
3797
|
"[VerificationGateway] minTrustScore / minTrustScoreForFull are deprecated in v2.3.0 and have no effect. Server is now the single source of truth for access-level decisions (the SDK reads access.accessLevel from the verify-access response). To gate access to an endpoint, configure the endpoint's trust_score_requirement server-side."
|
|
3799
3798
|
);
|
|
3800
3799
|
}
|
|
3801
|
-
if (mergedConfig.cacheTtl !== 0) {
|
|
3800
|
+
if (mergedConfig.cacheTtl !== 0 && !options?.bypassCache) {
|
|
3802
3801
|
const cached = getCachedResult(request, mergedConfig.counterpartyId);
|
|
3803
3802
|
if (cached) {
|
|
3804
3803
|
if (mergedConfig.debug) {
|
|
@@ -3818,6 +3817,8 @@ async function verify(config, request) {
|
|
|
3818
3817
|
console.log("[VerificationGateway] Calling verify-access API");
|
|
3819
3818
|
}
|
|
3820
3819
|
const apiResponse = await callVerifyAccessAPI(mergedConfig, enrichedRequest);
|
|
3820
|
+
const rawServerDenialReasons = apiResponse.denialReasons;
|
|
3821
|
+
const serverDenialReasons = Array.isArray(rawServerDenialReasons) && rawServerDenialReasons.length > 0 ? rawServerDenialReasons : void 0;
|
|
3821
3822
|
if (!apiResponse.success) {
|
|
3822
3823
|
return createGuidanceResponse(mergedConfig, apiResponse.error, {
|
|
3823
3824
|
source: "api_error",
|
|
@@ -3839,7 +3840,10 @@ async function verify(config, request) {
|
|
|
3839
3840
|
// ALSO short-circuit on `!identityVerified || !policyAllowed` before
|
|
3840
3841
|
// the gate check — belt-and-braces.
|
|
3841
3842
|
accessLevel: "none",
|
|
3842
|
-
|
|
3843
|
+
// 3.6.0: the server now emits top-level denialReasons on every deny
|
|
3844
|
+
// path — prefer it verbatim; the failure-message reconstruction remains
|
|
3845
|
+
// as the fallback for older backends.
|
|
3846
|
+
denialReasons: serverDenialReasons ?? (aggregatedFailures && aggregatedFailures.length > 0 ? aggregatedFailures.map((f) => f.message) : apiResponse.access?.reason ? [apiResponse.access.reason] : ["Access denied"]),
|
|
3843
3847
|
failures: aggregatedFailures,
|
|
3844
3848
|
requiresStepUp: apiResponse.access?.requiresStepUp,
|
|
3845
3849
|
requiresApproval: apiResponse.access?.requiresApproval,
|
|
@@ -3916,9 +3920,7 @@ async function verify(config, request) {
|
|
|
3916
3920
|
if (result.recommendation === "deny") {
|
|
3917
3921
|
result.policyAllowed = false;
|
|
3918
3922
|
result.accessLevel = "none";
|
|
3919
|
-
result.denialReasons = result.recommendationReasons
|
|
3920
|
-
"Access denied by AstraSync recommendation"
|
|
3921
|
-
];
|
|
3923
|
+
result.denialReasons = serverDenialReasons ?? result.recommendationReasons ?? ["Access denied by AstraSync recommendation"];
|
|
3922
3924
|
result.guidance = result.runtimeChallenge ? {
|
|
3923
3925
|
message: `Verification failed: ${result.runtimeChallenge.reason || "runtime challenge failed"}`,
|
|
3924
3926
|
registrationUrl: urls?.registrationUrl ?? "",
|
|
@@ -3930,14 +3932,18 @@ async function verify(config, request) {
|
|
|
3930
3932
|
};
|
|
3931
3933
|
} else if (result.recommendation === "step_up_required") {
|
|
3932
3934
|
result.requiresStepUp = true;
|
|
3933
|
-
result.denialReasons = result.recommendationReasons
|
|
3935
|
+
result.denialReasons = serverDenialReasons ?? result.recommendationReasons ?? ["Step-up verification required"];
|
|
3934
3936
|
}
|
|
3935
|
-
|
|
3937
|
+
const escalates = result.requiresStepUp === true || result.requiresApproval === true || result.recommendation === "step_up_required";
|
|
3938
|
+
if (mergedConfig.cacheTtl !== 0 && result.recommendation !== "deny" && !escalates) {
|
|
3936
3939
|
cacheResult(request, result, mergedConfig.cacheTtl, mergedConfig.counterpartyId);
|
|
3937
3940
|
}
|
|
3938
3941
|
return result;
|
|
3939
3942
|
}
|
|
3940
3943
|
|
|
3944
|
+
// src/adapters/stepup-poll.ts
|
|
3945
|
+
var FALLBACK_MAX_WAIT_MS = 5 * 60 * 1e3;
|
|
3946
|
+
|
|
3941
3947
|
// src/adapters/express.ts
|
|
3942
3948
|
var DEFAULT_ROUTES_REFRESH_MS = 5 * 60 * 1e3;
|
|
3943
3949
|
|