@astrasyncai/verification-gateway 5.12.0 → 5.13.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/adapters/express.js +36 -10
- package/dist/adapters/express.js.map +1 -1
- package/dist/adapters/express.mjs +36 -10
- package/dist/adapters/express.mjs.map +1 -1
- package/dist/adapters/mcp.js +26 -9
- package/dist/adapters/mcp.js.map +1 -1
- package/dist/adapters/mcp.mjs +26 -9
- package/dist/adapters/mcp.mjs.map +1 -1
- package/dist/adapters/nextjs.js +36 -10
- package/dist/adapters/nextjs.js.map +1 -1
- package/dist/adapters/nextjs.mjs +36 -10
- package/dist/adapters/nextjs.mjs.map +1 -1
- package/dist/adapters/sdk.js +26 -9
- package/dist/adapters/sdk.js.map +1 -1
- package/dist/adapters/sdk.mjs +26 -9
- package/dist/adapters/sdk.mjs.map +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 +26 -9
- package/dist/bin/astrasync-codex-hook.js +26 -9
- package/dist/bin/astrasync-guard.js +26 -9
- package/dist/bin/astrasync.js +26 -9
- package/dist/browser/background.js +26 -9
- package/dist/browser/background.js.map +1 -1
- package/dist/browser/background.mjs +26 -9
- 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 +26 -9
- package/dist/codex/index.js.map +1 -1
- package/dist/codex/index.mjs +26 -9
- package/dist/codex/index.mjs.map +1 -1
- package/dist/cursor/extension.js +26 -9
- package/dist/cursor/extension.js.map +1 -1
- package/dist/cursor/extension.mjs +26 -9
- package/dist/cursor/extension.mjs.map +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.js +26 -9
- package/dist/edge-core/index.js.map +1 -1
- package/dist/edge-core/index.mjs +26 -9
- package/dist/edge-core/index.mjs.map +1 -1
- package/dist/gateway/gateway.js +26 -9
- package/dist/gateway/gateway.js.map +1 -1
- package/dist/gateway/gateway.mjs +26 -9
- package/dist/gateway/gateway.mjs.map +1 -1
- package/dist/index.d.mts +2 -12
- package/dist/index.d.ts +2 -12
- package/dist/index.js +36 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +36 -10
- package/dist/index.mjs.map +1 -1
- 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.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/verify.d.mts +0 -10
- package/dist/verify.d.ts +0 -10
- package/dist/verify.js +36 -10
- package/dist/verify.js.map +1 -1
- package/dist/verify.mjs +36 -10
- package/dist/verify.mjs.map +1 -1
- package/package.json +3 -2
|
@@ -3986,7 +3986,7 @@ function getTrustLevel(score) {
|
|
|
3986
3986
|
}
|
|
3987
3987
|
|
|
3988
3988
|
// src/version.ts
|
|
3989
|
-
var SDK_VERSION = "5.
|
|
3989
|
+
var SDK_VERSION = "5.13.0";
|
|
3990
3990
|
|
|
3991
3991
|
// src/http.ts
|
|
3992
3992
|
var SDK_USER_AGENT = `astrasync-sdk/${SDK_VERSION}`;
|
|
@@ -4033,7 +4033,7 @@ var DEFAULT_CONFIG = {
|
|
|
4033
4033
|
};
|
|
4034
4034
|
var initCheckPerformed = false;
|
|
4035
4035
|
var deprecationWarningShown = false;
|
|
4036
|
-
async function performInitCheck(apiBaseUrl, debug, strictInit, apiKey) {
|
|
4036
|
+
async function performInitCheck(apiBaseUrl, debug, strictInit, apiKey, counterparty) {
|
|
4037
4037
|
initCheckPerformed = true;
|
|
4038
4038
|
try {
|
|
4039
4039
|
const probeUrl = `${apiBaseUrl}/agents/verify-access`;
|
|
@@ -4051,7 +4051,8 @@ async function performInitCheck(apiBaseUrl, debug, strictInit, apiKey) {
|
|
|
4051
4051
|
);
|
|
4052
4052
|
}
|
|
4053
4053
|
if (apiKey) {
|
|
4054
|
-
const
|
|
4054
|
+
const q = counterparty?.id ? `?counterpartyId=${encodeURIComponent(counterparty.id)}` : counterparty?.url ? `?counterpartyUrl=${encodeURIComponent(counterparty.url)}` : "";
|
|
4055
|
+
const selfCheck = await sdkFetch(`${apiBaseUrl}/agents/verify-access/self-check${q}`, {
|
|
4055
4056
|
headers: { Authorization: `Bearer ${apiKey}` }
|
|
4056
4057
|
});
|
|
4057
4058
|
if (selfCheck.status === 401) {
|
|
@@ -4063,6 +4064,13 @@ async function performInitCheck(apiBaseUrl, debug, strictInit, apiKey) {
|
|
|
4063
4064
|
console.error(message);
|
|
4064
4065
|
} else if (selfCheck.ok) {
|
|
4065
4066
|
const body = await selfCheck.json().catch(() => ({}));
|
|
4067
|
+
if (body.counterparty && body.counterparty.canVerify === false) {
|
|
4068
|
+
const message = `[VerificationGateway] the configured AstraSync API key cannot verify for this endpoint (${body.counterparty.message ?? "endpoint not found or owned by another account"}). Every inbound agent will be turned away until the key or counterparty is corrected.`;
|
|
4069
|
+
if (strictInit) {
|
|
4070
|
+
throw new Error(`${message} (strictInit=true)`);
|
|
4071
|
+
}
|
|
4072
|
+
console.error(message);
|
|
4073
|
+
}
|
|
4066
4074
|
if (typeof body.daysToExpiry === "number" && body.daysToExpiry <= 7) {
|
|
4067
4075
|
console.warn(
|
|
4068
4076
|
`[VerificationGateway] the configured AstraSync API key expires in ${body.daysToExpiry} day(s) \u2014 rotate it at Settings \u2192 Developer Tools before integrations start failing.`
|
|
@@ -4167,11 +4175,11 @@ function createGuidanceResponse(_config, reason, options = {}) {
|
|
|
4167
4175
|
const isMisconfig = source === "merchant_misconfig";
|
|
4168
4176
|
const urls = options.urls;
|
|
4169
4177
|
const guidance = isMisconfig ? {
|
|
4170
|
-
message: "This site's AstraSync integration is misconfigured (its API key was revoked, expired, or
|
|
4178
|
+
message: "This site's AstraSync integration is misconfigured (its API key was revoked, expired, rotated, or belongs to another account). Your identity and the AstraSync platform are fine \u2014 contact the site operator. Retrying will not help.",
|
|
4171
4179
|
registrationUrl: urls?.registrationUrl ?? "",
|
|
4172
4180
|
documentationUrl: options.remediation?.docsUrl ?? urls?.documentationUrl ?? "",
|
|
4173
4181
|
steps: [
|
|
4174
|
-
"Report the failure to the site operator \u2014 their AstraSync API key needs
|
|
4182
|
+
"Report the failure to the site operator \u2014 their AstraSync API key needs replacing",
|
|
4175
4183
|
"Do not retry: the failure is deterministic until the operator updates their key"
|
|
4176
4184
|
]
|
|
4177
4185
|
} : isApiError ? {
|
|
@@ -4383,12 +4391,13 @@ async function callVerifyAccessAPI(config, request) {
|
|
|
4383
4391
|
};
|
|
4384
4392
|
}
|
|
4385
4393
|
if (!response.ok) {
|
|
4386
|
-
|
|
4394
|
+
const keyMismatch = response.status === 403 && data?.error === "COUNTERPARTY_KEY_MISMATCH";
|
|
4395
|
+
if (response.status === 401 || keyMismatch) {
|
|
4387
4396
|
return {
|
|
4388
4397
|
success: false,
|
|
4389
4398
|
error: data.message || data.error || "Integration API key rejected",
|
|
4390
4399
|
misconfig: true,
|
|
4391
|
-
misconfigCode: typeof data?.code === "string" ? data.code : void 0,
|
|
4400
|
+
misconfigCode: keyMismatch ? "counterparty_key_mismatch" : typeof data?.code === "string" ? data.code : void 0,
|
|
4392
4401
|
remediation: data?.remediation && typeof data.remediation === "object" ? data.remediation : void 0,
|
|
4393
4402
|
correlationId: typeof data?.correlationId === "string" ? data.correlationId : void 0,
|
|
4394
4403
|
attemptId: typeof data?.attemptId === "string" ? data.attemptId : void 0
|
|
@@ -4421,14 +4430,22 @@ async function verify(config, request, options) {
|
|
|
4421
4430
|
mergedConfig.apiBaseUrl,
|
|
4422
4431
|
mergedConfig.debug,
|
|
4423
4432
|
true,
|
|
4424
|
-
mergedConfig.apiKey
|
|
4433
|
+
mergedConfig.apiKey,
|
|
4434
|
+
{
|
|
4435
|
+
id: mergedConfig.counterpartyId,
|
|
4436
|
+
url: mergedConfig.counterpartyUrl ?? request.counterpartyUrl
|
|
4437
|
+
}
|
|
4425
4438
|
);
|
|
4426
4439
|
} else {
|
|
4427
4440
|
void performInitCheck(
|
|
4428
4441
|
mergedConfig.apiBaseUrl,
|
|
4429
4442
|
mergedConfig.debug,
|
|
4430
4443
|
false,
|
|
4431
|
-
mergedConfig.apiKey
|
|
4444
|
+
mergedConfig.apiKey,
|
|
4445
|
+
{
|
|
4446
|
+
id: mergedConfig.counterpartyId,
|
|
4447
|
+
url: mergedConfig.counterpartyUrl ?? request.counterpartyUrl
|
|
4448
|
+
}
|
|
4432
4449
|
);
|
|
4433
4450
|
}
|
|
4434
4451
|
}
|