@astrasyncai/verification-gateway 2.4.8 → 2.4.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/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 +81 -31
- package/dist/adapters/express.js.map +1 -1
- package/dist/adapters/express.mjs +81 -31
- 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 +64 -26
- package/dist/adapters/mcp.js.map +1 -1
- package/dist/adapters/mcp.mjs +64 -26
- 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 +89 -32
- package/dist/adapters/nextjs.js.map +1 -1
- package/dist/adapters/nextjs.mjs +89 -32
- 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 +65 -25
- package/dist/adapters/sdk.js.map +1 -1
- package/dist/adapters/sdk.mjs +65 -25
- 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 +60 -25
- package/dist/browser/background.js.map +1 -1
- package/dist/browser/background.mjs +60 -25
- 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 +60 -25
- package/dist/cursor/extension.js.map +1 -1
- package/dist/cursor/extension.mjs +60 -25
- package/dist/cursor/extension.mjs.map +1 -1
- package/dist/{express-DvVjR2H4.d.mts → express-4WStX3PV.d.mts} +1 -1
- package/dist/{express-714gJbaW.d.ts → express-C1ePFB7n.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 +60 -25
- package/dist/gateway/gateway.js.map +1 -1
- package/dist/gateway/gateway.mjs +60 -25
- 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-DYFS9QVb.d.mts → index-ChPX4WHl.d.mts} +1 -1
- package/dist/{index-DO0oG8ED.d.ts → index-Cjm-zBeZ.d.ts} +1 -1
- package/dist/{index-2WAlxs2G.d.ts → index-CzJMCgEy.d.ts} +1 -1
- package/dist/{index-P9t7M_dJ.d.mts → index-D8IEntil.d.mts} +1 -1
- package/dist/index.d.mts +22 -11
- package/dist/index.d.ts +22 -11
- package/dist/index.js +133 -42
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +132 -42
- 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-CZ-MwSOT.d.ts → nextjs-BIORS__0.d.ts} +1 -1
- package/dist/{nextjs-BCoH7EqF.d.mts → nextjs-CjzHdaXA.d.mts} +1 -1
- package/dist/registration/index.d.mts +76 -1
- package/dist/registration/index.d.ts +76 -1
- package/dist/registration/index.js +27 -2
- package/dist/registration/index.js.map +1 -1
- package/dist/registration/index.mjs +25 -1
- package/dist/registration/index.mjs.map +1 -1
- package/dist/{sdk-wwhFDXWX.d.mts → sdk-Chhz-FcT.d.mts} +9 -4
- package/dist/{sdk-kiA49vqJ.d.ts → sdk-CqTEQAc6.d.ts} +9 -4
- package/dist/transport/index.d.mts +2 -2
- package/dist/transport/index.d.ts +2 -2
- package/dist/{types-DOAb89cm.d.mts → types-DNK2BgIf.d.mts} +1 -1
- package/dist/{types-aucqzfUa.d.ts → types-DoWIuzfj.d.ts} +1 -1
- package/dist/{types-BwDmjIdr.d.mts → types-L15pYd2c.d.mts} +21 -4
- package/dist/{types-BwDmjIdr.d.ts → types-L15pYd2c.d.ts} +21 -4
- package/dist/ui/index.d.mts +1 -1
- package/dist/ui/index.d.ts +1 -1
- package/dist/ui/index.js +1 -1
- package/dist/ui/index.js.map +1 -1
- package/dist/ui/index.mjs +1 -1
- package/dist/ui/index.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -3295,7 +3295,7 @@ function getTrustLevel(score) {
|
|
|
3295
3295
|
}
|
|
3296
3296
|
|
|
3297
3297
|
// src/version.ts
|
|
3298
|
-
var SDK_VERSION = "2.4.
|
|
3298
|
+
var SDK_VERSION = "2.4.10";
|
|
3299
3299
|
|
|
3300
3300
|
// src/verify.ts
|
|
3301
3301
|
var DEFAULT_CONFIG = {
|
|
@@ -3306,8 +3306,10 @@ var DEFAULT_CONFIG = {
|
|
|
3306
3306
|
// through (`hasMinimumAccess('guidance', 'guidance') === true`).
|
|
3307
3307
|
defaultAccessLevel: "none",
|
|
3308
3308
|
// minTrustScore + minTrustScoreForFull deprecated in v2.3.0 — server decides.
|
|
3309
|
-
|
|
3310
|
-
//
|
|
3309
|
+
// Round-18.5 F4: cacheTtl deliberately unset. When undefined, cacheResult
|
|
3310
|
+
// applies the split default (60s autonomous / 300s step-up). When the
|
|
3311
|
+
// caller sets cacheTtl explicitly, that value is honoured uniformly.
|
|
3312
|
+
// Set cacheTtl: 0 to disable caching entirely.
|
|
3311
3313
|
debug: false
|
|
3312
3314
|
};
|
|
3313
3315
|
var initCheckPerformed = false;
|
|
@@ -3334,11 +3336,28 @@ async function performInitCheck(apiBaseUrl, debug) {
|
|
|
3334
3336
|
}
|
|
3335
3337
|
}
|
|
3336
3338
|
var verificationCache = /* @__PURE__ */ new Map();
|
|
3337
|
-
function getCacheKey(
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3339
|
+
function getCacheKey(request) {
|
|
3340
|
+
const c = request.credentials;
|
|
3341
|
+
return [
|
|
3342
|
+
c.astraId || "",
|
|
3343
|
+
c.apiKey || "",
|
|
3344
|
+
c.jwt || "",
|
|
3345
|
+
request.purpose || "",
|
|
3346
|
+
request.action || "",
|
|
3347
|
+
request.resourceType || "",
|
|
3348
|
+
request.resource || "",
|
|
3349
|
+
request.jurisdiction || "",
|
|
3350
|
+
request.transactionValue ?? "",
|
|
3351
|
+
request.currency || "",
|
|
3352
|
+
request.counterpartyUrl || "",
|
|
3353
|
+
request.counterpartyType || "",
|
|
3354
|
+
request.isSubAgentRequest ? "1" : "0",
|
|
3355
|
+
request.parentAgentId || "",
|
|
3356
|
+
request.subAgentDepth ?? ""
|
|
3357
|
+
].join("|");
|
|
3358
|
+
}
|
|
3359
|
+
function getCachedResult(request) {
|
|
3360
|
+
const key = getCacheKey(request);
|
|
3342
3361
|
const cached = verificationCache.get(key);
|
|
3343
3362
|
if (cached && cached.expiresAt > Date.now()) {
|
|
3344
3363
|
return cached.result;
|
|
@@ -3348,8 +3367,11 @@ function getCachedResult(credentials) {
|
|
|
3348
3367
|
}
|
|
3349
3368
|
return null;
|
|
3350
3369
|
}
|
|
3351
|
-
|
|
3352
|
-
|
|
3370
|
+
var DEFAULT_AUTONOMOUS_TTL_SECONDS = 60;
|
|
3371
|
+
var DEFAULT_STEP_UP_TTL_SECONDS = 300;
|
|
3372
|
+
function cacheResult(request, result, configuredTtl) {
|
|
3373
|
+
const ttlSeconds = configuredTtl && configuredTtl > 0 ? configuredTtl : result.requiresStepUp ? DEFAULT_STEP_UP_TTL_SECONDS : DEFAULT_AUTONOMOUS_TTL_SECONDS;
|
|
3374
|
+
const key = getCacheKey(request);
|
|
3353
3375
|
verificationCache.set(key, {
|
|
3354
3376
|
result,
|
|
3355
3377
|
expiresAt: Date.now() + ttlSeconds * 1e3
|
|
@@ -3378,12 +3400,17 @@ function createGuidanceResponse(config, reason, options = {}) {
|
|
|
3378
3400
|
]
|
|
3379
3401
|
};
|
|
3380
3402
|
return {
|
|
3381
|
-
|
|
3403
|
+
// Round-18 G4: createGuidanceResponse fires for unverified-agent path or
|
|
3404
|
+
// API-error fallback. Identity is not verified (no agent resolved);
|
|
3405
|
+
// policy is not evaluated (we never reached the gate).
|
|
3406
|
+
identityVerified: false,
|
|
3407
|
+
policyAllowed: false,
|
|
3382
3408
|
// v2.3.9 (defect #30): denials grant `'none'`, NEVER a positive band.
|
|
3383
|
-
// Adapters additionally short-circuit on
|
|
3384
|
-
// the gate check, but the access level still has
|
|
3385
|
-
// data layer so downstream consumers (SDK adapters
|
|
3386
|
-
// custom integrations) inherit the correct
|
|
3409
|
+
// Adapters additionally short-circuit on `!identityVerified ||
|
|
3410
|
+
// !policyAllowed` before the gate check, but the access level still has
|
|
3411
|
+
// to be honest at the data layer so downstream consumers (SDK adapters
|
|
3412
|
+
// in other languages, custom integrations) inherit the correct
|
|
3413
|
+
// semantics.
|
|
3387
3414
|
accessLevel: "none",
|
|
3388
3415
|
guidance,
|
|
3389
3416
|
denialReasons: reason ? [reason] : ["No valid agent credentials provided"],
|
|
@@ -3499,8 +3526,8 @@ async function verify(config, request) {
|
|
|
3499
3526
|
"[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."
|
|
3500
3527
|
);
|
|
3501
3528
|
}
|
|
3502
|
-
if (mergedConfig.cacheTtl
|
|
3503
|
-
const cached = getCachedResult(request
|
|
3529
|
+
if (mergedConfig.cacheTtl !== 0) {
|
|
3530
|
+
const cached = getCachedResult(request);
|
|
3504
3531
|
if (cached) {
|
|
3505
3532
|
if (mergedConfig.debug) {
|
|
3506
3533
|
console.log("[VerificationGateway] Returning cached result");
|
|
@@ -3527,15 +3554,17 @@ async function verify(config, request) {
|
|
|
3527
3554
|
}
|
|
3528
3555
|
if (!apiResponse.access?.allowed) {
|
|
3529
3556
|
const aggregatedFailures = apiResponse.access?.failures;
|
|
3557
|
+
const idVerifiedFromBackend = apiResponse.verificationContext?.idVerified === true;
|
|
3530
3558
|
const result2 = {
|
|
3531
|
-
|
|
3559
|
+
identityVerified: idVerifiedFromBackend,
|
|
3560
|
+
policyAllowed: false,
|
|
3532
3561
|
// v2.3.9 (defect #30): denials grant `'none'`, NEVER a positive band.
|
|
3533
3562
|
// Pre-rename this hardcoded `'guidance'`, which conflated with the
|
|
3534
3563
|
// colocated `guidance: {...}` help-payload object below and let
|
|
3535
3564
|
// denied requests pass any route gated at `'guidance'` because
|
|
3536
3565
|
// `hasMinimumAccess('guidance', 'guidance') === true`. Adapters now
|
|
3537
|
-
// ALSO short-circuit on
|
|
3538
|
-
// belt-and-braces.
|
|
3566
|
+
// ALSO short-circuit on `!identityVerified || !policyAllowed` before
|
|
3567
|
+
// the gate check — belt-and-braces.
|
|
3539
3568
|
accessLevel: "none",
|
|
3540
3569
|
denialReasons: aggregatedFailures && aggregatedFailures.length > 0 ? aggregatedFailures.map((f) => f.message) : apiResponse.access?.reason ? [apiResponse.access.reason] : ["Access denied"],
|
|
3541
3570
|
failures: aggregatedFailures,
|
|
@@ -3579,7 +3608,13 @@ async function verify(config, request) {
|
|
|
3579
3608
|
const verificationContext = apiResponse.verificationContext;
|
|
3580
3609
|
const accessLevel = apiResponse.access?.accessLevel ?? "standard";
|
|
3581
3610
|
const result = {
|
|
3582
|
-
|
|
3611
|
+
// Round-18 G4: backend allowed access. Identity is verified (we resolved
|
|
3612
|
+
// the caller to an agent) and policy passed all gates. Read idVerified
|
|
3613
|
+
// from verificationContext for symmetry with the deny branch; default true
|
|
3614
|
+
// on success path since `access.allowed === true` implies identity was
|
|
3615
|
+
// resolvable (anonymous-allow paths flow through createGuidanceResponse).
|
|
3616
|
+
identityVerified: apiResponse.verificationContext?.idVerified !== false,
|
|
3617
|
+
policyAllowed: true,
|
|
3583
3618
|
accessLevel,
|
|
3584
3619
|
agent,
|
|
3585
3620
|
developer,
|
|
@@ -3602,7 +3637,7 @@ async function verify(config, request) {
|
|
|
3602
3637
|
warningHeader: apiResponse.warningHeader
|
|
3603
3638
|
};
|
|
3604
3639
|
if (result.recommendation === "deny") {
|
|
3605
|
-
result.
|
|
3640
|
+
result.policyAllowed = false;
|
|
3606
3641
|
result.accessLevel = "none";
|
|
3607
3642
|
result.denialReasons = result.recommendationReasons || [
|
|
3608
3643
|
"Access denied by AstraSync recommendation"
|
|
@@ -3621,8 +3656,8 @@ async function verify(config, request) {
|
|
|
3621
3656
|
}
|
|
3622
3657
|
result.denialReasons = result.recommendationReasons || ["Step-up verification required"];
|
|
3623
3658
|
}
|
|
3624
|
-
if (mergedConfig.cacheTtl
|
|
3625
|
-
cacheResult(request
|
|
3659
|
+
if (mergedConfig.cacheTtl !== 0 && result.recommendation !== "deny") {
|
|
3660
|
+
cacheResult(request, result, mergedConfig.cacheTtl);
|
|
3626
3661
|
}
|
|
3627
3662
|
return result;
|
|
3628
3663
|
}
|
|
@@ -3694,7 +3729,7 @@ function toVerificationRequest(context, astraId) {
|
|
|
3694
3729
|
};
|
|
3695
3730
|
}
|
|
3696
3731
|
function toDecision(result) {
|
|
3697
|
-
if (result.
|
|
3732
|
+
if (result.identityVerified && result.policyAllowed) {
|
|
3698
3733
|
return {
|
|
3699
3734
|
recommendation: "ALLOW",
|
|
3700
3735
|
reason: `Verified with access level: ${result.accessLevel}`,
|