@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/gateway/gateway.mjs
CHANGED
|
@@ -3722,7 +3722,7 @@ function getTrustLevel(score) {
|
|
|
3722
3722
|
}
|
|
3723
3723
|
|
|
3724
3724
|
// src/version.ts
|
|
3725
|
-
var SDK_VERSION = "5.
|
|
3725
|
+
var SDK_VERSION = "5.13.0";
|
|
3726
3726
|
|
|
3727
3727
|
// src/http.ts
|
|
3728
3728
|
var SDK_USER_AGENT = `astrasync-sdk/${SDK_VERSION}`;
|
|
@@ -3769,7 +3769,7 @@ var DEFAULT_CONFIG = {
|
|
|
3769
3769
|
};
|
|
3770
3770
|
var initCheckPerformed = false;
|
|
3771
3771
|
var deprecationWarningShown = false;
|
|
3772
|
-
async function performInitCheck(apiBaseUrl, debug, strictInit, apiKey) {
|
|
3772
|
+
async function performInitCheck(apiBaseUrl, debug, strictInit, apiKey, counterparty) {
|
|
3773
3773
|
initCheckPerformed = true;
|
|
3774
3774
|
try {
|
|
3775
3775
|
const probeUrl = `${apiBaseUrl}/agents/verify-access`;
|
|
@@ -3787,7 +3787,8 @@ async function performInitCheck(apiBaseUrl, debug, strictInit, apiKey) {
|
|
|
3787
3787
|
);
|
|
3788
3788
|
}
|
|
3789
3789
|
if (apiKey) {
|
|
3790
|
-
const
|
|
3790
|
+
const q = counterparty?.id ? `?counterpartyId=${encodeURIComponent(counterparty.id)}` : counterparty?.url ? `?counterpartyUrl=${encodeURIComponent(counterparty.url)}` : "";
|
|
3791
|
+
const selfCheck = await sdkFetch(`${apiBaseUrl}/agents/verify-access/self-check${q}`, {
|
|
3791
3792
|
headers: { Authorization: `Bearer ${apiKey}` }
|
|
3792
3793
|
});
|
|
3793
3794
|
if (selfCheck.status === 401) {
|
|
@@ -3799,6 +3800,13 @@ async function performInitCheck(apiBaseUrl, debug, strictInit, apiKey) {
|
|
|
3799
3800
|
console.error(message);
|
|
3800
3801
|
} else if (selfCheck.ok) {
|
|
3801
3802
|
const body = await selfCheck.json().catch(() => ({}));
|
|
3803
|
+
if (body.counterparty && body.counterparty.canVerify === false) {
|
|
3804
|
+
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.`;
|
|
3805
|
+
if (strictInit) {
|
|
3806
|
+
throw new Error(`${message} (strictInit=true)`);
|
|
3807
|
+
}
|
|
3808
|
+
console.error(message);
|
|
3809
|
+
}
|
|
3802
3810
|
if (typeof body.daysToExpiry === "number" && body.daysToExpiry <= 7) {
|
|
3803
3811
|
console.warn(
|
|
3804
3812
|
`[VerificationGateway] the configured AstraSync API key expires in ${body.daysToExpiry} day(s) \u2014 rotate it at Settings \u2192 Developer Tools before integrations start failing.`
|
|
@@ -3903,11 +3911,11 @@ function createGuidanceResponse(_config, reason, options = {}) {
|
|
|
3903
3911
|
const isMisconfig = source === "merchant_misconfig";
|
|
3904
3912
|
const urls = options.urls;
|
|
3905
3913
|
const guidance = isMisconfig ? {
|
|
3906
|
-
message: "This site's AstraSync integration is misconfigured (its API key was revoked, expired, or
|
|
3914
|
+
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.",
|
|
3907
3915
|
registrationUrl: urls?.registrationUrl ?? "",
|
|
3908
3916
|
documentationUrl: options.remediation?.docsUrl ?? urls?.documentationUrl ?? "",
|
|
3909
3917
|
steps: [
|
|
3910
|
-
"Report the failure to the site operator \u2014 their AstraSync API key needs
|
|
3918
|
+
"Report the failure to the site operator \u2014 their AstraSync API key needs replacing",
|
|
3911
3919
|
"Do not retry: the failure is deterministic until the operator updates their key"
|
|
3912
3920
|
]
|
|
3913
3921
|
} : isApiError ? {
|
|
@@ -4119,12 +4127,13 @@ async function callVerifyAccessAPI(config, request) {
|
|
|
4119
4127
|
};
|
|
4120
4128
|
}
|
|
4121
4129
|
if (!response.ok) {
|
|
4122
|
-
|
|
4130
|
+
const keyMismatch = response.status === 403 && data?.error === "COUNTERPARTY_KEY_MISMATCH";
|
|
4131
|
+
if (response.status === 401 || keyMismatch) {
|
|
4123
4132
|
return {
|
|
4124
4133
|
success: false,
|
|
4125
4134
|
error: data.message || data.error || "Integration API key rejected",
|
|
4126
4135
|
misconfig: true,
|
|
4127
|
-
misconfigCode: typeof data?.code === "string" ? data.code : void 0,
|
|
4136
|
+
misconfigCode: keyMismatch ? "counterparty_key_mismatch" : typeof data?.code === "string" ? data.code : void 0,
|
|
4128
4137
|
remediation: data?.remediation && typeof data.remediation === "object" ? data.remediation : void 0,
|
|
4129
4138
|
correlationId: typeof data?.correlationId === "string" ? data.correlationId : void 0,
|
|
4130
4139
|
attemptId: typeof data?.attemptId === "string" ? data.attemptId : void 0
|
|
@@ -4157,14 +4166,22 @@ async function verify(config, request, options) {
|
|
|
4157
4166
|
mergedConfig.apiBaseUrl,
|
|
4158
4167
|
mergedConfig.debug,
|
|
4159
4168
|
true,
|
|
4160
|
-
mergedConfig.apiKey
|
|
4169
|
+
mergedConfig.apiKey,
|
|
4170
|
+
{
|
|
4171
|
+
id: mergedConfig.counterpartyId,
|
|
4172
|
+
url: mergedConfig.counterpartyUrl ?? request.counterpartyUrl
|
|
4173
|
+
}
|
|
4161
4174
|
);
|
|
4162
4175
|
} else {
|
|
4163
4176
|
void performInitCheck(
|
|
4164
4177
|
mergedConfig.apiBaseUrl,
|
|
4165
4178
|
mergedConfig.debug,
|
|
4166
4179
|
false,
|
|
4167
|
-
mergedConfig.apiKey
|
|
4180
|
+
mergedConfig.apiKey,
|
|
4181
|
+
{
|
|
4182
|
+
id: mergedConfig.counterpartyId,
|
|
4183
|
+
url: mergedConfig.counterpartyUrl ?? request.counterpartyUrl
|
|
4184
|
+
}
|
|
4168
4185
|
);
|
|
4169
4186
|
}
|
|
4170
4187
|
}
|