@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
package/dist/codex/index.js
CHANGED
|
@@ -4036,7 +4036,7 @@ function getTrustLevel(score) {
|
|
|
4036
4036
|
}
|
|
4037
4037
|
|
|
4038
4038
|
// src/version.ts
|
|
4039
|
-
var SDK_VERSION = "5.
|
|
4039
|
+
var SDK_VERSION = "5.13.0";
|
|
4040
4040
|
|
|
4041
4041
|
// src/http.ts
|
|
4042
4042
|
var SDK_USER_AGENT = `astrasync-sdk/${SDK_VERSION}`;
|
|
@@ -4083,7 +4083,7 @@ var DEFAULT_CONFIG = {
|
|
|
4083
4083
|
};
|
|
4084
4084
|
var initCheckPerformed = false;
|
|
4085
4085
|
var deprecationWarningShown = false;
|
|
4086
|
-
async function performInitCheck(apiBaseUrl, debug, strictInit, apiKey) {
|
|
4086
|
+
async function performInitCheck(apiBaseUrl, debug, strictInit, apiKey, counterparty) {
|
|
4087
4087
|
initCheckPerformed = true;
|
|
4088
4088
|
try {
|
|
4089
4089
|
const probeUrl = `${apiBaseUrl}/agents/verify-access`;
|
|
@@ -4101,7 +4101,8 @@ async function performInitCheck(apiBaseUrl, debug, strictInit, apiKey) {
|
|
|
4101
4101
|
);
|
|
4102
4102
|
}
|
|
4103
4103
|
if (apiKey) {
|
|
4104
|
-
const
|
|
4104
|
+
const q = counterparty?.id ? `?counterpartyId=${encodeURIComponent(counterparty.id)}` : counterparty?.url ? `?counterpartyUrl=${encodeURIComponent(counterparty.url)}` : "";
|
|
4105
|
+
const selfCheck = await sdkFetch(`${apiBaseUrl}/agents/verify-access/self-check${q}`, {
|
|
4105
4106
|
headers: { Authorization: `Bearer ${apiKey}` }
|
|
4106
4107
|
});
|
|
4107
4108
|
if (selfCheck.status === 401) {
|
|
@@ -4113,6 +4114,13 @@ async function performInitCheck(apiBaseUrl, debug, strictInit, apiKey) {
|
|
|
4113
4114
|
console.error(message);
|
|
4114
4115
|
} else if (selfCheck.ok) {
|
|
4115
4116
|
const body = await selfCheck.json().catch(() => ({}));
|
|
4117
|
+
if (body.counterparty && body.counterparty.canVerify === false) {
|
|
4118
|
+
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.`;
|
|
4119
|
+
if (strictInit) {
|
|
4120
|
+
throw new Error(`${message} (strictInit=true)`);
|
|
4121
|
+
}
|
|
4122
|
+
console.error(message);
|
|
4123
|
+
}
|
|
4116
4124
|
if (typeof body.daysToExpiry === "number" && body.daysToExpiry <= 7) {
|
|
4117
4125
|
console.warn(
|
|
4118
4126
|
`[VerificationGateway] the configured AstraSync API key expires in ${body.daysToExpiry} day(s) \u2014 rotate it at Settings \u2192 Developer Tools before integrations start failing.`
|
|
@@ -4217,11 +4225,11 @@ function createGuidanceResponse(_config, reason, options = {}) {
|
|
|
4217
4225
|
const isMisconfig = source === "merchant_misconfig";
|
|
4218
4226
|
const urls = options.urls;
|
|
4219
4227
|
const guidance = isMisconfig ? {
|
|
4220
|
-
message: "This site's AstraSync integration is misconfigured (its API key was revoked, expired, or
|
|
4228
|
+
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.",
|
|
4221
4229
|
registrationUrl: urls?.registrationUrl ?? "",
|
|
4222
4230
|
documentationUrl: options.remediation?.docsUrl ?? urls?.documentationUrl ?? "",
|
|
4223
4231
|
steps: [
|
|
4224
|
-
"Report the failure to the site operator \u2014 their AstraSync API key needs
|
|
4232
|
+
"Report the failure to the site operator \u2014 their AstraSync API key needs replacing",
|
|
4225
4233
|
"Do not retry: the failure is deterministic until the operator updates their key"
|
|
4226
4234
|
]
|
|
4227
4235
|
} : isApiError ? {
|
|
@@ -4433,12 +4441,13 @@ async function callVerifyAccessAPI(config, request) {
|
|
|
4433
4441
|
};
|
|
4434
4442
|
}
|
|
4435
4443
|
if (!response.ok) {
|
|
4436
|
-
|
|
4444
|
+
const keyMismatch = response.status === 403 && data?.error === "COUNTERPARTY_KEY_MISMATCH";
|
|
4445
|
+
if (response.status === 401 || keyMismatch) {
|
|
4437
4446
|
return {
|
|
4438
4447
|
success: false,
|
|
4439
4448
|
error: data.message || data.error || "Integration API key rejected",
|
|
4440
4449
|
misconfig: true,
|
|
4441
|
-
misconfigCode: typeof data?.code === "string" ? data.code : void 0,
|
|
4450
|
+
misconfigCode: keyMismatch ? "counterparty_key_mismatch" : typeof data?.code === "string" ? data.code : void 0,
|
|
4442
4451
|
remediation: data?.remediation && typeof data.remediation === "object" ? data.remediation : void 0,
|
|
4443
4452
|
correlationId: typeof data?.correlationId === "string" ? data.correlationId : void 0,
|
|
4444
4453
|
attemptId: typeof data?.attemptId === "string" ? data.attemptId : void 0
|
|
@@ -4471,14 +4480,22 @@ async function verify(config, request, options) {
|
|
|
4471
4480
|
mergedConfig.apiBaseUrl,
|
|
4472
4481
|
mergedConfig.debug,
|
|
4473
4482
|
true,
|
|
4474
|
-
mergedConfig.apiKey
|
|
4483
|
+
mergedConfig.apiKey,
|
|
4484
|
+
{
|
|
4485
|
+
id: mergedConfig.counterpartyId,
|
|
4486
|
+
url: mergedConfig.counterpartyUrl ?? request.counterpartyUrl
|
|
4487
|
+
}
|
|
4475
4488
|
);
|
|
4476
4489
|
} else {
|
|
4477
4490
|
void performInitCheck(
|
|
4478
4491
|
mergedConfig.apiBaseUrl,
|
|
4479
4492
|
mergedConfig.debug,
|
|
4480
4493
|
false,
|
|
4481
|
-
mergedConfig.apiKey
|
|
4494
|
+
mergedConfig.apiKey,
|
|
4495
|
+
{
|
|
4496
|
+
id: mergedConfig.counterpartyId,
|
|
4497
|
+
url: mergedConfig.counterpartyUrl ?? request.counterpartyUrl
|
|
4498
|
+
}
|
|
4482
4499
|
);
|
|
4483
4500
|
}
|
|
4484
4501
|
}
|