@astrasyncai/verification-gateway 3.4.0 → 3.5.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.
Files changed (84) hide show
  1. package/README.md +86 -0
  2. package/dist/adapter-interface/interface.d.mts +2 -2
  3. package/dist/adapter-interface/interface.d.ts +2 -2
  4. package/dist/adapters/express.d.mts +2 -2
  5. package/dist/adapters/express.d.ts +2 -2
  6. package/dist/adapters/express.js +18 -1
  7. package/dist/adapters/express.js.map +1 -1
  8. package/dist/adapters/express.mjs +18 -1
  9. package/dist/adapters/express.mjs.map +1 -1
  10. package/dist/adapters/mcp.d.mts +1 -1
  11. package/dist/adapters/mcp.d.ts +1 -1
  12. package/dist/adapters/mcp.js +1 -1
  13. package/dist/adapters/mcp.js.map +1 -1
  14. package/dist/adapters/mcp.mjs +1 -1
  15. package/dist/adapters/mcp.mjs.map +1 -1
  16. package/dist/adapters/nextjs.d.mts +2 -2
  17. package/dist/adapters/nextjs.d.ts +2 -2
  18. package/dist/adapters/nextjs.js +1 -1
  19. package/dist/adapters/nextjs.js.map +1 -1
  20. package/dist/adapters/nextjs.mjs +1 -1
  21. package/dist/adapters/nextjs.mjs.map +1 -1
  22. package/dist/adapters/sdk.d.mts +2 -2
  23. package/dist/adapters/sdk.d.ts +2 -2
  24. package/dist/adapters/sdk.js +1 -1
  25. package/dist/adapters/sdk.js.map +1 -1
  26. package/dist/adapters/sdk.mjs +1 -1
  27. package/dist/adapters/sdk.mjs.map +1 -1
  28. package/dist/agent/index.d.mts +2 -2
  29. package/dist/agent/index.d.ts +2 -2
  30. package/dist/browser/background.js +1 -1
  31. package/dist/browser/background.js.map +1 -1
  32. package/dist/browser/background.mjs +1 -1
  33. package/dist/browser/background.mjs.map +1 -1
  34. package/dist/browser/browser-adapter.d.mts +2 -2
  35. package/dist/browser/browser-adapter.d.ts +2 -2
  36. package/dist/cli/index.d.mts +2 -2
  37. package/dist/cli/index.d.ts +2 -2
  38. package/dist/cursor/cursor-adapter.d.mts +2 -2
  39. package/dist/cursor/cursor-adapter.d.ts +2 -2
  40. package/dist/cursor/extension.d.mts +2 -2
  41. package/dist/cursor/extension.d.ts +2 -2
  42. package/dist/cursor/extension.js +1 -1
  43. package/dist/cursor/extension.js.map +1 -1
  44. package/dist/cursor/extension.mjs +1 -1
  45. package/dist/cursor/extension.mjs.map +1 -1
  46. package/dist/{express-CeFvNWDD.d.mts → express-BH5ADAyb.d.mts} +1 -1
  47. package/dist/{express-RIh05wW2.d.ts → express-jUzLIoep.d.ts} +1 -1
  48. package/dist/gateway/gateway.d.mts +2 -2
  49. package/dist/gateway/gateway.d.ts +2 -2
  50. package/dist/gateway/gateway.js +1 -1
  51. package/dist/gateway/gateway.js.map +1 -1
  52. package/dist/gateway/gateway.mjs +1 -1
  53. package/dist/gateway/gateway.mjs.map +1 -1
  54. package/dist/git-trigger/git-hooks.d.mts +2 -2
  55. package/dist/git-trigger/git-hooks.d.ts +2 -2
  56. package/dist/{index-Bw4FeHMY.d.mts → index-BR2nmxBU.d.mts} +5 -1
  57. package/dist/{index-C-K0WCrk.d.ts → index-DEixUCu0.d.ts} +5 -1
  58. package/dist/{index-BYu1FKMy.d.ts → index-DlCnmpJH.d.ts} +1 -1
  59. package/dist/{index-DgVBEiwI.d.mts → index-aZHAWujT.d.mts} +1 -1
  60. package/dist/index.d.mts +7 -7
  61. package/dist/index.d.ts +7 -7
  62. package/dist/index.js +40 -5
  63. package/dist/index.js.map +1 -1
  64. package/dist/index.mjs +40 -5
  65. package/dist/index.mjs.map +1 -1
  66. package/dist/local-evaluator/evaluator.d.mts +2 -2
  67. package/dist/local-evaluator/evaluator.d.ts +2 -2
  68. package/dist/{nextjs--xR9zbSJ.d.ts → nextjs-DfXOd0Au.d.ts} +1 -1
  69. package/dist/{nextjs-xciaMpsZ.d.mts → nextjs-LTeoPqMH.d.mts} +1 -1
  70. package/dist/{sdk-CJYCLMI0.d.mts → sdk-DKhwVL9X.d.mts} +1 -1
  71. package/dist/{sdk-FP7xT9F8.d.ts → sdk-LmvyDVpL.d.ts} +1 -1
  72. package/dist/transport/index.d.mts +2 -2
  73. package/dist/transport/index.d.ts +2 -2
  74. package/dist/transport/index.js +22 -4
  75. package/dist/transport/index.js.map +1 -1
  76. package/dist/transport/index.mjs +22 -4
  77. package/dist/transport/index.mjs.map +1 -1
  78. package/dist/{types-Cj92yKeA.d.mts → types-C8HyQEaz.d.mts} +1 -1
  79. package/dist/{types-Cwrvo30g.d.mts → types-DrDIouvO.d.mts} +24 -2
  80. package/dist/{types-Cwrvo30g.d.ts → types-DrDIouvO.d.ts} +24 -2
  81. package/dist/{types-DOeL-dIw.d.ts → types-xofemo0G.d.ts} +1 -1
  82. package/dist/ui/index.d.mts +1 -1
  83. package/dist/ui/index.d.ts +1 -1
  84. 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-Cj92yKeA.mjs';
3
- import '../types-Cwrvo30g.mjs';
2
+ import { V as VerificationDecision, P as PDLSSContext } from '../types-C8HyQEaz.mjs';
3
+ import '../types-DrDIouvO.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-DOeL-dIw.js';
3
- import '../types-Cwrvo30g.js';
2
+ import { V as VerificationDecision, P as PDLSSContext } from '../types-xofemo0G.js';
3
+ import '../types-DrDIouvO.js';
4
4
 
5
5
  /**
6
6
  * Git Trigger — Enterprise git push / PR verification
@@ -1,4 +1,4 @@
1
- import { c as AstraSyncCredentials, g as ProtocolTransport } from './types-Cwrvo30g.mjs';
1
+ import { c as AstraSyncCredentials, g as ProtocolTransport } from './types-DrDIouvO.mjs';
2
2
  import { JWK } from 'jose';
3
3
 
4
4
  /**
@@ -96,6 +96,10 @@ interface TransactionValueContext {
96
96
  amount: number;
97
97
  currency: string;
98
98
  source: string;
99
+ /** When true, the amount is in raw atomic/minor units and could NOT be
100
+ * converted to major units (unknown token decimals). The limit engine
101
+ * must fail-closed — never compare raw units against major-unit limits. */
102
+ rawUnits?: boolean;
99
103
  }
100
104
  declare function extractUCPTransactionValue(input: {
101
105
  totals?: Array<{
@@ -1,4 +1,4 @@
1
- import { c as AstraSyncCredentials, g as ProtocolTransport } from './types-Cwrvo30g.js';
1
+ import { c as AstraSyncCredentials, g as ProtocolTransport } from './types-DrDIouvO.js';
2
2
  import { JWK } from 'jose';
3
3
 
4
4
  /**
@@ -96,6 +96,10 @@ interface TransactionValueContext {
96
96
  amount: number;
97
97
  currency: string;
98
98
  source: string;
99
+ /** When true, the amount is in raw atomic/minor units and could NOT be
100
+ * converted to major units (unknown token decimals). The limit engine
101
+ * must fail-closed — never compare raw units against major-unit limits. */
102
+ rawUnits?: boolean;
99
103
  }
100
104
  declare function extractUCPTransactionValue(input: {
101
105
  totals?: Array<{
@@ -1,4 +1,4 @@
1
- import { c as AstraSyncCredentials, g as ProtocolTransport, G as GatewayConfig } from './types-Cwrvo30g.js';
1
+ import { c as AstraSyncCredentials, g as ProtocolTransport, G as GatewayConfig } from './types-DrDIouvO.js';
2
2
 
3
3
  /**
4
4
  * AgentClient — Credential Presentation
@@ -1,4 +1,4 @@
1
- import { c as AstraSyncCredentials, g as ProtocolTransport, G as GatewayConfig } from './types-Cwrvo30g.mjs';
1
+ import { c as AstraSyncCredentials, g as ProtocolTransport, G as GatewayConfig } from './types-DrDIouvO.mjs';
2
2
 
3
3
  /**
4
4
  * AgentClient — Credential Presentation
package/dist/index.d.mts CHANGED
@@ -1,12 +1,12 @@
1
- import { b as AgentCredentials, G as GatewayConfig, a as AccessLevel, V as VerificationRequest, l as VerificationResult, E as EnhancedVerificationResult, A as AccessFailure, j as StepUpApprovalInfo } from './types-Cwrvo30g.mjs';
2
- export { c as AstraSyncCredentials, C as CommerceShieldProps, d as CounterpartyType, e as ExpressMiddlewareOptions, f as GuidanceInfo, N as NextJsMiddlewareOptions, P as PDLSSInfo, g as ProtocolTransport, R as RouteAccessConfig, h as RuntimeChallengeResult, S as SDKOptions, i as SettlementArtifact, T as TokenGuidance, k as TrustLevel, m as VerifiedAgent, n as VerifiedDeveloper, o as VerifiedOrganization } from './types-Cwrvo30g.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, e as getCapabilities, f as getTrustLevel, h as hasMinimumAccess, s as sdk } from './sdk-CJYCLMI0.mjs';
4
- export { e as express } from './express-CeFvNWDD.mjs';
5
- export { n as nextjs } from './nextjs-xciaMpsZ.mjs';
6
- export { aR as extractMcpCredentials, bg as setMcpMeta, b1 as transport } from './index-Bw4FeHMY.mjs';
1
+ import { b as AgentCredentials, G as GatewayConfig, a as AccessLevel, V as VerificationRequest, l as VerificationResult, E as EnhancedVerificationResult, A as AccessFailure, j as StepUpApprovalInfo } from './types-DrDIouvO.mjs';
2
+ export { c as AstraSyncCredentials, C as CommerceShieldProps, d as CounterpartyType, e as ExpressMiddlewareOptions, f as GuidanceInfo, N as NextJsMiddlewareOptions, P as PDLSSInfo, g as ProtocolTransport, R as RouteAccessConfig, h as RuntimeChallengeResult, S as SDKOptions, i as SettlementArtifact, T as TokenGuidance, k as TrustLevel, m as VerifiedAgent, n as VerifiedDeveloper, o as VerifiedOrganization } from './types-DrDIouvO.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, e as getCapabilities, f as getTrustLevel, h as hasMinimumAccess, s as sdk } from './sdk-DKhwVL9X.mjs';
4
+ export { e as express } from './express-BH5ADAyb.mjs';
5
+ export { n as nextjs } from './nextjs-LTeoPqMH.mjs';
6
+ export { aR as extractMcpCredentials, bg as setMcpMeta, b1 as transport } from './index-BR2nmxBU.mjs';
7
7
  export { McpMiddlewareOptions, ToolGateConfig, createMcpMiddleware } from './adapters/mcp.mjs';
8
8
  export { AgentProtocol, AgentRecord, AstraSync, AstraSyncConfig, AstraSyncError, AuthenticationError, BuildGuidanceParams, FrameworkConfig, GuidanceEnvelope, HealthResponse, KYDRequiredError, ModelConfig, PDLSSConfig, PDLSSDuration, PDLSSLimits, PDLSSPurpose, PDLSSScope, PDLSSSelfInstantiation, PendingRegistrationResponse, PollRegistrationResult, RegisterOptions, RegisterResult, RegistrationDeniedError, RegistrationExpiredError, RegistrationResponse, RegistrationTimeoutError, VerifyResponse, WaitForApprovalOptions, buildGuidance } from './registration/index.mjs';
9
- export { A as AgentClient, C as ChallengeHandler, i as agent, r as recordDecision } from './index-DgVBEiwI.mjs';
9
+ export { A as AgentClient, C as ChallengeHandler, i as agent, r as recordDecision } from './index-aZHAWujT.mjs';
10
10
  import 'express';
11
11
  import 'next/server';
12
12
  import 'jose';
package/dist/index.d.ts CHANGED
@@ -1,12 +1,12 @@
1
- import { b as AgentCredentials, G as GatewayConfig, a as AccessLevel, V as VerificationRequest, l as VerificationResult, E as EnhancedVerificationResult, A as AccessFailure, j as StepUpApprovalInfo } from './types-Cwrvo30g.js';
2
- export { c as AstraSyncCredentials, C as CommerceShieldProps, d as CounterpartyType, e as ExpressMiddlewareOptions, f as GuidanceInfo, N as NextJsMiddlewareOptions, P as PDLSSInfo, g as ProtocolTransport, R as RouteAccessConfig, h as RuntimeChallengeResult, S as SDKOptions, i as SettlementArtifact, T as TokenGuidance, k as TrustLevel, m as VerifiedAgent, n as VerifiedDeveloper, o as VerifiedOrganization } from './types-Cwrvo30g.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, e as getCapabilities, f as getTrustLevel, h as hasMinimumAccess, s as sdk } from './sdk-FP7xT9F8.js';
4
- export { e as express } from './express-RIh05wW2.js';
5
- export { n as nextjs } from './nextjs--xR9zbSJ.js';
6
- export { aR as extractMcpCredentials, bg as setMcpMeta, b1 as transport } from './index-C-K0WCrk.js';
1
+ import { b as AgentCredentials, G as GatewayConfig, a as AccessLevel, V as VerificationRequest, l as VerificationResult, E as EnhancedVerificationResult, A as AccessFailure, j as StepUpApprovalInfo } from './types-DrDIouvO.js';
2
+ export { c as AstraSyncCredentials, C as CommerceShieldProps, d as CounterpartyType, e as ExpressMiddlewareOptions, f as GuidanceInfo, N as NextJsMiddlewareOptions, P as PDLSSInfo, g as ProtocolTransport, R as RouteAccessConfig, h as RuntimeChallengeResult, S as SDKOptions, i as SettlementArtifact, T as TokenGuidance, k as TrustLevel, m as VerifiedAgent, n as VerifiedDeveloper, o as VerifiedOrganization } from './types-DrDIouvO.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, e as getCapabilities, f as getTrustLevel, h as hasMinimumAccess, s as sdk } from './sdk-LmvyDVpL.js';
4
+ export { e as express } from './express-jUzLIoep.js';
5
+ export { n as nextjs } from './nextjs-DfXOd0Au.js';
6
+ export { aR as extractMcpCredentials, bg as setMcpMeta, b1 as transport } from './index-DEixUCu0.js';
7
7
  export { McpMiddlewareOptions, ToolGateConfig, createMcpMiddleware } from './adapters/mcp.js';
8
8
  export { AgentProtocol, AgentRecord, AstraSync, AstraSyncConfig, AstraSyncError, AuthenticationError, BuildGuidanceParams, FrameworkConfig, GuidanceEnvelope, HealthResponse, KYDRequiredError, ModelConfig, PDLSSConfig, PDLSSDuration, PDLSSLimits, PDLSSPurpose, PDLSSScope, PDLSSSelfInstantiation, PendingRegistrationResponse, PollRegistrationResult, RegisterOptions, RegisterResult, RegistrationDeniedError, RegistrationExpiredError, RegistrationResponse, RegistrationTimeoutError, VerifyResponse, WaitForApprovalOptions, buildGuidance } from './registration/index.js';
9
- export { A as AgentClient, C as ChallengeHandler, i as agent, r as recordDecision } from './index-BYu1FKMy.js';
9
+ export { A as AgentClient, C as ChallengeHandler, i as agent, r as recordDecision } from './index-DlCnmpJH.js';
10
10
  import 'express';
11
11
  import 'next/server';
12
12
  import 'jose';
package/dist/index.js CHANGED
@@ -193,7 +193,7 @@ function getCapabilities(accessLevel) {
193
193
  }
194
194
 
195
195
  // src/version.ts
196
- var SDK_VERSION = "3.3.0";
196
+ var SDK_VERSION = "3.5.0";
197
197
 
198
198
  // src/well-known.ts
199
199
  var CACHE_TTL_MS = 60 * 60 * 1e3;
@@ -1243,6 +1243,21 @@ function createMiddleware(options) {
1243
1243
  );
1244
1244
  }
1245
1245
  const agentCardUrl = typeof req.headers["x-astrasync-agent-card"] === "string" ? req.headers["x-astrasync-agent-card"] : void 0;
1246
+ let txValue;
1247
+ let txCurrency;
1248
+ if (config.extractTransactionValue) {
1249
+ try {
1250
+ const extracted = config.extractTransactionValue(req);
1251
+ if (extracted) {
1252
+ txValue = extracted.value;
1253
+ txCurrency = extracted.currency;
1254
+ }
1255
+ } catch (e) {
1256
+ if (config.debug) {
1257
+ console.warn("[VerificationGateway] extractTransactionValue threw:", e);
1258
+ }
1259
+ }
1260
+ }
1246
1261
  const result = await verify(config, {
1247
1262
  credentials,
1248
1263
  purpose,
@@ -1253,6 +1268,8 @@ function createMiddleware(options) {
1253
1268
  counterpartyType: config.counterpartyType || "api",
1254
1269
  enableRuntimeChallenge,
1255
1270
  durationRequired: astraCreds?.pdlss?.duration?.maxSessionDuration,
1271
+ ...txValue !== void 0 && { transactionValue: txValue },
1272
+ ...txCurrency && { currency: txCurrency },
1256
1273
  callerMetadata: {
1257
1274
  sourceIp: originalClientIp,
1258
1275
  userAgent: req.headers["user-agent"],
@@ -2233,15 +2250,33 @@ function extractMPPTransactionValue(challenge) {
2233
2250
  source: `challenge.request.amount (method=${challenge.method ?? "unknown"})`
2234
2251
  };
2235
2252
  }
2253
+ var KNOWN_TOKEN_DECIMALS = {
2254
+ USDC: 6,
2255
+ USDT: 6,
2256
+ DAI: 18,
2257
+ ETH: 18,
2258
+ WETH: 18
2259
+ };
2236
2260
  function extractX402TransactionValue(req) {
2237
- const amount = req.maxAmountRequired ?? req.amount;
2261
+ const rawAmount = req.maxAmountRequired ?? req.amount;
2238
2262
  const currency = req.currency ?? req.asset;
2239
- if (typeof amount !== "number" || !currency) return null;
2263
+ if (typeof rawAmount !== "number" || !currency) return null;
2264
+ const source = req.maxAmountRequired !== void 0 ? "maxAmountRequired" : "amount";
2265
+ const decimals = KNOWN_TOKEN_DECIMALS[currency.toUpperCase()];
2266
+ if (decimals !== void 0) {
2267
+ return {
2268
+ protocol: "x402",
2269
+ amount: rawAmount / Math.pow(10, decimals),
2270
+ currency,
2271
+ source
2272
+ };
2273
+ }
2240
2274
  return {
2241
2275
  protocol: "x402",
2242
- amount,
2276
+ amount: rawAmount,
2243
2277
  currency,
2244
- source: req.maxAmountRequired !== void 0 ? "maxAmountRequired" : "amount"
2278
+ source,
2279
+ rawUnits: true
2245
2280
  };
2246
2281
  }
2247
2282