@astrasyncai/verification-gateway 2.4.3 → 2.4.5
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 +90 -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 +35 -7
- package/dist/adapters/express.js.map +1 -1
- package/dist/adapters/express.mjs +35 -7
- package/dist/adapters/express.mjs.map +1 -1
- package/dist/adapters/mcp.d.mts +61 -2
- package/dist/adapters/mcp.d.ts +61 -2
- package/dist/adapters/mcp.js +95 -18
- package/dist/adapters/mcp.js.map +1 -1
- package/dist/adapters/mcp.mjs +95 -18
- 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 +5 -0
- package/dist/adapters/nextjs.js.map +1 -1
- package/dist/adapters/nextjs.mjs +5 -0
- 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 +5 -0
- package/dist/adapters/sdk.js.map +1 -1
- package/dist/adapters/sdk.mjs +5 -0
- 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/bin/astrasync.js +10 -2
- package/dist/browser/background.js +5 -0
- package/dist/browser/background.js.map +1 -1
- package/dist/browser/background.mjs +5 -0
- 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 +5 -0
- package/dist/cursor/extension.js.map +1 -1
- package/dist/cursor/extension.mjs +5 -0
- package/dist/cursor/extension.mjs.map +1 -1
- package/dist/{express-DneHiMhu.d.mts → express-D5hAJ2Gv.d.mts} +1 -1
- package/dist/{express-DsiaQRFt.d.ts → express-XCkk7BsJ.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 +5 -0
- package/dist/gateway/gateway.js.map +1 -1
- package/dist/gateway/gateway.mjs +5 -0
- 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-NZiKvrtE.d.ts → index-Bstl43HI.d.ts} +1 -1
- package/dist/{index-Dd4alF0l.d.ts → index-CH4TfcbL.d.ts} +1 -1
- package/dist/{index-C9yWlQ2Y.d.mts → index-TS4SGvf4.d.mts} +1 -1
- package/dist/{index-DAGm-Sgf.d.mts → index-u08qcXq9.d.mts} +1 -1
- package/dist/index.d.mts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +35 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +35 -7
- 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-vUuVCaBP.d.mts → nextjs-CFA0J_4x.d.mts} +1 -1
- package/dist/{nextjs-B4WmoiVm.d.ts → nextjs-DP2EpI-4.d.ts} +1 -1
- package/dist/registration/index.d.mts +25 -0
- package/dist/registration/index.d.ts +25 -0
- package/dist/registration/index.js +10 -2
- package/dist/registration/index.js.map +1 -1
- package/dist/registration/index.mjs +10 -2
- package/dist/registration/index.mjs.map +1 -1
- package/dist/{sdk-Cixo6pTV.d.mts → sdk-C8W54WZS.d.mts} +1 -1
- package/dist/{sdk-BvWp4q2q.d.ts → sdk-CwwCGDzK.d.ts} +1 -1
- package/dist/transport/index.d.mts +2 -2
- package/dist/transport/index.d.ts +2 -2
- package/dist/{types-DLai3jly.d.mts → types-CbZOkIr-.d.mts} +29 -0
- package/dist/{types-DLai3jly.d.ts → types-CbZOkIr-.d.ts} +29 -0
- package/dist/{types-IUzu-A4u.d.ts → types-DXNkr61h.d.ts} +1 -1
- package/dist/{types-C_e1IZdU.d.mts → types-tBNFSbw_.d.mts} +1 -1
- package/dist/ui/index.d.mts +1 -1
- package/dist/ui/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AstraSyncGateway } from '../gateway/gateway.mjs';
|
|
2
|
-
import { V as VerificationDecision, P as PDLSSContext } from '../types-
|
|
3
|
-
import '../types-
|
|
2
|
+
import { V as VerificationDecision, P as PDLSSContext } from '../types-tBNFSbw_.mjs';
|
|
3
|
+
import '../types-CbZOkIr-.mjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Git Trigger — Enterprise git push / PR verification
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AstraSyncGateway } from '../gateway/gateway.js';
|
|
2
|
-
import { V as VerificationDecision, P as PDLSSContext } from '../types-
|
|
3
|
-
import '../types-
|
|
2
|
+
import { V as VerificationDecision, P as PDLSSContext } from '../types-DXNkr61h.js';
|
|
3
|
+
import '../types-CbZOkIr-.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Git Trigger — Enterprise git push / PR verification
|
package/dist/index.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { b as AgentCredentials, G as GatewayConfig, a as AccessLevel, c as VerificationRequest, V as VerificationResult } from './types-
|
|
2
|
-
export { A as AstraSyncCredentials, d as CommerceShieldProps, C as CounterpartyType, e as EnhancedVerificationResult, E as ExpressMiddlewareOptions, f as GuidanceInfo, N as NextJsMiddlewareOptions, P as PDLSSInfo, g as ProtocolTransport, R as RouteAccessConfig, h as RuntimeChallengeResult, S as SDKOptions, T as TokenGuidance, i as TrustLevel, j as VerifiedAgent, k as VerifiedDeveloper, l as VerifiedOrganization } from './types-
|
|
3
|
-
export { A as ACCESS_LEVEL_DESCRIPTIONS, a as ACCESS_LEVEL_HIERARCHY, b as AccessCapabilities, D as DEFAULT_TRUST_THRESHOLDS, T as TRUST_LEVEL_RANGES, d as determineAccessLevel, g as getAccessLevelForScore, c as getCapabilities, e as getTrustLevel, h as hasMinimumAccess, s as sdk } from './sdk-
|
|
4
|
-
export { e as express } from './express-
|
|
5
|
-
export { n as nextjs } from './nextjs-
|
|
6
|
-
export { i as transport } from './index-
|
|
7
|
-
export { A as AgentClient, C as ChallengeHandler, i as agent, r as recordDecision } from './index-
|
|
1
|
+
import { b as AgentCredentials, G as GatewayConfig, a as AccessLevel, c as VerificationRequest, V as VerificationResult } from './types-CbZOkIr-.mjs';
|
|
2
|
+
export { A as AstraSyncCredentials, d as CommerceShieldProps, C as CounterpartyType, e as EnhancedVerificationResult, E as ExpressMiddlewareOptions, f as GuidanceInfo, N as NextJsMiddlewareOptions, P as PDLSSInfo, g as ProtocolTransport, R as RouteAccessConfig, h as RuntimeChallengeResult, S as SDKOptions, T as TokenGuidance, i as TrustLevel, j as VerifiedAgent, k as VerifiedDeveloper, l as VerifiedOrganization } from './types-CbZOkIr-.mjs';
|
|
3
|
+
export { A as ACCESS_LEVEL_DESCRIPTIONS, a as ACCESS_LEVEL_HIERARCHY, b as AccessCapabilities, D as DEFAULT_TRUST_THRESHOLDS, T as TRUST_LEVEL_RANGES, d as determineAccessLevel, g as getAccessLevelForScore, c as getCapabilities, e as getTrustLevel, h as hasMinimumAccess, s as sdk } from './sdk-C8W54WZS.mjs';
|
|
4
|
+
export { e as express } from './express-D5hAJ2Gv.mjs';
|
|
5
|
+
export { n as nextjs } from './nextjs-CFA0J_4x.mjs';
|
|
6
|
+
export { i as transport } from './index-TS4SGvf4.mjs';
|
|
7
|
+
export { A as AgentClient, C as ChallengeHandler, i as agent, r as recordDecision } from './index-u08qcXq9.mjs';
|
|
8
8
|
import 'express';
|
|
9
9
|
import 'next/server';
|
|
10
10
|
import 'jose';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { b as AgentCredentials, G as GatewayConfig, a as AccessLevel, c as VerificationRequest, V as VerificationResult } from './types-
|
|
2
|
-
export { A as AstraSyncCredentials, d as CommerceShieldProps, C as CounterpartyType, e as EnhancedVerificationResult, E as ExpressMiddlewareOptions, f as GuidanceInfo, N as NextJsMiddlewareOptions, P as PDLSSInfo, g as ProtocolTransport, R as RouteAccessConfig, h as RuntimeChallengeResult, S as SDKOptions, T as TokenGuidance, i as TrustLevel, j as VerifiedAgent, k as VerifiedDeveloper, l as VerifiedOrganization } from './types-
|
|
3
|
-
export { A as ACCESS_LEVEL_DESCRIPTIONS, a as ACCESS_LEVEL_HIERARCHY, b as AccessCapabilities, D as DEFAULT_TRUST_THRESHOLDS, T as TRUST_LEVEL_RANGES, d as determineAccessLevel, g as getAccessLevelForScore, c as getCapabilities, e as getTrustLevel, h as hasMinimumAccess, s as sdk } from './sdk-
|
|
4
|
-
export { e as express } from './express-
|
|
5
|
-
export { n as nextjs } from './nextjs-
|
|
6
|
-
export { i as transport } from './index-
|
|
7
|
-
export { A as AgentClient, C as ChallengeHandler, i as agent, r as recordDecision } from './index-
|
|
1
|
+
import { b as AgentCredentials, G as GatewayConfig, a as AccessLevel, c as VerificationRequest, V as VerificationResult } from './types-CbZOkIr-.js';
|
|
2
|
+
export { A as AstraSyncCredentials, d as CommerceShieldProps, C as CounterpartyType, e as EnhancedVerificationResult, E as ExpressMiddlewareOptions, f as GuidanceInfo, N as NextJsMiddlewareOptions, P as PDLSSInfo, g as ProtocolTransport, R as RouteAccessConfig, h as RuntimeChallengeResult, S as SDKOptions, T as TokenGuidance, i as TrustLevel, j as VerifiedAgent, k as VerifiedDeveloper, l as VerifiedOrganization } from './types-CbZOkIr-.js';
|
|
3
|
+
export { A as ACCESS_LEVEL_DESCRIPTIONS, a as ACCESS_LEVEL_HIERARCHY, b as AccessCapabilities, D as DEFAULT_TRUST_THRESHOLDS, T as TRUST_LEVEL_RANGES, d as determineAccessLevel, g as getAccessLevelForScore, c as getCapabilities, e as getTrustLevel, h as hasMinimumAccess, s as sdk } from './sdk-CwwCGDzK.js';
|
|
4
|
+
export { e as express } from './express-XCkk7BsJ.js';
|
|
5
|
+
export { n as nextjs } from './nextjs-DP2EpI-4.js';
|
|
6
|
+
export { i as transport } from './index-Bstl43HI.js';
|
|
7
|
+
export { A as AgentClient, C as ChallengeHandler, i as agent, r as recordDecision } from './index-CH4TfcbL.js';
|
|
8
8
|
import 'express';
|
|
9
9
|
import 'next/server';
|
|
10
10
|
import 'jose';
|
package/dist/index.js
CHANGED
|
@@ -177,6 +177,9 @@ function getCapabilities(accessLevel) {
|
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
179
|
|
|
180
|
+
// src/version.ts
|
|
181
|
+
var SDK_VERSION = "2.4.5";
|
|
182
|
+
|
|
180
183
|
// src/verify.ts
|
|
181
184
|
var DEFAULT_CONFIG = {
|
|
182
185
|
apiBaseUrl: "https://astrasync.ai/api",
|
|
@@ -340,6 +343,8 @@ async function callVerifyAccessAPI(config, request) {
|
|
|
340
343
|
if (config.counterpartyId) body.counterpartyId = config.counterpartyId;
|
|
341
344
|
if (requestData.runtimeChallengeOptions)
|
|
342
345
|
body.runtimeChallengeOptions = requestData.runtimeChallengeOptions;
|
|
346
|
+
if (requestData.invocationProtocol) body.invocationProtocol = requestData.invocationProtocol;
|
|
347
|
+
body.sdkVersion = SDK_VERSION;
|
|
343
348
|
if (requestData.callerMetadata || requestData.clientIp || requestData.userAgent) {
|
|
344
349
|
const meta = {
|
|
345
350
|
...requestData.clientIp && { sourceIp: requestData.clientIp },
|
|
@@ -850,14 +855,15 @@ function createMiddleware(options) {
|
|
|
850
855
|
}
|
|
851
856
|
return next();
|
|
852
857
|
}
|
|
853
|
-
|
|
858
|
+
const credentials = customExtractCredentials ? customExtractCredentials(req) : defaultExtractCredentials(req);
|
|
859
|
+
const shouldEnforce = routeConfig.minAccessLevel !== "none";
|
|
860
|
+
if (routeConfig.minAccessLevel === "none" && (!config.evaluateAlwaysIfCredentialed || !credentials.astraId)) {
|
|
854
861
|
if (config.setPassThroughHeader) {
|
|
855
862
|
res.setHeader("X-Astra-Gateway-Mode", "unenforced");
|
|
856
863
|
res.setHeader("X-Astra-Gateway-Reason", "route-none");
|
|
857
864
|
}
|
|
858
865
|
return next();
|
|
859
866
|
}
|
|
860
|
-
const credentials = customExtractCredentials ? customExtractCredentials(req) : defaultExtractCredentials(req);
|
|
861
867
|
const purpose = customExtractPurpose ? customExtractPurpose(req) : defaultExtractPurpose(req);
|
|
862
868
|
const astraCreds = extractAstraSyncCredentials(req);
|
|
863
869
|
const counterpartyUrl = config.counterpartyUrl || `${req.protocol}://${req.get("host")}`;
|
|
@@ -921,9 +927,27 @@ function createMiddleware(options) {
|
|
|
921
927
|
onDenied(result, req, res);
|
|
922
928
|
return;
|
|
923
929
|
}
|
|
930
|
+
if (!shouldEnforce) {
|
|
931
|
+
if (config.setPassThroughHeader) {
|
|
932
|
+
res.setHeader("X-Astra-Gateway-Mode", "enforced");
|
|
933
|
+
res.setHeader("X-Astra-Gateway-Reason", "evaluated-not-enforced");
|
|
934
|
+
}
|
|
935
|
+
if (shouldRecordDecisions && sessionId) {
|
|
936
|
+
recordDecision(config, sessionId, "granted").catch(() => {
|
|
937
|
+
});
|
|
938
|
+
}
|
|
939
|
+
return next();
|
|
940
|
+
}
|
|
924
941
|
if (!hasMinimumAccess(result.accessLevel, routeConfig.minAccessLevel)) {
|
|
942
|
+
const insufficientFailure = {
|
|
943
|
+
dimension: "access_level.insufficient",
|
|
944
|
+
message: `Endpoint requires accessLevel '${routeConfig.minAccessLevel}'; agent has '${result.accessLevel}'.`,
|
|
945
|
+
guidance: "Request elevated access via step-up verification (coming soon \u2014 ships this month). Step-up lets the agent owner approve a one-time elevation for this specific counterparty + purpose without changing the agent's baseline trust score."
|
|
946
|
+
};
|
|
947
|
+
result.failures = [...result.failures ?? [], insufficientFailure];
|
|
948
|
+
result.denialReasons = [...result.denialReasons ?? [], insufficientFailure.message];
|
|
925
949
|
if (shouldRecordDecisions && sessionId) {
|
|
926
|
-
recordDecision(config, sessionId, "denied",
|
|
950
|
+
recordDecision(config, sessionId, "denied", insufficientFailure.message).catch(() => {
|
|
927
951
|
});
|
|
928
952
|
}
|
|
929
953
|
onDenied(result, req, res);
|
|
@@ -931,11 +955,15 @@ function createMiddleware(options) {
|
|
|
931
955
|
}
|
|
932
956
|
if (routeConfig.minTrustScore && result.agent) {
|
|
933
957
|
if (result.agent.trustScore < routeConfig.minTrustScore) {
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
958
|
+
const trustFailure = {
|
|
959
|
+
dimension: "access_level.insufficient",
|
|
960
|
+
message: `Trust score ${result.agent.trustScore} is below required ${routeConfig.minTrustScore} for this route.`,
|
|
961
|
+
guidance: "Request elevated access via step-up verification (coming soon \u2014 ships this month). Step-up lets the agent owner approve a one-time elevation for this specific counterparty + purpose without changing the agent's baseline trust score."
|
|
962
|
+
};
|
|
963
|
+
result.failures = [...result.failures ?? [], trustFailure];
|
|
964
|
+
result.denialReasons = [trustFailure.message];
|
|
937
965
|
if (shouldRecordDecisions && sessionId) {
|
|
938
|
-
recordDecision(config, sessionId, "denied",
|
|
966
|
+
recordDecision(config, sessionId, "denied", trustFailure.message).catch(() => {
|
|
939
967
|
});
|
|
940
968
|
}
|
|
941
969
|
onDenied(result, req, res);
|