@astrasyncai/verification-gateway 3.12.0 → 4.0.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/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 +85 -8
- package/dist/adapters/express.js.map +1 -1
- package/dist/adapters/express.mjs +85 -8
- 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 +90 -8
- package/dist/adapters/mcp.js.map +1 -1
- package/dist/adapters/mcp.mjs +90 -8
- 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 +86 -8
- package/dist/adapters/nextjs.js.map +1 -1
- package/dist/adapters/nextjs.mjs +86 -8
- 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 +71 -8
- package/dist/adapters/sdk.js.map +1 -1
- package/dist/adapters/sdk.mjs +71 -8
- 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-claude-hook.js +71 -8
- package/dist/bin/astrasync-codex-hook.js +71 -8
- package/dist/bin/astrasync-guard.js +71 -8
- package/dist/bin/astrasync.js +71 -8
- package/dist/browser/background.js +71 -8
- package/dist/browser/background.js.map +1 -1
- package/dist/browser/background.mjs +71 -8
- 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/claude-code/claude-code-adapter.d.mts +2 -2
- package/dist/claude-code/claude-code-adapter.d.ts +2 -2
- package/dist/cli/index.d.mts +2 -2
- package/dist/cli/index.d.ts +2 -2
- package/dist/codex/index.d.mts +2 -2
- package/dist/codex/index.d.ts +2 -2
- package/dist/codex/index.js +71 -8
- package/dist/codex/index.js.map +1 -1
- package/dist/codex/index.mjs +71 -8
- package/dist/codex/index.mjs.map +1 -1
- 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 +71 -8
- package/dist/cursor/extension.js.map +1 -1
- package/dist/cursor/extension.mjs +71 -8
- 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/{express-B39o89gf.d.mts → express-BZajRs4i.d.mts} +1 -1
- package/dist/{express-BuxKNO_q.d.ts → express-CjCUB1k7.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 +71 -8
- package/dist/gateway/gateway.js.map +1 -1
- package/dist/gateway/gateway.mjs +71 -8
- 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-DME3w3lf.d.mts → index-B0cyMZDL.d.mts} +1 -1
- package/dist/{index-CqydB4ks.d.mts → index-BRYteOqO.d.mts} +1 -1
- package/dist/{index-BG62SXso.d.ts → index-BZQdVqNw.d.ts} +1 -1
- package/dist/{index-CLHdqs2M.d.ts → index-adgKhujR.d.ts} +1 -1
- package/dist/index.d.mts +8 -8
- package/dist/index.d.ts +8 -8
- package/dist/index.js +119 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +119 -8
- 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-Ddlw_J1J.d.ts → nextjs-D_iFf5k-.d.ts} +1 -1
- package/dist/{nextjs-D74W7wt-.d.mts → nextjs-DeUTnOBd.d.mts} +1 -1
- package/dist/{sdk-CT7gdkfR.d.ts → sdk-BM3mwEAq.d.ts} +1 -1
- package/dist/{sdk-Bn6bj7kt.d.mts → sdk-_il1Q41f.d.mts} +1 -1
- package/dist/transport/index.d.mts +2 -2
- package/dist/transport/index.d.ts +2 -2
- package/dist/{types-BntuzEEn.d.mts → types-BcDf9Kk0.d.mts} +15 -0
- package/dist/{types-DHu7m9HI.d.ts → types-CHKCgDFC.d.ts} +1 -1
- package/dist/{types-Djw4GLtz.d.mts → types-DfnP7JiM.d.mts} +1 -1
- package/dist/{types-SDu4Llbe.d.ts → types-fTQD448H.d.ts} +15 -0
- package/dist/ui/index.d.mts +1 -1
- package/dist/ui/index.d.ts +1 -1
- package/dist/verify.d.mts +4 -2
- package/dist/verify.d.ts +4 -2
- package/dist/verify.js +76 -8
- package/dist/verify.js.map +1 -1
- package/dist/verify.mjs +75 -8
- package/dist/verify.mjs.map +1 -1
- package/package.json +1 -1
package/dist/edge-config.d.mts
CHANGED
package/dist/edge-config.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RequestHandler, Request } from 'express';
|
|
2
|
-
import { w as VerificationResult, k as ExpressMiddlewareOptions, c as AstraSyncCredentials } from './types-
|
|
2
|
+
import { w as VerificationResult, k as ExpressMiddlewareOptions, c as AstraSyncCredentials } from './types-BcDf9Kk0.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 { w as VerificationResult, k as ExpressMiddlewareOptions, c as AstraSyncCredentials } from './types-
|
|
2
|
+
import { w as VerificationResult, k as ExpressMiddlewareOptions, c as AstraSyncCredentials } from './types-fTQD448H.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-DfnP7JiM.mjs';
|
|
2
|
+
import '../types-BcDf9Kk0.mjs';
|
|
3
3
|
import '../metadata-capture.mjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -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-CHKCgDFC.js';
|
|
2
|
+
import '../types-fTQD448H.js';
|
|
3
3
|
import '../metadata-capture.js';
|
|
4
4
|
|
|
5
5
|
/**
|
package/dist/gateway/gateway.js
CHANGED
|
@@ -3698,7 +3698,7 @@ function getTrustLevel(score) {
|
|
|
3698
3698
|
}
|
|
3699
3699
|
|
|
3700
3700
|
// src/version.ts
|
|
3701
|
-
var SDK_VERSION = "
|
|
3701
|
+
var SDK_VERSION = "4.0.0";
|
|
3702
3702
|
|
|
3703
3703
|
// src/well-known.ts
|
|
3704
3704
|
var CACHE_TTL_MS = 60 * 60 * 1e3;
|
|
@@ -3724,7 +3724,7 @@ var DEFAULT_CONFIG = {
|
|
|
3724
3724
|
};
|
|
3725
3725
|
var initCheckPerformed = false;
|
|
3726
3726
|
var deprecationWarningShown = false;
|
|
3727
|
-
async function performInitCheck(apiBaseUrl, debug, strictInit) {
|
|
3727
|
+
async function performInitCheck(apiBaseUrl, debug, strictInit, apiKey) {
|
|
3728
3728
|
initCheckPerformed = true;
|
|
3729
3729
|
try {
|
|
3730
3730
|
const probeUrl = `${apiBaseUrl}/agents/verify-access`;
|
|
@@ -3741,6 +3741,28 @@ async function performInitCheck(apiBaseUrl, debug, strictInit) {
|
|
|
3741
3741
|
`[VerificationGateway] init check passed for ${apiBaseUrl} (content-type: ${contentType})`
|
|
3742
3742
|
);
|
|
3743
3743
|
}
|
|
3744
|
+
if (apiKey) {
|
|
3745
|
+
const selfCheck = await fetch(`${apiBaseUrl}/agents/verify-access/self-check`, {
|
|
3746
|
+
headers: { Authorization: `Bearer ${apiKey}` }
|
|
3747
|
+
});
|
|
3748
|
+
if (selfCheck.status === 401) {
|
|
3749
|
+
const body = await selfCheck.json().catch(() => ({}));
|
|
3750
|
+
const message = `[VerificationGateway] the configured AstraSync API key was REJECTED at startup (${body.code ?? "api_key_invalid"}: ${body.message ?? "invalid key"}). Every inbound agent will be turned away until the key is rotated` + (body.remediation?.manageUrl ? ` at ${body.remediation.manageUrl}` : "") + `.`;
|
|
3751
|
+
if (strictInit) {
|
|
3752
|
+
throw new Error(`${message} (strictInit=true)`);
|
|
3753
|
+
}
|
|
3754
|
+
console.error(message);
|
|
3755
|
+
} else if (selfCheck.ok) {
|
|
3756
|
+
const body = await selfCheck.json().catch(() => ({}));
|
|
3757
|
+
if (typeof body.daysToExpiry === "number" && body.daysToExpiry <= 7) {
|
|
3758
|
+
console.warn(
|
|
3759
|
+
`[VerificationGateway] the configured AstraSync API key expires in ${body.daysToExpiry} day(s) \u2014 rotate it at Settings \u2192 Developer Tools before integrations start failing.`
|
|
3760
|
+
);
|
|
3761
|
+
} else if (debug) {
|
|
3762
|
+
console.log("[VerificationGateway] API key self-check passed");
|
|
3763
|
+
}
|
|
3764
|
+
}
|
|
3765
|
+
}
|
|
3744
3766
|
} catch (err) {
|
|
3745
3767
|
if (strictInit) {
|
|
3746
3768
|
throw err;
|
|
@@ -3818,8 +3840,17 @@ function cacheResult(request, result, configuredTtl, counterpartyId) {
|
|
|
3818
3840
|
function createGuidanceResponse(_config, reason, options = {}) {
|
|
3819
3841
|
const source = options.source ?? "no_credentials";
|
|
3820
3842
|
const isApiError = source === "api_error";
|
|
3843
|
+
const isMisconfig = source === "merchant_misconfig";
|
|
3821
3844
|
const urls = options.urls;
|
|
3822
|
-
const guidance =
|
|
3845
|
+
const guidance = isMisconfig ? {
|
|
3846
|
+
message: "This site's AstraSync integration is misconfigured (its API key was revoked, expired, or rotated). Your identity and the AstraSync platform are fine \u2014 contact the site operator. Retrying will not help.",
|
|
3847
|
+
registrationUrl: urls?.registrationUrl ?? "",
|
|
3848
|
+
documentationUrl: options.remediation?.docsUrl ?? urls?.documentationUrl ?? "",
|
|
3849
|
+
steps: [
|
|
3850
|
+
"Report the failure to the site operator \u2014 their AstraSync API key needs rotating",
|
|
3851
|
+
"Do not retry: the failure is deterministic until the operator updates their key"
|
|
3852
|
+
]
|
|
3853
|
+
} : isApiError ? {
|
|
3823
3854
|
message: "Verification is temporarily unavailable. Retry with exponential backoff; if the issue persists, contact support with the correlationId.",
|
|
3824
3855
|
registrationUrl: urls?.registrationUrl ?? "",
|
|
3825
3856
|
documentationUrl: urls?.documentationUrl ?? "",
|
|
@@ -3857,13 +3888,22 @@ function createGuidanceResponse(_config, reason, options = {}) {
|
|
|
3857
3888
|
// partners (and their custom onDenied handlers) can branch on
|
|
3858
3889
|
// dimension. Without this, the synthesised stub was indistinguishable
|
|
3859
3890
|
// from a real policy deny.
|
|
3860
|
-
failures:
|
|
3891
|
+
failures: isMisconfig ? [
|
|
3892
|
+
{
|
|
3893
|
+
dimension: "verify_access.merchant_misconfigured",
|
|
3894
|
+
message: reason ?? "The integration API key was rejected by AstraSync",
|
|
3895
|
+
guidance: guidance.message
|
|
3896
|
+
}
|
|
3897
|
+
] : isApiError ? [
|
|
3861
3898
|
{
|
|
3862
3899
|
dimension: "verify_access.api_error",
|
|
3863
3900
|
message: reason ?? "Verification temporarily unavailable",
|
|
3864
3901
|
guidance: guidance.message
|
|
3865
3902
|
}
|
|
3866
3903
|
] : void 0,
|
|
3904
|
+
// 4.0.0: typed marker so adapters render the misconfig envelope (503 +
|
|
3905
|
+
// MERCHANT_VERIFICATION_MISCONFIGURED) without string-matching.
|
|
3906
|
+
...isMisconfig && { misconfigured: true },
|
|
3867
3907
|
correlationId: options.correlationId,
|
|
3868
3908
|
attemptId: options.attemptId,
|
|
3869
3909
|
verifiedAt: /* @__PURE__ */ new Date()
|
|
@@ -3918,7 +3958,8 @@ async function callVerifyAccessAPI(config, request) {
|
|
|
3918
3958
|
const response = await fetch(`${config.apiBaseUrl}/agents/verify-access`, {
|
|
3919
3959
|
method: "POST",
|
|
3920
3960
|
headers,
|
|
3921
|
-
body: JSON.stringify(body)
|
|
3961
|
+
body: JSON.stringify(body),
|
|
3962
|
+
signal: AbortSignal.timeout(config.verifyTimeoutMs ?? 1e4)
|
|
3922
3963
|
});
|
|
3923
3964
|
const data = await response.json();
|
|
3924
3965
|
if (response.status === 410) {
|
|
@@ -3942,6 +3983,17 @@ async function callVerifyAccessAPI(config, request) {
|
|
|
3942
3983
|
};
|
|
3943
3984
|
}
|
|
3944
3985
|
if (!response.ok) {
|
|
3986
|
+
if (response.status === 401) {
|
|
3987
|
+
return {
|
|
3988
|
+
success: false,
|
|
3989
|
+
error: data.message || data.error || "Integration API key rejected",
|
|
3990
|
+
misconfig: true,
|
|
3991
|
+
misconfigCode: typeof data?.code === "string" ? data.code : void 0,
|
|
3992
|
+
remediation: data?.remediation && typeof data.remediation === "object" ? data.remediation : void 0,
|
|
3993
|
+
correlationId: typeof data?.correlationId === "string" ? data.correlationId : void 0,
|
|
3994
|
+
attemptId: typeof data?.attemptId === "string" ? data.attemptId : void 0
|
|
3995
|
+
};
|
|
3996
|
+
}
|
|
3945
3997
|
return {
|
|
3946
3998
|
success: false,
|
|
3947
3999
|
error: data.message || data.error || `API returned ${response.status}`,
|
|
@@ -3963,9 +4015,19 @@ async function verify(config, request, options) {
|
|
|
3963
4015
|
const urls = mergedConfig.apiBaseUrl ? getCachedWellKnownUrls(mergedConfig.apiBaseUrl) : void 0;
|
|
3964
4016
|
if (!initCheckPerformed && !mergedConfig.disableInitChecks && mergedConfig.apiBaseUrl) {
|
|
3965
4017
|
if (mergedConfig.strictInit) {
|
|
3966
|
-
await performInitCheck(
|
|
4018
|
+
await performInitCheck(
|
|
4019
|
+
mergedConfig.apiBaseUrl,
|
|
4020
|
+
mergedConfig.debug,
|
|
4021
|
+
true,
|
|
4022
|
+
mergedConfig.apiKey
|
|
4023
|
+
);
|
|
3967
4024
|
} else {
|
|
3968
|
-
void performInitCheck(
|
|
4025
|
+
void performInitCheck(
|
|
4026
|
+
mergedConfig.apiBaseUrl,
|
|
4027
|
+
mergedConfig.debug,
|
|
4028
|
+
false,
|
|
4029
|
+
mergedConfig.apiKey
|
|
4030
|
+
);
|
|
3969
4031
|
}
|
|
3970
4032
|
}
|
|
3971
4033
|
if (!deprecationWarningShown && (config.minTrustScore !== void 0 || config.minTrustScoreForFull !== void 0)) {
|
|
@@ -4004,9 +4066,10 @@ async function verify(config, request, options) {
|
|
|
4004
4066
|
const serverDenialReasons = Array.isArray(rawServerDenialReasons) && rawServerDenialReasons.length > 0 ? rawServerDenialReasons : void 0;
|
|
4005
4067
|
if (!apiResponse.success) {
|
|
4006
4068
|
return createGuidanceResponse(mergedConfig, apiResponse.error, {
|
|
4007
|
-
source: "api_error",
|
|
4069
|
+
source: apiResponse.misconfig ? "merchant_misconfig" : "api_error",
|
|
4008
4070
|
correlationId: apiResponse.correlationId,
|
|
4009
4071
|
attemptId: apiResponse.attemptId,
|
|
4072
|
+
remediation: apiResponse.remediation,
|
|
4010
4073
|
urls
|
|
4011
4074
|
});
|
|
4012
4075
|
}
|