@astrasyncai/verification-gateway 4.2.0 → 4.3.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 (112) hide show
  1. package/README.md +45 -21
  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 +56 -4
  7. package/dist/adapters/express.js.map +1 -1
  8. package/dist/adapters/express.mjs +56 -4
  9. package/dist/adapters/express.mjs.map +1 -1
  10. package/dist/adapters/mcp.d.mts +38 -30
  11. package/dist/adapters/mcp.d.ts +38 -30
  12. package/dist/adapters/mcp.js +22 -5
  13. package/dist/adapters/mcp.js.map +1 -1
  14. package/dist/adapters/mcp.mjs +22 -5
  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 +54 -4
  19. package/dist/adapters/nextjs.js.map +1 -1
  20. package/dist/adapters/nextjs.mjs +54 -4
  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/agent/index.d.mts +2 -2
  25. package/dist/agent/index.d.ts +2 -2
  26. package/dist/agent/index.js +2 -2
  27. package/dist/agent/index.js.map +1 -1
  28. package/dist/agent/index.mjs +2 -2
  29. package/dist/agent/index.mjs.map +1 -1
  30. package/dist/bin/astrasync-claude-hook.js +2 -2
  31. package/dist/bin/astrasync-codex-hook.js +2 -2
  32. package/dist/bin/astrasync-guard.js +2 -2
  33. package/dist/bin/astrasync.js +14 -4
  34. package/dist/browser/background.js +2 -2
  35. package/dist/browser/background.js.map +1 -1
  36. package/dist/browser/background.mjs +2 -2
  37. package/dist/browser/background.mjs.map +1 -1
  38. package/dist/browser/browser-adapter.d.mts +2 -2
  39. package/dist/browser/browser-adapter.d.ts +2 -2
  40. package/dist/claude-code/claude-code-adapter.d.mts +2 -2
  41. package/dist/claude-code/claude-code-adapter.d.ts +2 -2
  42. package/dist/cli/index.d.mts +2 -2
  43. package/dist/cli/index.d.ts +2 -2
  44. package/dist/codex/index.d.mts +2 -2
  45. package/dist/codex/index.d.ts +2 -2
  46. package/dist/codex/index.js +2 -2
  47. package/dist/codex/index.js.map +1 -1
  48. package/dist/codex/index.mjs +2 -2
  49. package/dist/codex/index.mjs.map +1 -1
  50. package/dist/cursor/cursor-adapter.d.mts +2 -2
  51. package/dist/cursor/cursor-adapter.d.ts +2 -2
  52. package/dist/cursor/extension.d.mts +2 -2
  53. package/dist/cursor/extension.d.ts +2 -2
  54. package/dist/cursor/extension.js +2 -2
  55. package/dist/cursor/extension.js.map +1 -1
  56. package/dist/cursor/extension.mjs +2 -2
  57. package/dist/cursor/extension.mjs.map +1 -1
  58. package/dist/edge-config.d.mts +1 -1
  59. package/dist/edge-config.d.ts +1 -1
  60. package/dist/edge-core/index.d.mts +1 -1
  61. package/dist/edge-core/index.d.ts +1 -1
  62. package/dist/edge-core/index.js +25 -5
  63. package/dist/edge-core/index.js.map +1 -1
  64. package/dist/edge-core/index.mjs +25 -5
  65. package/dist/edge-core/index.mjs.map +1 -1
  66. package/dist/{express-D_4hTn5Z.d.mts → express-CR6F3njD.d.mts} +1 -1
  67. package/dist/{express-BVd1_3FE.d.ts → express-DaqL11tx.d.ts} +1 -1
  68. package/dist/gateway/gateway.d.mts +2 -2
  69. package/dist/gateway/gateway.d.ts +2 -2
  70. package/dist/gateway/gateway.js +2 -2
  71. package/dist/gateway/gateway.js.map +1 -1
  72. package/dist/gateway/gateway.mjs +2 -2
  73. package/dist/gateway/gateway.mjs.map +1 -1
  74. package/dist/git-trigger/git-hooks.d.mts +2 -2
  75. package/dist/git-trigger/git-hooks.d.ts +2 -2
  76. package/dist/{index-B0YHu_SP.d.ts → index-B5Ts1WtM.d.ts} +3 -3
  77. package/dist/{index-T1aBoUcc.d.ts → index-BfIxCYIZ.d.ts} +1 -1
  78. package/dist/{index-BPEBlOsE.d.mts → index-Cub7lK-T.d.mts} +3 -3
  79. package/dist/{index-DQb5-_1X.d.mts → index-CwAh7Tln.d.mts} +1 -1
  80. package/dist/index.d.mts +7 -7
  81. package/dist/index.d.ts +7 -7
  82. package/dist/index.js +74 -35
  83. package/dist/index.js.map +1 -1
  84. package/dist/index.mjs +71 -32
  85. package/dist/index.mjs.map +1 -1
  86. package/dist/local-evaluator/evaluator.d.mts +2 -2
  87. package/dist/local-evaluator/evaluator.d.ts +2 -2
  88. package/dist/metadata-capture.d.mts +18 -5
  89. package/dist/metadata-capture.d.ts +18 -5
  90. package/dist/metadata-capture.js +21 -4
  91. package/dist/metadata-capture.js.map +1 -1
  92. package/dist/metadata-capture.mjs +20 -4
  93. package/dist/metadata-capture.mjs.map +1 -1
  94. package/dist/{nextjs-w7RTbP1P.d.ts → nextjs-DL6uE1ye.d.ts} +1 -1
  95. package/dist/{nextjs-WyeVr2Kp.d.mts → nextjs-DlX6xwbU.d.mts} +1 -1
  96. package/dist/{sdk-CbTNIkAa.d.mts → sdk-Bbh9B_dw.d.mts} +1 -1
  97. package/dist/{sdk-QeX0Z8Ho.d.ts → sdk-C6SASmsh.d.ts} +1 -1
  98. package/dist/transport/index.d.mts +2 -2
  99. package/dist/transport/index.d.ts +2 -2
  100. package/dist/transport/index.js +5 -5
  101. package/dist/transport/index.js.map +1 -1
  102. package/dist/transport/index.mjs +2 -2
  103. package/dist/transport/index.mjs.map +1 -1
  104. package/dist/{types-r850cOt0.d.mts → types-C0zfSXMB.d.mts} +22 -0
  105. package/dist/{types-DqfPU5Bl.d.mts → types-C7Rb-w0d.d.mts} +1 -1
  106. package/dist/{types-sMxBT-nM.d.ts → types-DwSfO7Sb.d.ts} +22 -0
  107. package/dist/{types-BLUx92FJ.d.ts → types-nIh3HtuA.d.ts} +1 -1
  108. package/dist/ui/index.d.mts +1 -1
  109. package/dist/ui/index.d.ts +1 -1
  110. package/dist/verify.d.mts +1 -1
  111. package/dist/verify.d.ts +1 -1
  112. package/package.json +2 -4
@@ -1,6 +1,6 @@
1
1
  import { AstraSyncGateway } from '../gateway/gateway.mjs';
2
- import { V as VerificationDecision, P as PDLSSContext } from '../types-DqfPU5Bl.mjs';
3
- import '../types-r850cOt0.mjs';
2
+ import { V as VerificationDecision, P as PDLSSContext } from '../types-C7Rb-w0d.mjs';
3
+ import '../types-C0zfSXMB.mjs';
4
4
  import '../metadata-capture.mjs';
5
5
 
6
6
  /**
@@ -1,6 +1,6 @@
1
1
  import { AstraSyncGateway } from '../gateway/gateway.js';
2
- import { V as VerificationDecision, P as PDLSSContext } from '../types-BLUx92FJ.js';
3
- import '../types-sMxBT-nM.js';
2
+ import { V as VerificationDecision, P as PDLSSContext } from '../types-nIh3HtuA.js';
3
+ import '../types-DwSfO7Sb.js';
4
4
  import '../metadata-capture.js';
5
5
 
6
6
  /**
@@ -1,4 +1,4 @@
1
- import { c as AstraSyncCredentials, m as ProtocolTransport } from './types-sMxBT-nM.js';
1
+ import { c as AstraSyncCredentials, m as ProtocolTransport } from './types-DwSfO7Sb.js';
2
2
  import { JWK } from 'jose';
3
3
 
4
4
  /**
@@ -628,7 +628,7 @@ declare const claim: {
628
628
  * - payment_mandate — authorizes the actual payment rail
629
629
  *
630
630
  * Mandates are cross-referenced via ids; each is an SD-JWT over ES256 (or
631
- * equivalent). We decode via @sd-jwt/decode and extract the AP2-specific
631
+ * equivalent). We decode via @sd-jwt/core and extract the AP2-specific
632
632
  * shape — verification lives in ap2-verify.ts.
633
633
  */
634
634
 
@@ -1024,7 +1024,7 @@ declare function extractX402Context(message: {
1024
1024
  * AstraSync-specific composition logic — that's the whitespace here.
1025
1025
  *
1026
1026
  * This module does NOT re-verify selective-disclosure hashes (the extractor
1027
- * already applied them via @sd-jwt/decode). It DOES verify:
1027
+ * already applied them via @sd-jwt/core). It DOES verify:
1028
1028
  * - cnf.jwk in L1 payload points to L2's signing key (thumbprint match)
1029
1029
  * - cnf.jwk in L2 payload points to L3's signing key
1030
1030
  * - L3a.transaction_id === L3b.transaction_id (when both present)
@@ -1,4 +1,4 @@
1
- import { c as AstraSyncCredentials, m as ProtocolTransport, G as GatewayConfig } from './types-sMxBT-nM.js';
1
+ import { c as AstraSyncCredentials, m as ProtocolTransport, G as GatewayConfig } from './types-DwSfO7Sb.js';
2
2
 
3
3
  /**
4
4
  * AgentClient — Credential Presentation
@@ -1,4 +1,4 @@
1
- import { c as AstraSyncCredentials, m as ProtocolTransport } from './types-r850cOt0.mjs';
1
+ import { c as AstraSyncCredentials, m as ProtocolTransport } from './types-C0zfSXMB.mjs';
2
2
  import { JWK } from 'jose';
3
3
 
4
4
  /**
@@ -628,7 +628,7 @@ declare const claim: {
628
628
  * - payment_mandate — authorizes the actual payment rail
629
629
  *
630
630
  * Mandates are cross-referenced via ids; each is an SD-JWT over ES256 (or
631
- * equivalent). We decode via @sd-jwt/decode and extract the AP2-specific
631
+ * equivalent). We decode via @sd-jwt/core and extract the AP2-specific
632
632
  * shape — verification lives in ap2-verify.ts.
633
633
  */
634
634
 
@@ -1024,7 +1024,7 @@ declare function extractX402Context(message: {
1024
1024
  * AstraSync-specific composition logic — that's the whitespace here.
1025
1025
  *
1026
1026
  * This module does NOT re-verify selective-disclosure hashes (the extractor
1027
- * already applied them via @sd-jwt/decode). It DOES verify:
1027
+ * already applied them via @sd-jwt/core). It DOES verify:
1028
1028
  * - cnf.jwk in L1 payload points to L2's signing key (thumbprint match)
1029
1029
  * - cnf.jwk in L2 payload points to L3's signing key
1030
1030
  * - L3a.transaction_id === L3b.transaction_id (when both present)
@@ -1,4 +1,4 @@
1
- import { c as AstraSyncCredentials, m as ProtocolTransport, G as GatewayConfig } from './types-r850cOt0.mjs';
1
+ import { c as AstraSyncCredentials, m as ProtocolTransport, G as GatewayConfig } from './types-C0zfSXMB.mjs';
2
2
 
3
3
  /**
4
4
  * AgentClient — Credential Presentation
package/dist/index.d.mts CHANGED
@@ -1,13 +1,13 @@
1
- import { G as GatewayConfig, s as StepUpApprovalInfo, u as StepUpOutcome, t as StepUpApprovalStatus, E as EnhancedVerificationResult, A as AccessFailure } from './types-r850cOt0.mjs';
2
- export { a as AccessLevel, b as AgentCredentials, c as AstraSyncCredentials, d as AttemptOutcome, e as AttemptReport, C as CallerMetadata, f as CommerceArtifactsPayload, g as CommerceShieldProps, h as ConsiderationItem, i as ConsiderationSet, j as CounterpartyType, k as ExpressMiddlewareOptions, F as FiatSettlementBinding, l as GuidanceInfo, N as NextJsMiddlewareOptions, P as PDLSSInfo, m as ProtocolTransport, R as RouteAccessConfig, n as RuntimeChallengeResult, S as SDKOptions, o as SettlementArtifact, p as SettlementArtifactBinding, q as SettlementArtifactBindingBase, r as StablecoinSettlementBinding, T as TokenGuidance, v as TrustLevel, V as VerificationInterstitialProps, w as VerificationRequest, x as VerificationResult, y as VerifiedAgent, z as VerifiedDeveloper, B as VerifiedOrganization } from './types-r850cOt0.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-CbTNIkAa.mjs';
1
+ import { G as GatewayConfig, s as StepUpApprovalInfo, u as StepUpOutcome, t as StepUpApprovalStatus, E as EnhancedVerificationResult, A as AccessFailure } from './types-C0zfSXMB.mjs';
2
+ export { a as AccessLevel, b as AgentCredentials, c as AstraSyncCredentials, d as AttemptOutcome, e as AttemptReport, C as CallerMetadata, f as CommerceArtifactsPayload, g as CommerceShieldProps, h as ConsiderationItem, i as ConsiderationSet, j as CounterpartyType, k as ExpressMiddlewareOptions, F as FiatSettlementBinding, l as GuidanceInfo, N as NextJsMiddlewareOptions, P as PDLSSInfo, m as ProtocolTransport, R as RouteAccessConfig, n as RuntimeChallengeResult, S as SDKOptions, o as SettlementArtifact, p as SettlementArtifactBinding, q as SettlementArtifactBindingBase, r as StablecoinSettlementBinding, T as TokenGuidance, v as TrustLevel, V as VerificationInterstitialProps, w as VerificationRequest, x as VerificationResult, y as VerifiedAgent, z as VerifiedDeveloper, B as VerifiedOrganization } from './types-C0zfSXMB.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-Bbh9B_dw.mjs';
4
4
  export { VerifyOptions, clearCache, extractCredentials, fetchRoutes, hasCredentials, quickVerify, reportAttempt, reportUnregisteredAttempt, verify } from './verify.mjs';
5
- export { e as express } from './express-D_4hTn5Z.mjs';
6
- export { n as nextjs } from './nextjs-WyeVr2Kp.mjs';
7
- export { aR as extractMcpCredentials, bg as setMcpMeta, b1 as transport } from './index-BPEBlOsE.mjs';
5
+ export { e as express } from './express-CR6F3njD.mjs';
6
+ export { n as nextjs } from './nextjs-DlX6xwbU.mjs';
7
+ export { aR as extractMcpCredentials, bg as setMcpMeta, b1 as transport } from './index-Cub7lK-T.mjs';
8
8
  export { McpMiddlewareOptions, ToolGateConfig, createMcpMiddleware } from './adapters/mcp.mjs';
9
9
  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';
10
- export { A as AgentClient, C as ChallengeHandler, i as agent, r as recordDecision } from './index-DQb5-_1X.mjs';
10
+ export { A as AgentClient, C as ChallengeHandler, i as agent, r as recordDecision } from './index-CwAh7Tln.mjs';
11
11
  export { DEFAULT_EDGE_CONFIG, EdgeConfig, EdgeMode, EdgePathRule, EdgeVerificationDepth, FetchEdgeConfigResult, FetchEdgeConfigSuccess, _resetEdgeConfigCache, degradeToObserve, fetchEdgeConfig, getEdgeConfig, isEdgeConfig, matchEdgePathRule } from './edge-config.mjs';
12
12
  export { DynamicPlatformFingerprint, PLATFORM_AGENT_SIGNATURES, PlatformAgentVendor, PlatformDetectionInput, PlatformFingerprint, PlatformSignatureDef, detectPlatformFingerprint, matchPlatformSignature } from './platform-signatures.mjs';
13
13
  export { CAPTURE_SCHEMA_VERSION, MAX_HEADERS, MAX_HEADER_VALUE_BYTES, MAX_TOTAL_BYTES, ObservedMetadata, SanitizeHeadersResult, buildSdkObservedMetadata, deriveConnectionFromHeaders, extractApiKeyFormat, extractPlatformHeaders, sanitizeHeaders } from './metadata-capture.mjs';
package/dist/index.d.ts CHANGED
@@ -1,13 +1,13 @@
1
- import { G as GatewayConfig, s as StepUpApprovalInfo, u as StepUpOutcome, t as StepUpApprovalStatus, E as EnhancedVerificationResult, A as AccessFailure } from './types-sMxBT-nM.js';
2
- export { a as AccessLevel, b as AgentCredentials, c as AstraSyncCredentials, d as AttemptOutcome, e as AttemptReport, C as CallerMetadata, f as CommerceArtifactsPayload, g as CommerceShieldProps, h as ConsiderationItem, i as ConsiderationSet, j as CounterpartyType, k as ExpressMiddlewareOptions, F as FiatSettlementBinding, l as GuidanceInfo, N as NextJsMiddlewareOptions, P as PDLSSInfo, m as ProtocolTransport, R as RouteAccessConfig, n as RuntimeChallengeResult, S as SDKOptions, o as SettlementArtifact, p as SettlementArtifactBinding, q as SettlementArtifactBindingBase, r as StablecoinSettlementBinding, T as TokenGuidance, v as TrustLevel, V as VerificationInterstitialProps, w as VerificationRequest, x as VerificationResult, y as VerifiedAgent, z as VerifiedDeveloper, B as VerifiedOrganization } from './types-sMxBT-nM.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-QeX0Z8Ho.js';
1
+ import { G as GatewayConfig, s as StepUpApprovalInfo, u as StepUpOutcome, t as StepUpApprovalStatus, E as EnhancedVerificationResult, A as AccessFailure } from './types-DwSfO7Sb.js';
2
+ export { a as AccessLevel, b as AgentCredentials, c as AstraSyncCredentials, d as AttemptOutcome, e as AttemptReport, C as CallerMetadata, f as CommerceArtifactsPayload, g as CommerceShieldProps, h as ConsiderationItem, i as ConsiderationSet, j as CounterpartyType, k as ExpressMiddlewareOptions, F as FiatSettlementBinding, l as GuidanceInfo, N as NextJsMiddlewareOptions, P as PDLSSInfo, m as ProtocolTransport, R as RouteAccessConfig, n as RuntimeChallengeResult, S as SDKOptions, o as SettlementArtifact, p as SettlementArtifactBinding, q as SettlementArtifactBindingBase, r as StablecoinSettlementBinding, T as TokenGuidance, v as TrustLevel, V as VerificationInterstitialProps, w as VerificationRequest, x as VerificationResult, y as VerifiedAgent, z as VerifiedDeveloper, B as VerifiedOrganization } from './types-DwSfO7Sb.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-C6SASmsh.js';
4
4
  export { VerifyOptions, clearCache, extractCredentials, fetchRoutes, hasCredentials, quickVerify, reportAttempt, reportUnregisteredAttempt, verify } from './verify.js';
5
- export { e as express } from './express-BVd1_3FE.js';
6
- export { n as nextjs } from './nextjs-w7RTbP1P.js';
7
- export { aR as extractMcpCredentials, bg as setMcpMeta, b1 as transport } from './index-B0YHu_SP.js';
5
+ export { e as express } from './express-DaqL11tx.js';
6
+ export { n as nextjs } from './nextjs-DL6uE1ye.js';
7
+ export { aR as extractMcpCredentials, bg as setMcpMeta, b1 as transport } from './index-B5Ts1WtM.js';
8
8
  export { McpMiddlewareOptions, ToolGateConfig, createMcpMiddleware } from './adapters/mcp.js';
9
9
  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';
10
- export { A as AgentClient, C as ChallengeHandler, i as agent, r as recordDecision } from './index-T1aBoUcc.js';
10
+ export { A as AgentClient, C as ChallengeHandler, i as agent, r as recordDecision } from './index-BfIxCYIZ.js';
11
11
  export { DEFAULT_EDGE_CONFIG, EdgeConfig, EdgeMode, EdgePathRule, EdgeVerificationDepth, FetchEdgeConfigResult, FetchEdgeConfigSuccess, _resetEdgeConfigCache, degradeToObserve, fetchEdgeConfig, getEdgeConfig, isEdgeConfig, matchEdgePathRule } from './edge-config.js';
12
12
  export { DynamicPlatformFingerprint, PLATFORM_AGENT_SIGNATURES, PlatformAgentVendor, PlatformDetectionInput, PlatformFingerprint, PlatformSignatureDef, detectPlatformFingerprint, matchPlatformSignature } from './platform-signatures.js';
13
13
  export { CAPTURE_SCHEMA_VERSION, MAX_HEADERS, MAX_HEADER_VALUE_BYTES, MAX_TOTAL_BYTES, ObservedMetadata, SanitizeHeadersResult, buildSdkObservedMetadata, deriveConnectionFromHeaders, extractApiKeyFormat, extractPlatformHeaders, sanitizeHeaders } from './metadata-capture.js';
package/dist/index.js CHANGED
@@ -1087,6 +1087,34 @@ function extractHttpCredentials(headers) {
1087
1087
  return credentials;
1088
1088
  }
1089
1089
 
1090
+ // src/verified-hop.ts
1091
+ var MCP_VERIFIED_HOP_HEADER = "X-Astra-Verified-Hop";
1092
+ var MCP_VERIFIED_HOP_MAX_AGE_MS = 6e4;
1093
+ function serializeVerifiedHop(marker) {
1094
+ return `${marker.astraId};${marker.sessionId ?? ""};${marker.checkedAt}`;
1095
+ }
1096
+ function parseVerifiedHop(value) {
1097
+ if (!value) return null;
1098
+ const parts = value.split(";");
1099
+ if (parts.length !== 3) return null;
1100
+ const [astraId, sessionId, checkedAtRaw] = parts;
1101
+ if (!astraId) return null;
1102
+ const checkedAt = Number(checkedAtRaw);
1103
+ if (!Number.isFinite(checkedAt) || checkedAt <= 0) return null;
1104
+ return {
1105
+ astraId,
1106
+ ...sessionId ? { sessionId } : {},
1107
+ checkedAt
1108
+ };
1109
+ }
1110
+ function isVerifiedHopValidFor(marker, expectedAstraId, opts = {}) {
1111
+ if (!marker) return false;
1112
+ if (marker.astraId !== expectedAstraId) return false;
1113
+ const maxAge = opts.maxAgeMs ?? MCP_VERIFIED_HOP_MAX_AGE_MS;
1114
+ const now = opts.now ?? Date.now();
1115
+ return now - marker.checkedAt <= maxAge && now >= marker.checkedAt;
1116
+ }
1117
+
1090
1118
  // src/adapters/http-pdlss.ts
1091
1119
  var HTTP_METHOD_ACTION_TABLE = {
1092
1120
  GET: "data.read",
@@ -1224,7 +1252,9 @@ var SECRET_HEADER_NAMES = /* @__PURE__ */ new Set([
1224
1252
  "x-astrasync-signature",
1225
1253
  "x-astrasync-secret",
1226
1254
  "x-hub-signature",
1227
- "x-hub-signature-256"
1255
+ "x-hub-signature-256",
1256
+ // Short-lived verify dedupe token — must never persist in stored metadata.
1257
+ "x-astra-verified-hop"
1228
1258
  ]);
1229
1259
  var SECRET_HEADER_PREFIXES = ["x-astrasync-", "kya-", "kya_"];
1230
1260
  var CREDENTIAL_HEADER_NAMES = /* @__PURE__ */ new Set([
@@ -1367,16 +1397,25 @@ var CONNECTION_HEADER_SOURCES = [
1367
1397
  ["cf-ipcountry", "x-vercel-ip-country", "cloudfront-viewer-country", "fastly-geo-country"]
1368
1398
  ],
1369
1399
  ["region", ["x-vercel-ip-country-region", "cloudfront-viewer-country-region"]],
1400
+ ["countryRegionName", ["cloudfront-viewer-country-region-name"]],
1370
1401
  ["city", ["x-vercel-ip-city", "cloudfront-viewer-city"]],
1371
1402
  ["asn", ["cloudfront-viewer-asn"]],
1372
1403
  ["tlsVersion", ["cloudfront-viewer-tls"]],
1373
1404
  ["httpVersion", ["cloudfront-viewer-http-version"]],
1405
+ ["timeZone", ["x-vercel-ip-timezone", "cloudfront-viewer-time-zone"]],
1406
+ ["metroCode", ["cloudfront-viewer-metro-code"]],
1374
1407
  // TLS fingerprints can only be computed where TLS terminates. When a CDN
1375
1408
  // terminates TLS in front of the merchant, its fingerprint headers ARE the
1376
1409
  // connection-layer truth — normalising them here is the permanent design.
1377
- ["tlsFingerprint", ["cf-ja3-hash"]],
1378
- ["ja4", ["cf-ja4"]]
1410
+ // CloudFront delivers JA3/JA4 only via an origin request policy and only
1411
+ // for HTTPS viewer connections.
1412
+ ["tlsFingerprint", ["cf-ja3-hash", "cloudfront-viewer-ja3-fingerprint"]],
1413
+ ["ja4", ["cf-ja4", "cloudfront-viewer-ja4-fingerprint"]],
1414
+ // Header-structure fingerprint: browser/SDK-distinctive header ordering.
1415
+ ["headerOrder", ["cloudfront-viewer-header-order"]],
1416
+ ["headerCount", ["cloudfront-viewer-header-count"]]
1379
1417
  ];
1418
+ var MAX_CONNECTION_VALUE_CHARS = 256;
1380
1419
  function deriveConnectionFromHeaders(headers) {
1381
1420
  if (!headers) return void 0;
1382
1421
  const lower = {};
@@ -1389,11 +1428,15 @@ function deriveConnectionFromHeaders(headers) {
1389
1428
  for (const source of sources) {
1390
1429
  const value = lower[source]?.trim();
1391
1430
  if (value) {
1392
- connection[key] = value;
1431
+ connection[key] = value.slice(0, MAX_CONNECTION_VALUE_CHARS);
1393
1432
  break;
1394
1433
  }
1395
1434
  }
1396
1435
  }
1436
+ if (!connection.ip) {
1437
+ const addr = lower["cloudfront-viewer-address"]?.trim();
1438
+ if (addr) connection.ip = addr.replace(/:\d+$/, "");
1439
+ }
1397
1440
  if (!connection.ip) {
1398
1441
  const xff = lower["x-forwarded-for"];
1399
1442
  const client = xff?.split(",")[0]?.trim();
@@ -1848,6 +1891,8 @@ function createMiddleware(options) {
1848
1891
  failOnError = "open",
1849
1892
  caseInsensitiveRouteMatch = false,
1850
1893
  anonymousBeacon = true,
1894
+ trustVerifiedHop = false,
1895
+ verifiedHopMaxAgeMs,
1851
1896
  ...config
1852
1897
  } = options;
1853
1898
  if (config.apiBaseUrl) {
@@ -1940,6 +1985,16 @@ function createMiddleware(options) {
1940
1985
  beaconPassThrough?.(req);
1941
1986
  return next();
1942
1987
  }
1988
+ if (trustVerifiedHop && credentials.astraId) {
1989
+ const hopRaw = req.headers[MCP_VERIFIED_HOP_HEADER.toLowerCase()];
1990
+ const hopValue = typeof hopRaw === "string" ? hopRaw : Array.isArray(hopRaw) ? hopRaw[0] : void 0;
1991
+ const marker = parseVerifiedHop(hopValue);
1992
+ if (isVerifiedHopValidFor(marker, credentials.astraId, {
1993
+ ...verifiedHopMaxAgeMs !== void 0 ? { maxAgeMs: verifiedHopMaxAgeMs } : {}
1994
+ })) {
1995
+ return next();
1996
+ }
1997
+ }
1943
1998
  const pdlssPair = resolveRequestPdlss(
1944
1999
  req,
1945
2000
  routeConfig,
@@ -2395,6 +2450,8 @@ function createMiddleware2(options) {
2395
2450
  enableRuntimeChallenge = true,
2396
2451
  routesRefreshMs = DEFAULT_ROUTES_REFRESH_MS2,
2397
2452
  anonymousBeacon = true,
2453
+ trustVerifiedHop = false,
2454
+ verifiedHopMaxAgeMs,
2398
2455
  ...config
2399
2456
  } = options;
2400
2457
  const interstitialEnabled = showInterstitial ?? showCommerceShield ?? true;
@@ -2457,6 +2514,14 @@ function createMiddleware2(options) {
2457
2514
  return NextResponse.next();
2458
2515
  }
2459
2516
  const credentials = extractCredentialsFromNextRequest(request);
2517
+ if (trustVerifiedHop && credentials.astraId) {
2518
+ const marker = parseVerifiedHop(request.headers.get(MCP_VERIFIED_HOP_HEADER) ?? void 0);
2519
+ if (isVerifiedHopValidFor(marker, credentials.astraId, {
2520
+ ...verifiedHopMaxAgeMs !== void 0 ? { maxAgeMs: verifiedHopMaxAgeMs } : {}
2521
+ })) {
2522
+ return NextResponse.next();
2523
+ }
2524
+ }
2460
2525
  const counterpartyUrl = config.counterpartyUrl || request.nextUrl.origin;
2461
2526
  const pdlssPair = resolveNextPdlss(request, routeConfig);
2462
2527
  const purpose = pdlssPair.purpose;
@@ -3564,13 +3629,13 @@ function coerceString3(v) {
3564
3629
  }
3565
3630
 
3566
3631
  // src/transport/vi.ts
3567
- var import_decode = require("@sd-jwt/decode");
3632
+ var import_core = require("@sd-jwt/core");
3568
3633
  var import_node_crypto = require("crypto");
3569
3634
  function extractVIClaims(sdJwtCompact) {
3570
3635
  if (!sdJwtCompact || typeof sdJwtCompact !== "string") return null;
3571
3636
  let decoded;
3572
3637
  try {
3573
- decoded = (0, import_decode.decodeSdJwtSync)(sdJwtCompact, sha256Sync);
3638
+ decoded = (0, import_core.decodeSdJwtSync)(sdJwtCompact, sha256Sync);
3574
3639
  } catch {
3575
3640
  return null;
3576
3641
  }
@@ -3610,7 +3675,7 @@ function extractVIClaims(sdJwtCompact) {
3610
3675
  }
3611
3676
  function safeSplit(compact) {
3612
3677
  try {
3613
- const { jwt, kbJwt } = (0, import_decode.splitSdJwt)(compact);
3678
+ const { jwt, kbJwt } = (0, import_core.splitSdJwt)(compact);
3614
3679
  return { l3: jwt, l2: kbJwt };
3615
3680
  } catch {
3616
3681
  return {};
@@ -3957,13 +4022,13 @@ var claim = {
3957
4022
  };
3958
4023
 
3959
4024
  // src/transport/ap2.ts
3960
- var import_decode2 = require("@sd-jwt/decode");
4025
+ var import_core2 = require("@sd-jwt/core");
3961
4026
  var import_node_crypto3 = require("crypto");
3962
4027
  function extractAP2Mandate(sdJwtCompact) {
3963
4028
  if (!sdJwtCompact || typeof sdJwtCompact !== "string") return null;
3964
4029
  let decoded;
3965
4030
  try {
3966
- decoded = (0, import_decode2.decodeSdJwtSync)(sdJwtCompact, sha256Sync2);
4031
+ decoded = (0, import_core2.decodeSdJwtSync)(sdJwtCompact, sha256Sync2);
3967
4032
  } catch {
3968
4033
  return null;
3969
4034
  }
@@ -5345,32 +5410,6 @@ function extractCredentialsFromProtocol(protocol, context) {
5345
5410
  }
5346
5411
 
5347
5412
  // src/transport/mcp-server.ts
5348
- var MCP_VERIFIED_HOP_HEADER = "X-Astra-Verified-Hop";
5349
- var MCP_VERIFIED_HOP_MAX_AGE_MS = 6e4;
5350
- function serializeVerifiedHop(marker) {
5351
- return `${marker.astraId};${marker.sessionId ?? ""};${marker.checkedAt}`;
5352
- }
5353
- function parseVerifiedHop(value) {
5354
- if (!value) return null;
5355
- const parts = value.split(";");
5356
- if (parts.length !== 3) return null;
5357
- const [astraId, sessionId, checkedAtRaw] = parts;
5358
- if (!astraId) return null;
5359
- const checkedAt = Number(checkedAtRaw);
5360
- if (!Number.isFinite(checkedAt) || checkedAt <= 0) return null;
5361
- return {
5362
- astraId,
5363
- ...sessionId ? { sessionId } : {},
5364
- checkedAt
5365
- };
5366
- }
5367
- function isVerifiedHopValidFor(marker, expectedAstraId, opts = {}) {
5368
- if (!marker) return false;
5369
- if (marker.astraId !== expectedAstraId) return false;
5370
- const maxAge = opts.maxAgeMs ?? MCP_VERIFIED_HOP_MAX_AGE_MS;
5371
- const now = opts.now ?? Date.now();
5372
- return now - marker.checkedAt <= maxAge && now >= marker.checkedAt;
5373
- }
5374
5413
  function parseMcpJsonRpc(body) {
5375
5414
  if (!body || typeof body !== "object" || Array.isArray(body)) return null;
5376
5415
  const obj = body;