@astrasyncai/verification-gateway 1.0.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/README.md +213 -0
- package/dist/adapters/express.d.mts +3 -0
- package/dist/adapters/express.d.ts +3 -0
- package/dist/adapters/express.js +516 -0
- package/dist/adapters/express.js.map +1 -0
- package/dist/adapters/express.mjs +486 -0
- package/dist/adapters/express.mjs.map +1 -0
- package/dist/adapters/nextjs.d.mts +3 -0
- package/dist/adapters/nextjs.d.ts +3 -0
- package/dist/adapters/nextjs.js +624 -0
- package/dist/adapters/nextjs.js.map +1 -0
- package/dist/adapters/nextjs.mjs +586 -0
- package/dist/adapters/nextjs.mjs.map +1 -0
- package/dist/adapters/sdk.d.mts +2 -0
- package/dist/adapters/sdk.d.ts +2 -0
- package/dist/adapters/sdk.js +505 -0
- package/dist/adapters/sdk.js.map +1 -0
- package/dist/adapters/sdk.mjs +473 -0
- package/dist/adapters/sdk.mjs.map +1 -0
- package/dist/express-BhD3mWsL.d.ts +64 -0
- package/dist/express-DUDYpvNZ.d.mts +64 -0
- package/dist/index.d.mts +353 -0
- package/dist/index.d.ts +353 -0
- package/dist/index.js +1499 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1446 -0
- package/dist/index.mjs.map +1 -0
- package/dist/nextjs-BtqyLSVQ.d.mts +22 -0
- package/dist/nextjs-C9FPOjSh.d.ts +22 -0
- package/dist/sdk-BkVigGjF.d.ts +190 -0
- package/dist/sdk-xCbZgeZx.d.mts +190 -0
- package/dist/types-CS6v75-d.d.mts +359 -0
- package/dist/types-CS6v75-d.d.ts +359 -0
- package/dist/ui/index.d.mts +140 -0
- package/dist/ui/index.d.ts +140 -0
- package/dist/ui/index.js +826 -0
- package/dist/ui/index.js.map +1 -0
- package/dist/ui/index.mjs +782 -0
- package/dist/ui/index.mjs.map +1 -0
- package/package.json +89 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { RequestHandler, Request } from 'express';
|
|
2
|
+
import { b as VerificationResult, e as ExpressMiddlewareOptions, c as AstraSyncCredentials, a as AccessLevel } from './types-CS6v75-d.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* AstraSync Universal Verification Gateway - Express Middleware
|
|
6
|
+
*
|
|
7
|
+
* Express.js middleware for verifying AI agents on API endpoints.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* import express from 'express';
|
|
12
|
+
* import { createMiddleware } from '@astrasyncai/verification-gateway/express';
|
|
13
|
+
*
|
|
14
|
+
* const app = express();
|
|
15
|
+
*
|
|
16
|
+
* app.use(createMiddleware({
|
|
17
|
+
* apiBaseUrl: 'https://api.astrasync.ai',
|
|
18
|
+
* routes: [
|
|
19
|
+
* { pattern: '/api/public/*', method: '*', minAccessLevel: 'none' },
|
|
20
|
+
* { pattern: '/api/data/*', method: 'GET', minAccessLevel: 'read-only' },
|
|
21
|
+
* { pattern: '/api/data/*', method: '*', minAccessLevel: 'standard' },
|
|
22
|
+
* { pattern: '/api/admin/*', method: '*', minAccessLevel: 'internal' },
|
|
23
|
+
* ],
|
|
24
|
+
* }));
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Extend Express Request with verification result
|
|
30
|
+
*/
|
|
31
|
+
declare global {
|
|
32
|
+
namespace Express {
|
|
33
|
+
interface Request {
|
|
34
|
+
agentVerification?: VerificationResult;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Extract extended AstraSync credentials (X-Astra-* headers) from Express request.
|
|
40
|
+
* Returns null if no AstraSync headers are present.
|
|
41
|
+
*/
|
|
42
|
+
declare function extractAstraSyncCredentials(req: Request): AstraSyncCredentials | null;
|
|
43
|
+
/**
|
|
44
|
+
* Create Express middleware for agent verification
|
|
45
|
+
*/
|
|
46
|
+
declare function createMiddleware(options: ExpressMiddlewareOptions): RequestHandler;
|
|
47
|
+
/**
|
|
48
|
+
* Create a middleware that requires a specific access level
|
|
49
|
+
*/
|
|
50
|
+
declare function requireAccess(minAccessLevel: AccessLevel, options: ExpressMiddlewareOptions): RequestHandler;
|
|
51
|
+
/**
|
|
52
|
+
* Create a middleware that only verifies (doesn't block)
|
|
53
|
+
*/
|
|
54
|
+
declare function verifyOnly(options: Omit<ExpressMiddlewareOptions, 'routes' | 'onDenied'>): RequestHandler;
|
|
55
|
+
|
|
56
|
+
declare const express_createMiddleware: typeof createMiddleware;
|
|
57
|
+
declare const express_extractAstraSyncCredentials: typeof extractAstraSyncCredentials;
|
|
58
|
+
declare const express_requireAccess: typeof requireAccess;
|
|
59
|
+
declare const express_verifyOnly: typeof verifyOnly;
|
|
60
|
+
declare namespace express {
|
|
61
|
+
export { express_createMiddleware as createMiddleware, express_extractAstraSyncCredentials as extractAstraSyncCredentials, express_requireAccess as requireAccess, express_verifyOnly as verifyOnly };
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export { extractAstraSyncCredentials as a, createMiddleware as c, express as e, requireAccess as r, verifyOnly as v };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { RequestHandler, Request } from 'express';
|
|
2
|
+
import { b as VerificationResult, e as ExpressMiddlewareOptions, c as AstraSyncCredentials, a as AccessLevel } from './types-CS6v75-d.mjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* AstraSync Universal Verification Gateway - Express Middleware
|
|
6
|
+
*
|
|
7
|
+
* Express.js middleware for verifying AI agents on API endpoints.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* import express from 'express';
|
|
12
|
+
* import { createMiddleware } from '@astrasyncai/verification-gateway/express';
|
|
13
|
+
*
|
|
14
|
+
* const app = express();
|
|
15
|
+
*
|
|
16
|
+
* app.use(createMiddleware({
|
|
17
|
+
* apiBaseUrl: 'https://api.astrasync.ai',
|
|
18
|
+
* routes: [
|
|
19
|
+
* { pattern: '/api/public/*', method: '*', minAccessLevel: 'none' },
|
|
20
|
+
* { pattern: '/api/data/*', method: 'GET', minAccessLevel: 'read-only' },
|
|
21
|
+
* { pattern: '/api/data/*', method: '*', minAccessLevel: 'standard' },
|
|
22
|
+
* { pattern: '/api/admin/*', method: '*', minAccessLevel: 'internal' },
|
|
23
|
+
* ],
|
|
24
|
+
* }));
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Extend Express Request with verification result
|
|
30
|
+
*/
|
|
31
|
+
declare global {
|
|
32
|
+
namespace Express {
|
|
33
|
+
interface Request {
|
|
34
|
+
agentVerification?: VerificationResult;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Extract extended AstraSync credentials (X-Astra-* headers) from Express request.
|
|
40
|
+
* Returns null if no AstraSync headers are present.
|
|
41
|
+
*/
|
|
42
|
+
declare function extractAstraSyncCredentials(req: Request): AstraSyncCredentials | null;
|
|
43
|
+
/**
|
|
44
|
+
* Create Express middleware for agent verification
|
|
45
|
+
*/
|
|
46
|
+
declare function createMiddleware(options: ExpressMiddlewareOptions): RequestHandler;
|
|
47
|
+
/**
|
|
48
|
+
* Create a middleware that requires a specific access level
|
|
49
|
+
*/
|
|
50
|
+
declare function requireAccess(minAccessLevel: AccessLevel, options: ExpressMiddlewareOptions): RequestHandler;
|
|
51
|
+
/**
|
|
52
|
+
* Create a middleware that only verifies (doesn't block)
|
|
53
|
+
*/
|
|
54
|
+
declare function verifyOnly(options: Omit<ExpressMiddlewareOptions, 'routes' | 'onDenied'>): RequestHandler;
|
|
55
|
+
|
|
56
|
+
declare const express_createMiddleware: typeof createMiddleware;
|
|
57
|
+
declare const express_extractAstraSyncCredentials: typeof extractAstraSyncCredentials;
|
|
58
|
+
declare const express_requireAccess: typeof requireAccess;
|
|
59
|
+
declare const express_verifyOnly: typeof verifyOnly;
|
|
60
|
+
declare namespace express {
|
|
61
|
+
export { express_createMiddleware as createMiddleware, express_extractAstraSyncCredentials as extractAstraSyncCredentials, express_requireAccess as requireAccess, express_verifyOnly as verifyOnly };
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export { extractAstraSyncCredentials as a, createMiddleware as c, express as e, requireAccess as r, verifyOnly as v };
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
import { A as AgentCredentials, G as GatewayConfig, a as AccessLevel, V as VerificationRequest, b as VerificationResult, c as AstraSyncCredentials, P as ProtocolTransport } from './types-CS6v75-d.mjs';
|
|
2
|
+
export { C as CommerceShieldProps, d as CounterpartyType, E as EnhancedVerificationResult, e as ExpressMiddlewareOptions, f as GuidanceInfo, N as NextJsMiddlewareOptions, g as PDLSSInfo, R as RouteAccessConfig, h as RuntimeChallengeResult, S as SDKOptions, T as TokenGuidance, i as TrustLevel, j as VerifiedAgent, k as VerifiedDeveloper, l as VerifiedOrganization } from './types-CS6v75-d.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, c as getCapabilities, e as getTrustLevel, h as hasMinimumAccess, s as sdk } from './sdk-xCbZgeZx.mjs';
|
|
4
|
+
export { e as express } from './express-DUDYpvNZ.mjs';
|
|
5
|
+
export { n as nextjs } from './nextjs-BtqyLSVQ.mjs';
|
|
6
|
+
import 'express';
|
|
7
|
+
import 'next/server';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* AstraSync Universal Verification Gateway - Core Verification Logic
|
|
11
|
+
*
|
|
12
|
+
* This module handles the core verification logic, calling the AstraSync API
|
|
13
|
+
* and processing the response into a standardized VerificationResult.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Clear the verification cache
|
|
18
|
+
*/
|
|
19
|
+
declare function clearCache(): void;
|
|
20
|
+
/**
|
|
21
|
+
* Extract agent credentials from various sources
|
|
22
|
+
*/
|
|
23
|
+
declare function extractCredentials(headers: Record<string, string | string[] | undefined>, query?: Record<string, string | undefined>): AgentCredentials;
|
|
24
|
+
/**
|
|
25
|
+
* Check if credentials are present
|
|
26
|
+
*/
|
|
27
|
+
declare function hasCredentials(credentials: AgentCredentials): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Main verification function
|
|
30
|
+
*/
|
|
31
|
+
declare function verify(config: GatewayConfig, request: VerificationRequest): Promise<VerificationResult>;
|
|
32
|
+
/**
|
|
33
|
+
* Quick verification - just check if credentials are valid
|
|
34
|
+
*/
|
|
35
|
+
declare function quickVerify(config: GatewayConfig, credentials: AgentCredentials): Promise<{
|
|
36
|
+
verified: boolean;
|
|
37
|
+
accessLevel: AccessLevel;
|
|
38
|
+
reason?: string;
|
|
39
|
+
}>;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* HTTP Transport Adapter
|
|
43
|
+
*
|
|
44
|
+
* Maps AstraSync credentials to/from HTTP headers (X-Astra-* convention).
|
|
45
|
+
*/
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Inject AstraSync credentials into HTTP headers.
|
|
49
|
+
*/
|
|
50
|
+
declare function setHttpHeaders(headers: Record<string, string>, credentials: AstraSyncCredentials): Record<string, string>;
|
|
51
|
+
/**
|
|
52
|
+
* Extract AstraSync credentials from HTTP headers.
|
|
53
|
+
*/
|
|
54
|
+
declare function extractHttpCredentials(headers: Record<string, string | string[] | undefined>): AstraSyncCredentials | null;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* A2A (Agent-to-Agent) Transport Adapter
|
|
58
|
+
*
|
|
59
|
+
* Maps AstraSync credentials to/from A2A task metadata.astrasync block.
|
|
60
|
+
*/
|
|
61
|
+
|
|
62
|
+
interface A2ATask {
|
|
63
|
+
metadata?: Record<string, unknown>;
|
|
64
|
+
[key: string]: unknown;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Add AstraSync credentials to an A2A task's metadata block.
|
|
68
|
+
*/
|
|
69
|
+
declare function setA2AMetadata(task: A2ATask, credentials: AstraSyncCredentials): A2ATask;
|
|
70
|
+
/**
|
|
71
|
+
* Extract AstraSync credentials from an A2A task's metadata block.
|
|
72
|
+
*/
|
|
73
|
+
declare function extractA2ACredentials(task: A2ATask): AstraSyncCredentials | null;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* MCP (Model Context Protocol) Transport Adapter
|
|
77
|
+
*
|
|
78
|
+
* Maps AstraSync credentials to/from MCP params._meta.astrasync block.
|
|
79
|
+
*/
|
|
80
|
+
|
|
81
|
+
interface McpParams {
|
|
82
|
+
_meta?: Record<string, unknown>;
|
|
83
|
+
[key: string]: unknown;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Add AstraSync credentials to MCP params' _meta block.
|
|
87
|
+
*/
|
|
88
|
+
declare function setMcpMeta(params: McpParams, credentials: AstraSyncCredentials): McpParams;
|
|
89
|
+
/**
|
|
90
|
+
* Extract AstraSync credentials from MCP params' _meta block.
|
|
91
|
+
*/
|
|
92
|
+
declare function extractMcpCredentials(params: McpParams): AstraSyncCredentials | null;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Cross-Protocol Transport Module
|
|
96
|
+
*
|
|
97
|
+
* Provides adapters for injecting/extracting AstraSync credentials
|
|
98
|
+
* across HTTP, A2A, and MCP protocols.
|
|
99
|
+
*/
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Auto-detect protocol from request/context shape.
|
|
103
|
+
*/
|
|
104
|
+
declare function detectProtocol(context: Record<string, unknown>): ProtocolTransport;
|
|
105
|
+
/**
|
|
106
|
+
* Apply credentials to any protocol target.
|
|
107
|
+
*/
|
|
108
|
+
declare function applyCredentials(protocol: ProtocolTransport, target: Record<string, unknown>, credentials: AstraSyncCredentials): Record<string, unknown>;
|
|
109
|
+
/**
|
|
110
|
+
* Extract credentials from any protocol context.
|
|
111
|
+
*/
|
|
112
|
+
declare function extractCredentialsFromProtocol(protocol: ProtocolTransport, context: Record<string, unknown>): AstraSyncCredentials | null;
|
|
113
|
+
|
|
114
|
+
declare const index$1_applyCredentials: typeof applyCredentials;
|
|
115
|
+
declare const index$1_detectProtocol: typeof detectProtocol;
|
|
116
|
+
declare const index$1_extractA2ACredentials: typeof extractA2ACredentials;
|
|
117
|
+
declare const index$1_extractCredentialsFromProtocol: typeof extractCredentialsFromProtocol;
|
|
118
|
+
declare const index$1_extractHttpCredentials: typeof extractHttpCredentials;
|
|
119
|
+
declare const index$1_extractMcpCredentials: typeof extractMcpCredentials;
|
|
120
|
+
declare const index$1_setA2AMetadata: typeof setA2AMetadata;
|
|
121
|
+
declare const index$1_setHttpHeaders: typeof setHttpHeaders;
|
|
122
|
+
declare const index$1_setMcpMeta: typeof setMcpMeta;
|
|
123
|
+
declare namespace index$1 {
|
|
124
|
+
export { index$1_applyCredentials as applyCredentials, index$1_detectProtocol as detectProtocol, index$1_extractA2ACredentials as extractA2ACredentials, index$1_extractCredentialsFromProtocol as extractCredentialsFromProtocol, index$1_extractHttpCredentials as extractHttpCredentials, index$1_extractMcpCredentials as extractMcpCredentials, index$1_setA2AMetadata as setA2AMetadata, index$1_setHttpHeaders as setHttpHeaders, index$1_setMcpMeta as setMcpMeta };
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* AgentClient — Credential Presentation
|
|
129
|
+
*
|
|
130
|
+
* Agent-side SDK for automatically injecting AstraSync credentials
|
|
131
|
+
* into outgoing requests across all supported protocols.
|
|
132
|
+
*/
|
|
133
|
+
|
|
134
|
+
interface AgentClientConfig {
|
|
135
|
+
agentId: string;
|
|
136
|
+
verifyUrl?: string;
|
|
137
|
+
challengeUrl?: string;
|
|
138
|
+
pdlss?: AstraSyncCredentials['pdlss'];
|
|
139
|
+
}
|
|
140
|
+
interface FetchOptions extends RequestInit {
|
|
141
|
+
purpose?: string;
|
|
142
|
+
action?: string;
|
|
143
|
+
}
|
|
144
|
+
declare class AgentClient {
|
|
145
|
+
private credentials;
|
|
146
|
+
constructor(config: AgentClientConfig);
|
|
147
|
+
/**
|
|
148
|
+
* Make an HTTP request with AstraSync headers automatically injected.
|
|
149
|
+
*/
|
|
150
|
+
fetch(url: string, options?: FetchOptions): Promise<Response>;
|
|
151
|
+
/**
|
|
152
|
+
* Prepare A2A task metadata with AstraSync credentials.
|
|
153
|
+
*/
|
|
154
|
+
prepareA2AMetadata(task: Record<string, unknown>, overrides?: {
|
|
155
|
+
purpose?: string;
|
|
156
|
+
action?: string;
|
|
157
|
+
}): Record<string, unknown>;
|
|
158
|
+
/**
|
|
159
|
+
* Prepare MCP params with AstraSync _meta.
|
|
160
|
+
*/
|
|
161
|
+
prepareMcpMeta(params: Record<string, unknown>, overrides?: {
|
|
162
|
+
purpose?: string;
|
|
163
|
+
action?: string;
|
|
164
|
+
}): Record<string, unknown>;
|
|
165
|
+
/**
|
|
166
|
+
* Generic: apply credentials to any protocol.
|
|
167
|
+
*/
|
|
168
|
+
applyCredentials(protocol: ProtocolTransport, target: Record<string, unknown>, overrides?: {
|
|
169
|
+
purpose?: string;
|
|
170
|
+
action?: string;
|
|
171
|
+
}): Record<string, unknown>;
|
|
172
|
+
private buildCredentials;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* ChallengeHandler — Agent-Side Runtime Challenge Responder
|
|
177
|
+
*
|
|
178
|
+
* Handles incoming runtime challenges from AstraSync's verification service.
|
|
179
|
+
* Agents register pending counterparties before initiating contact,
|
|
180
|
+
* then this handler validates and responds to challenges.
|
|
181
|
+
*/
|
|
182
|
+
interface ChallengeResponse {
|
|
183
|
+
status: number;
|
|
184
|
+
body: {
|
|
185
|
+
challengeId: string;
|
|
186
|
+
acknowledged: boolean;
|
|
187
|
+
pendingCounterparties: string[];
|
|
188
|
+
respondedAt: string;
|
|
189
|
+
error?: string;
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
interface ChallengeHandlerConfig {
|
|
193
|
+
agentId: string;
|
|
194
|
+
}
|
|
195
|
+
declare class ChallengeHandler {
|
|
196
|
+
private agentId;
|
|
197
|
+
private pendingCounterparties;
|
|
198
|
+
constructor(config: ChallengeHandlerConfig);
|
|
199
|
+
/**
|
|
200
|
+
* Register a counterparty as pending (before initiating contact).
|
|
201
|
+
*/
|
|
202
|
+
registerPending(counterpartyId: string): void;
|
|
203
|
+
/**
|
|
204
|
+
* Remove a counterparty from pending list (after interaction complete).
|
|
205
|
+
*/
|
|
206
|
+
removePending(counterpartyId: string): void;
|
|
207
|
+
/**
|
|
208
|
+
* Get current pending counterparties list.
|
|
209
|
+
*/
|
|
210
|
+
getPendingList(): string[];
|
|
211
|
+
/**
|
|
212
|
+
* Express middleware for the challenge endpoint.
|
|
213
|
+
* Mount at: app.post('/astrasync/challenge', handler.expressMiddleware())
|
|
214
|
+
*/
|
|
215
|
+
expressMiddleware(): (req: {
|
|
216
|
+
body: unknown;
|
|
217
|
+
}, res: {
|
|
218
|
+
status: (code: number) => {
|
|
219
|
+
json: (body: unknown) => void;
|
|
220
|
+
};
|
|
221
|
+
}) => void;
|
|
222
|
+
/**
|
|
223
|
+
* Generic handler (framework-agnostic).
|
|
224
|
+
* Returns { status, body } for the caller to send.
|
|
225
|
+
*/
|
|
226
|
+
handleChallenge(body: unknown): ChallengeResponse;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* PDLSS Formatter — Transport Format Conversion
|
|
231
|
+
*
|
|
232
|
+
* Converts between full PDLSS boundaries and compact transport format
|
|
233
|
+
* used in HTTP headers, A2A metadata, and MCP _meta blocks.
|
|
234
|
+
*/
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Full PDLSS configuration (as returned by the backend).
|
|
238
|
+
*/
|
|
239
|
+
interface PDLSSConfig {
|
|
240
|
+
purpose?: {
|
|
241
|
+
categories?: string[];
|
|
242
|
+
allowedActions?: string[];
|
|
243
|
+
deniedActions?: string[];
|
|
244
|
+
};
|
|
245
|
+
duration?: {
|
|
246
|
+
maxSessionDuration?: number;
|
|
247
|
+
ttl?: number;
|
|
248
|
+
allowedDays?: number[];
|
|
249
|
+
allowedHours?: {
|
|
250
|
+
start: number;
|
|
251
|
+
end: number;
|
|
252
|
+
};
|
|
253
|
+
};
|
|
254
|
+
limits?: {
|
|
255
|
+
autonomousThreshold?: number;
|
|
256
|
+
stepUpThreshold?: number;
|
|
257
|
+
approvalThreshold?: number;
|
|
258
|
+
currency?: string;
|
|
259
|
+
};
|
|
260
|
+
scope?: {
|
|
261
|
+
jurisdictions?: string[];
|
|
262
|
+
resources?: string[];
|
|
263
|
+
resourceTypes?: string[];
|
|
264
|
+
};
|
|
265
|
+
selfInstantiation?: {
|
|
266
|
+
allowed: boolean;
|
|
267
|
+
maxDepth?: number;
|
|
268
|
+
maxSubAgents?: number;
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* Compact transport format (embedded in headers/metadata).
|
|
273
|
+
*/
|
|
274
|
+
type TransportPDLSS = NonNullable<AstraSyncCredentials['pdlss']>;
|
|
275
|
+
/**
|
|
276
|
+
* Convert full PDLSS boundaries into compact transport format.
|
|
277
|
+
* Used by AgentClient when building credential headers/metadata.
|
|
278
|
+
*/
|
|
279
|
+
declare function formatPDLSSForTransport(pdlss: PDLSSConfig): TransportPDLSS;
|
|
280
|
+
/**
|
|
281
|
+
* Parse transport format back into full PDLSS config.
|
|
282
|
+
* Used by counterparty-side when receiving credentials.
|
|
283
|
+
*/
|
|
284
|
+
declare function parsePDLSSFromTransport(transport: TransportPDLSS): PDLSSConfig;
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* Decision Client — Counterparty-Side Decision Recording
|
|
288
|
+
*
|
|
289
|
+
* Helper for counterparties to record their grant/deny decisions
|
|
290
|
+
* back to AstraSync after receiving a verification result.
|
|
291
|
+
*/
|
|
292
|
+
|
|
293
|
+
interface RecordDecisionParams {
|
|
294
|
+
sessionId: string;
|
|
295
|
+
decision: 'granted' | 'denied';
|
|
296
|
+
reason?: string;
|
|
297
|
+
tokenIssued?: boolean;
|
|
298
|
+
auditId?: string;
|
|
299
|
+
}
|
|
300
|
+
interface RecordDecisionResult {
|
|
301
|
+
recorded: boolean;
|
|
302
|
+
blockchainTxHash?: string;
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Record a counterparty's grant/deny decision for a verification session.
|
|
306
|
+
* POST to /agents/verify-access/:sessionId/decision
|
|
307
|
+
*/
|
|
308
|
+
declare function recordDecision(config: GatewayConfig, params: RecordDecisionParams): Promise<RecordDecisionResult>;
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* Agent-Side SDK Module
|
|
312
|
+
*
|
|
313
|
+
* Tools for AI agents to present credentials, handle challenges,
|
|
314
|
+
* and interact with the AstraSync verification protocol.
|
|
315
|
+
*/
|
|
316
|
+
|
|
317
|
+
type index_AgentClient = AgentClient;
|
|
318
|
+
declare const index_AgentClient: typeof AgentClient;
|
|
319
|
+
type index_ChallengeHandler = ChallengeHandler;
|
|
320
|
+
declare const index_ChallengeHandler: typeof ChallengeHandler;
|
|
321
|
+
type index_PDLSSConfig = PDLSSConfig;
|
|
322
|
+
type index_TransportPDLSS = TransportPDLSS;
|
|
323
|
+
declare const index_formatPDLSSForTransport: typeof formatPDLSSForTransport;
|
|
324
|
+
declare const index_parsePDLSSFromTransport: typeof parsePDLSSFromTransport;
|
|
325
|
+
declare const index_recordDecision: typeof recordDecision;
|
|
326
|
+
declare namespace index {
|
|
327
|
+
export { index_AgentClient as AgentClient, index_ChallengeHandler as ChallengeHandler, type index_PDLSSConfig as PDLSSConfig, type index_TransportPDLSS as TransportPDLSS, index_formatPDLSSForTransport as formatPDLSSForTransport, index_parsePDLSSFromTransport as parsePDLSSFromTransport, index_recordDecision as recordDecision };
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* AstraSync Universal Verification Gateway
|
|
332
|
+
*
|
|
333
|
+
* A single verification library for any system to verify AI agents.
|
|
334
|
+
* One codebase, multiple deployment targets.
|
|
335
|
+
*
|
|
336
|
+
* @example
|
|
337
|
+
* ```typescript
|
|
338
|
+
* import { verify, extractCredentials } from '@astrasyncai/verification-gateway';
|
|
339
|
+
*
|
|
340
|
+
* const credentials = extractCredentials(request.headers);
|
|
341
|
+
* const result = await verify(config, { credentials, purpose: 'data-access' });
|
|
342
|
+
*
|
|
343
|
+
* if (result.verified && result.accessLevel !== 'none') {
|
|
344
|
+
* // Grant access based on result.accessLevel
|
|
345
|
+
* }
|
|
346
|
+
* ```
|
|
347
|
+
*
|
|
348
|
+
* @packageDocumentation
|
|
349
|
+
*/
|
|
350
|
+
|
|
351
|
+
declare const VERSION = "2.0.0";
|
|
352
|
+
|
|
353
|
+
export { AccessLevel, AgentClient, AgentCredentials, AstraSyncCredentials, ChallengeHandler, GatewayConfig, ProtocolTransport, VERSION, VerificationRequest, VerificationResult, index as agent, clearCache, extractCredentials, hasCredentials, quickVerify, recordDecision, index$1 as transport, verify };
|