@astrasyncai/verification-gateway 3.8.0 → 3.10.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/adapter-interface/interface.d.mts +3 -2
- package/dist/adapter-interface/interface.d.ts +3 -2
- package/dist/adapters/express.d.mts +3 -2
- package/dist/adapters/express.d.ts +3 -2
- package/dist/adapters/express.js +152 -2
- package/dist/adapters/express.js.map +1 -1
- package/dist/adapters/express.mjs +152 -2
- package/dist/adapters/express.mjs.map +1 -1
- package/dist/adapters/http-pdlss.d.mts +81 -0
- package/dist/adapters/http-pdlss.d.ts +81 -0
- package/dist/adapters/http-pdlss.js +117 -0
- package/dist/adapters/http-pdlss.js.map +1 -0
- package/dist/adapters/http-pdlss.mjs +87 -0
- package/dist/adapters/http-pdlss.mjs.map +1 -0
- package/dist/adapters/mcp.d.mts +2 -1
- package/dist/adapters/mcp.d.ts +2 -1
- package/dist/adapters/mcp.js +2 -1
- package/dist/adapters/mcp.js.map +1 -1
- package/dist/adapters/mcp.mjs +2 -1
- package/dist/adapters/mcp.mjs.map +1 -1
- package/dist/adapters/nextjs.d.mts +3 -2
- package/dist/adapters/nextjs.d.ts +3 -2
- package/dist/adapters/nextjs.js +152 -2
- package/dist/adapters/nextjs.js.map +1 -1
- package/dist/adapters/nextjs.mjs +152 -2
- package/dist/adapters/nextjs.mjs.map +1 -1
- package/dist/adapters/sdk.d.mts +3 -2
- package/dist/adapters/sdk.d.ts +3 -2
- package/dist/adapters/sdk.js +2 -1
- package/dist/adapters/sdk.js.map +1 -1
- package/dist/adapters/sdk.mjs +2 -1
- package/dist/adapters/sdk.mjs.map +1 -1
- package/dist/agent/index.d.mts +3 -2
- package/dist/agent/index.d.ts +3 -2
- package/dist/bin/astrasync-claude-hook.js +17 -1
- package/dist/bin/astrasync-guard.js +17 -1
- package/dist/bin/astrasync.js +43 -1
- package/dist/browser/background.js +17 -1
- package/dist/browser/background.js.map +1 -1
- package/dist/browser/background.mjs +17 -1
- package/dist/browser/background.mjs.map +1 -1
- package/dist/browser/browser-adapter.d.mts +3 -2
- package/dist/browser/browser-adapter.d.ts +3 -2
- package/dist/claude-code/claude-code-adapter.d.mts +3 -2
- package/dist/claude-code/claude-code-adapter.d.ts +3 -2
- package/dist/cli/index.d.mts +3 -2
- package/dist/cli/index.d.ts +3 -2
- package/dist/cursor/cursor-adapter.d.mts +3 -2
- package/dist/cursor/cursor-adapter.d.ts +3 -2
- package/dist/cursor/extension.d.mts +3 -2
- package/dist/cursor/extension.d.ts +3 -2
- package/dist/cursor/extension.js +17 -1
- package/dist/cursor/extension.js.map +1 -1
- package/dist/cursor/extension.mjs +17 -1
- package/dist/cursor/extension.mjs.map +1 -1
- package/dist/edge-config.d.mts +131 -0
- package/dist/edge-config.d.ts +131 -0
- package/dist/edge-config.js +162 -0
- package/dist/edge-config.js.map +1 -0
- package/dist/edge-config.mjs +131 -0
- package/dist/edge-config.mjs.map +1 -0
- package/dist/{express-C8nJGi5P.d.ts → express-ClNtDhhc.d.ts} +1 -1
- package/dist/{express-Di_hnZZS.d.mts → express-DCXa1oqj.d.mts} +1 -1
- package/dist/gateway/gateway.d.mts +3 -2
- package/dist/gateway/gateway.d.ts +3 -2
- package/dist/gateway/gateway.js +17 -1
- package/dist/gateway/gateway.js.map +1 -1
- package/dist/gateway/gateway.mjs +17 -1
- package/dist/gateway/gateway.mjs.map +1 -1
- package/dist/git-trigger/git-hooks.d.mts +3 -2
- package/dist/git-trigger/git-hooks.d.ts +3 -2
- package/dist/{index-CXcvO9Au.d.mts → index-BrNKDmiR.d.mts} +1 -1
- package/dist/{index-CuCkjT7B.d.ts → index-CfHurO1P.d.ts} +1 -1
- package/dist/{index-CBQr4FGs.d.ts → index-D2ztkumS.d.ts} +1 -1
- package/dist/{index-DALAqct7.d.mts → index-Dr_XiN65.d.mts} +1 -1
- package/dist/index.d.mts +27 -82
- package/dist/index.d.ts +27 -82
- package/dist/index.js +435 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +417 -12
- package/dist/index.mjs.map +1 -1
- package/dist/local-evaluator/evaluator.d.mts +3 -2
- package/dist/local-evaluator/evaluator.d.ts +3 -2
- package/dist/metadata-capture.d.mts +87 -0
- package/dist/metadata-capture.d.ts +87 -0
- package/dist/metadata-capture.js +184 -0
- package/dist/metadata-capture.js.map +1 -0
- package/dist/metadata-capture.mjs +154 -0
- package/dist/metadata-capture.mjs.map +1 -0
- package/dist/{nextjs-IyXWW2KL.d.ts → nextjs-CEBVBsdi.d.ts} +1 -1
- package/dist/{nextjs-BMAe8ode.d.mts → nextjs-DcQIk6Zj.d.mts} +1 -1
- package/dist/platform-signatures.d.mts +97 -0
- package/dist/platform-signatures.d.ts +97 -0
- package/dist/platform-signatures.js +116 -0
- package/dist/platform-signatures.js.map +1 -0
- package/dist/platform-signatures.mjs +89 -0
- package/dist/platform-signatures.mjs.map +1 -0
- package/dist/{sdk-Cn4KcZ5G.d.mts → sdk-CZkbSOeO.d.mts} +1 -1
- package/dist/{sdk-ThdA_NtL.d.ts → sdk-H0JCLW2y.d.ts} +1 -1
- package/dist/transport/index.d.mts +3 -2
- package/dist/transport/index.d.ts +3 -2
- package/dist/{types-DedAJbNI.d.mts → types-9tns4wyl.d.ts} +88 -1
- package/dist/{types-CSFci5zD.d.mts → types-D0lCtFQ7.d.mts} +1 -1
- package/dist/{types-D1kyMiml.d.ts → types-YbiXYKx1.d.ts} +1 -1
- package/dist/{types-DedAJbNI.d.ts → types-sy3tq8lp.d.mts} +88 -1
- package/dist/ui/index.d.mts +2 -1
- package/dist/ui/index.d.ts +2 -1
- package/dist/verify.d.mts +151 -0
- package/dist/verify.d.ts +151 -0
- package/dist/verify.js +593 -0
- package/dist/verify.js.map +1 -0
- package/dist/verify.mjs +557 -0
- package/dist/verify.mjs.map +1 -0
- package/package.json +26 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AstraSyncGateway } from '../gateway/gateway.mjs';
|
|
2
|
-
import { V as VerificationDecision, P as PDLSSContext } from '../types-
|
|
3
|
-
import '../types-
|
|
2
|
+
import { V as VerificationDecision, P as PDLSSContext } from '../types-D0lCtFQ7.mjs';
|
|
3
|
+
import '../types-sy3tq8lp.mjs';
|
|
4
|
+
import '../metadata-capture.mjs';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Git Trigger — Enterprise git push / PR verification
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AstraSyncGateway } from '../gateway/gateway.js';
|
|
2
|
-
import { V as VerificationDecision, P as PDLSSContext } from '../types-
|
|
3
|
-
import '../types-
|
|
2
|
+
import { V as VerificationDecision, P as PDLSSContext } from '../types-YbiXYKx1.js';
|
|
3
|
+
import '../types-9tns4wyl.js';
|
|
4
|
+
import '../metadata-capture.js';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Git Trigger — Enterprise git push / PR verification
|
package/dist/index.d.mts
CHANGED
|
@@ -1,68 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { c as AstraSyncCredentials, C as
|
|
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-
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
1
|
+
import { G as GatewayConfig, n as StepUpApprovalInfo, p as StepUpOutcome, o as StepUpApprovalStatus, E as EnhancedVerificationResult, A as AccessFailure } from './types-sy3tq8lp.mjs';
|
|
2
|
+
export { a as AccessLevel, b as AgentCredentials, c as AstraSyncCredentials, C as CommerceArtifactsPayload, d as CommerceShieldProps, e as CounterpartyType, f as ExpressMiddlewareOptions, F as FiatSettlementBinding, g as GuidanceInfo, N as NextJsMiddlewareOptions, P as PDLSSInfo, h as ProtocolTransport, R as RouteAccessConfig, i as RuntimeChallengeResult, S as SDKOptions, j as SettlementArtifact, k as SettlementArtifactBinding, l as SettlementArtifactBindingBase, m as StablecoinSettlementBinding, T as TokenGuidance, q as TrustLevel, V as VerificationRequest, r as VerificationResult, s as VerifiedAgent, t as VerifiedDeveloper, u as VerifiedOrganization } from './types-sy3tq8lp.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-CZkbSOeO.mjs';
|
|
4
|
+
export { VerifyOptions, clearCache, extractCredentials, fetchRoutes, hasCredentials, quickVerify, reportUnregisteredAttempt, verify } from './verify.mjs';
|
|
5
|
+
export { e as express } from './express-DCXa1oqj.mjs';
|
|
6
|
+
export { n as nextjs } from './nextjs-DcQIk6Zj.mjs';
|
|
7
|
+
export { aR as extractMcpCredentials, bg as setMcpMeta, b1 as transport } from './index-BrNKDmiR.mjs';
|
|
7
8
|
export { McpMiddlewareOptions, ToolGateConfig, createMcpMiddleware } from './adapters/mcp.mjs';
|
|
8
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';
|
|
9
|
-
export { A as AgentClient, C as ChallengeHandler, i as agent, r as recordDecision } from './index-
|
|
10
|
+
export { A as AgentClient, C as ChallengeHandler, i as agent, r as recordDecision } from './index-Dr_XiN65.mjs';
|
|
11
|
+
export { DEFAULT_EDGE_CONFIG, EdgeConfig, EdgeMode, EdgePathRule, EdgeVerificationDepth, FetchEdgeConfigResult, FetchEdgeConfigSuccess, _resetEdgeConfigCache, degradeToObserve, fetchEdgeConfig, getEdgeConfig, isEdgeConfig, matchEdgePathRule } from './edge-config.mjs';
|
|
12
|
+
export { DynamicPlatformFingerprint, PLATFORM_AGENT_SIGNATURES, PlatformAgentVendor, PlatformDetectionInput, PlatformFingerprint, PlatformSignatureDef, detectPlatformFingerprint, matchPlatformSignature } from './platform-signatures.mjs';
|
|
13
|
+
export { MAX_HEADERS, MAX_HEADER_VALUE_BYTES, MAX_TOTAL_BYTES, ObservedMetadata, SanitizeHeadersResult, extractApiKeyFormat, extractPlatformHeaders, sanitizeHeaders } from './metadata-capture.mjs';
|
|
10
14
|
import 'express';
|
|
11
15
|
import 'next/server';
|
|
12
16
|
import 'jose';
|
|
13
17
|
|
|
14
|
-
/**
|
|
15
|
-
* AstraSync Universal Verification Gateway - Core Verification Logic
|
|
16
|
-
*
|
|
17
|
-
* This module handles the core verification logic, calling the AstraSync API
|
|
18
|
-
* and processing the response into a standardized VerificationResult.
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Clear the verification cache
|
|
23
|
-
*/
|
|
24
|
-
declare function clearCache(): void;
|
|
25
|
-
/**
|
|
26
|
-
* Extract agent credentials from various sources
|
|
27
|
-
*/
|
|
28
|
-
declare function extractCredentials(headers: Record<string, string | string[] | undefined>, query?: Record<string, string | undefined>): AgentCredentials;
|
|
29
|
-
/**
|
|
30
|
-
* Check if credentials are present
|
|
31
|
-
*/
|
|
32
|
-
declare function hasCredentials(credentials: AgentCredentials): boolean;
|
|
33
|
-
/**
|
|
34
|
-
* Options for a single verify() call (as opposed to GatewayConfig, which is
|
|
35
|
-
* per-gateway). Mirrors the Java SDK's `verify(request, bypassCache)`.
|
|
36
|
-
*/
|
|
37
|
-
interface VerifyOptions {
|
|
38
|
-
/**
|
|
39
|
-
* Skip the cache READ for this call so the request is guaranteed to reach
|
|
40
|
-
* the backend (the result is still written to the cache if cacheable).
|
|
41
|
-
* Used by the step-up hold-and-poll retry: the re-verify after an approval
|
|
42
|
-
* must hit the server to redeem the single-use approval.
|
|
43
|
-
*/
|
|
44
|
-
bypassCache?: boolean;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Main verification function
|
|
48
|
-
*/
|
|
49
|
-
declare function verify(config: GatewayConfig, request: VerificationRequest, options?: VerifyOptions): Promise<VerificationResult>;
|
|
50
|
-
/**
|
|
51
|
-
* Quick verification — checks credentials and policy in one call.
|
|
52
|
-
*
|
|
53
|
-
* Round-18 G4: return shape mirrors `VerificationResult`'s split — partners
|
|
54
|
-
* writing custom handlers around `quickVerify` get the same identity/policy
|
|
55
|
-
* distinction as those calling `verify()` directly. Map to HTTP status the
|
|
56
|
-
* same way: `!identityVerified` → 401; `identityVerified && !policyAllowed`
|
|
57
|
-
* → 403.
|
|
58
|
-
*/
|
|
59
|
-
declare function quickVerify(config: GatewayConfig, credentials: AgentCredentials): Promise<{
|
|
60
|
-
identityVerified: boolean;
|
|
61
|
-
policyAllowed: boolean;
|
|
62
|
-
accessLevel: AccessLevel;
|
|
63
|
-
reason?: string;
|
|
64
|
-
}>;
|
|
65
|
-
|
|
66
18
|
/**
|
|
67
19
|
* Step-up hold-and-poll (3.6.0) — the synchronous half of the MFA-style gate,
|
|
68
20
|
* mirroring the Java SDK's `awaitStepUpApproval` / `pollStepUpStatus`.
|
|
@@ -176,30 +128,23 @@ declare function getWellKnownUrls(apiBaseUrl: string): Promise<WellKnownAgenticC
|
|
|
176
128
|
declare function getCachedWellKnownUrls(apiBaseUrl: string): WellKnownAgenticCommerce | undefined;
|
|
177
129
|
|
|
178
130
|
/**
|
|
179
|
-
*
|
|
180
|
-
*
|
|
181
|
-
*
|
|
182
|
-
* One codebase, multiple deployment targets.
|
|
183
|
-
*
|
|
184
|
-
* @example
|
|
185
|
-
* ```typescript
|
|
186
|
-
* import { verify, extractCredentials } from '@astrasyncai/verification-gateway';
|
|
131
|
+
* Round-13 (F14 closure / R13-7): single source-of-truth for the SDK's
|
|
132
|
+
* package version emitted on verify-access bodies (and any future
|
|
133
|
+
* telemetry). Bumped alongside `package.json#version` on every release.
|
|
187
134
|
*
|
|
188
|
-
*
|
|
189
|
-
*
|
|
135
|
+
* Why a constant rather than `import pkg from '../package.json'`:
|
|
136
|
+
* - `tsconfig.json` sets `rootDir: ./src`; importing the sibling
|
|
137
|
+
* package.json fails the build with "outside rootDir".
|
|
138
|
+
* - Build-time string replacement (tsup `define`, esbuild banner, etc.)
|
|
139
|
+
* adds toolchain coupling for a trivial gain.
|
|
140
|
+
* - Embedded readonly constant works in every environment (Node, browser,
|
|
141
|
+
* bundlers, Deno) without runtime fs / network access.
|
|
190
142
|
*
|
|
191
|
-
*
|
|
192
|
-
*
|
|
193
|
-
*
|
|
194
|
-
*
|
|
195
|
-
* // Or map to HTTP status codes directly:
|
|
196
|
-
* if (!result.identityVerified) return res.status(401).json({ ... }); // re-auth
|
|
197
|
-
* if (!result.policyAllowed) return res.status(403).json({ ... }); // step up / update PDLSS
|
|
198
|
-
* ```
|
|
199
|
-
*
|
|
200
|
-
* @packageDocumentation
|
|
143
|
+
* Release discipline: a CI lint can grep `package.json#version` against
|
|
144
|
+
* this constant if the two ever diverge in the wild. Round-13 manual bump
|
|
145
|
+
* is fine — bumping both in the release-ceremony commit keeps them
|
|
146
|
+
* lockstep.
|
|
201
147
|
*/
|
|
148
|
+
declare const SDK_VERSION = "3.10.0";
|
|
202
149
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
export { AccessLevel, AgentCredentials, EnhancedVerificationResult, GatewayConfig, type SettlementDecision, type SettlementRequest, StepUpApprovalInfo, StepUpApprovalStatus, StepUpOutcome, VERSION, VerificationRequest, VerificationResult, type VerifyOptions, type WellKnownAgenticCommerce, authorizeSettlement, awaitStepUpApproval, clearCache, extractCredentials, getCachedWellKnownUrls, getWellKnownUrls, hasCredentials, pollStepUpStatus, prefetchWellKnown, quickVerify, verify };
|
|
150
|
+
export { EnhancedVerificationResult, GatewayConfig, type SettlementDecision, type SettlementRequest, StepUpApprovalInfo, StepUpApprovalStatus, StepUpOutcome, SDK_VERSION as VERSION, type WellKnownAgenticCommerce, authorizeSettlement, awaitStepUpApproval, getCachedWellKnownUrls, getWellKnownUrls, pollStepUpStatus, prefetchWellKnown };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,68 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { c as AstraSyncCredentials, C as
|
|
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-
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
1
|
+
import { G as GatewayConfig, n as StepUpApprovalInfo, p as StepUpOutcome, o as StepUpApprovalStatus, E as EnhancedVerificationResult, A as AccessFailure } from './types-9tns4wyl.js';
|
|
2
|
+
export { a as AccessLevel, b as AgentCredentials, c as AstraSyncCredentials, C as CommerceArtifactsPayload, d as CommerceShieldProps, e as CounterpartyType, f as ExpressMiddlewareOptions, F as FiatSettlementBinding, g as GuidanceInfo, N as NextJsMiddlewareOptions, P as PDLSSInfo, h as ProtocolTransport, R as RouteAccessConfig, i as RuntimeChallengeResult, S as SDKOptions, j as SettlementArtifact, k as SettlementArtifactBinding, l as SettlementArtifactBindingBase, m as StablecoinSettlementBinding, T as TokenGuidance, q as TrustLevel, V as VerificationRequest, r as VerificationResult, s as VerifiedAgent, t as VerifiedDeveloper, u as VerifiedOrganization } from './types-9tns4wyl.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-H0JCLW2y.js';
|
|
4
|
+
export { VerifyOptions, clearCache, extractCredentials, fetchRoutes, hasCredentials, quickVerify, reportUnregisteredAttempt, verify } from './verify.js';
|
|
5
|
+
export { e as express } from './express-ClNtDhhc.js';
|
|
6
|
+
export { n as nextjs } from './nextjs-CEBVBsdi.js';
|
|
7
|
+
export { aR as extractMcpCredentials, bg as setMcpMeta, b1 as transport } from './index-D2ztkumS.js';
|
|
7
8
|
export { McpMiddlewareOptions, ToolGateConfig, createMcpMiddleware } from './adapters/mcp.js';
|
|
8
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';
|
|
9
|
-
export { A as AgentClient, C as ChallengeHandler, i as agent, r as recordDecision } from './index-
|
|
10
|
+
export { A as AgentClient, C as ChallengeHandler, i as agent, r as recordDecision } from './index-CfHurO1P.js';
|
|
11
|
+
export { DEFAULT_EDGE_CONFIG, EdgeConfig, EdgeMode, EdgePathRule, EdgeVerificationDepth, FetchEdgeConfigResult, FetchEdgeConfigSuccess, _resetEdgeConfigCache, degradeToObserve, fetchEdgeConfig, getEdgeConfig, isEdgeConfig, matchEdgePathRule } from './edge-config.js';
|
|
12
|
+
export { DynamicPlatformFingerprint, PLATFORM_AGENT_SIGNATURES, PlatformAgentVendor, PlatformDetectionInput, PlatformFingerprint, PlatformSignatureDef, detectPlatformFingerprint, matchPlatformSignature } from './platform-signatures.js';
|
|
13
|
+
export { MAX_HEADERS, MAX_HEADER_VALUE_BYTES, MAX_TOTAL_BYTES, ObservedMetadata, SanitizeHeadersResult, extractApiKeyFormat, extractPlatformHeaders, sanitizeHeaders } from './metadata-capture.js';
|
|
10
14
|
import 'express';
|
|
11
15
|
import 'next/server';
|
|
12
16
|
import 'jose';
|
|
13
17
|
|
|
14
|
-
/**
|
|
15
|
-
* AstraSync Universal Verification Gateway - Core Verification Logic
|
|
16
|
-
*
|
|
17
|
-
* This module handles the core verification logic, calling the AstraSync API
|
|
18
|
-
* and processing the response into a standardized VerificationResult.
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Clear the verification cache
|
|
23
|
-
*/
|
|
24
|
-
declare function clearCache(): void;
|
|
25
|
-
/**
|
|
26
|
-
* Extract agent credentials from various sources
|
|
27
|
-
*/
|
|
28
|
-
declare function extractCredentials(headers: Record<string, string | string[] | undefined>, query?: Record<string, string | undefined>): AgentCredentials;
|
|
29
|
-
/**
|
|
30
|
-
* Check if credentials are present
|
|
31
|
-
*/
|
|
32
|
-
declare function hasCredentials(credentials: AgentCredentials): boolean;
|
|
33
|
-
/**
|
|
34
|
-
* Options for a single verify() call (as opposed to GatewayConfig, which is
|
|
35
|
-
* per-gateway). Mirrors the Java SDK's `verify(request, bypassCache)`.
|
|
36
|
-
*/
|
|
37
|
-
interface VerifyOptions {
|
|
38
|
-
/**
|
|
39
|
-
* Skip the cache READ for this call so the request is guaranteed to reach
|
|
40
|
-
* the backend (the result is still written to the cache if cacheable).
|
|
41
|
-
* Used by the step-up hold-and-poll retry: the re-verify after an approval
|
|
42
|
-
* must hit the server to redeem the single-use approval.
|
|
43
|
-
*/
|
|
44
|
-
bypassCache?: boolean;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Main verification function
|
|
48
|
-
*/
|
|
49
|
-
declare function verify(config: GatewayConfig, request: VerificationRequest, options?: VerifyOptions): Promise<VerificationResult>;
|
|
50
|
-
/**
|
|
51
|
-
* Quick verification — checks credentials and policy in one call.
|
|
52
|
-
*
|
|
53
|
-
* Round-18 G4: return shape mirrors `VerificationResult`'s split — partners
|
|
54
|
-
* writing custom handlers around `quickVerify` get the same identity/policy
|
|
55
|
-
* distinction as those calling `verify()` directly. Map to HTTP status the
|
|
56
|
-
* same way: `!identityVerified` → 401; `identityVerified && !policyAllowed`
|
|
57
|
-
* → 403.
|
|
58
|
-
*/
|
|
59
|
-
declare function quickVerify(config: GatewayConfig, credentials: AgentCredentials): Promise<{
|
|
60
|
-
identityVerified: boolean;
|
|
61
|
-
policyAllowed: boolean;
|
|
62
|
-
accessLevel: AccessLevel;
|
|
63
|
-
reason?: string;
|
|
64
|
-
}>;
|
|
65
|
-
|
|
66
18
|
/**
|
|
67
19
|
* Step-up hold-and-poll (3.6.0) — the synchronous half of the MFA-style gate,
|
|
68
20
|
* mirroring the Java SDK's `awaitStepUpApproval` / `pollStepUpStatus`.
|
|
@@ -176,30 +128,23 @@ declare function getWellKnownUrls(apiBaseUrl: string): Promise<WellKnownAgenticC
|
|
|
176
128
|
declare function getCachedWellKnownUrls(apiBaseUrl: string): WellKnownAgenticCommerce | undefined;
|
|
177
129
|
|
|
178
130
|
/**
|
|
179
|
-
*
|
|
180
|
-
*
|
|
181
|
-
*
|
|
182
|
-
* One codebase, multiple deployment targets.
|
|
183
|
-
*
|
|
184
|
-
* @example
|
|
185
|
-
* ```typescript
|
|
186
|
-
* import { verify, extractCredentials } from '@astrasyncai/verification-gateway';
|
|
131
|
+
* Round-13 (F14 closure / R13-7): single source-of-truth for the SDK's
|
|
132
|
+
* package version emitted on verify-access bodies (and any future
|
|
133
|
+
* telemetry). Bumped alongside `package.json#version` on every release.
|
|
187
134
|
*
|
|
188
|
-
*
|
|
189
|
-
*
|
|
135
|
+
* Why a constant rather than `import pkg from '../package.json'`:
|
|
136
|
+
* - `tsconfig.json` sets `rootDir: ./src`; importing the sibling
|
|
137
|
+
* package.json fails the build with "outside rootDir".
|
|
138
|
+
* - Build-time string replacement (tsup `define`, esbuild banner, etc.)
|
|
139
|
+
* adds toolchain coupling for a trivial gain.
|
|
140
|
+
* - Embedded readonly constant works in every environment (Node, browser,
|
|
141
|
+
* bundlers, Deno) without runtime fs / network access.
|
|
190
142
|
*
|
|
191
|
-
*
|
|
192
|
-
*
|
|
193
|
-
*
|
|
194
|
-
*
|
|
195
|
-
* // Or map to HTTP status codes directly:
|
|
196
|
-
* if (!result.identityVerified) return res.status(401).json({ ... }); // re-auth
|
|
197
|
-
* if (!result.policyAllowed) return res.status(403).json({ ... }); // step up / update PDLSS
|
|
198
|
-
* ```
|
|
199
|
-
*
|
|
200
|
-
* @packageDocumentation
|
|
143
|
+
* Release discipline: a CI lint can grep `package.json#version` against
|
|
144
|
+
* this constant if the two ever diverge in the wild. Round-13 manual bump
|
|
145
|
+
* is fine — bumping both in the release-ceremony commit keeps them
|
|
146
|
+
* lockstep.
|
|
201
147
|
*/
|
|
148
|
+
declare const SDK_VERSION = "3.10.0";
|
|
202
149
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
export { AccessLevel, AgentCredentials, EnhancedVerificationResult, GatewayConfig, type SettlementDecision, type SettlementRequest, StepUpApprovalInfo, StepUpApprovalStatus, StepUpOutcome, VERSION, VerificationRequest, VerificationResult, type VerifyOptions, type WellKnownAgenticCommerce, authorizeSettlement, awaitStepUpApproval, clearCache, extractCredentials, getCachedWellKnownUrls, getWellKnownUrls, hasCredentials, pollStepUpStatus, prefetchWellKnown, quickVerify, verify };
|
|
150
|
+
export { EnhancedVerificationResult, GatewayConfig, type SettlementDecision, type SettlementRequest, StepUpApprovalInfo, StepUpApprovalStatus, StepUpOutcome, SDK_VERSION as VERSION, type WellKnownAgenticCommerce, authorizeSettlement, awaitStepUpApproval, getCachedWellKnownUrls, getWellKnownUrls, pollStepUpStatus, prefetchWellKnown };
|