@dupecom/botcha-cloudflare 0.20.2 → 0.23.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 (88) hide show
  1. package/README.md +74 -9
  2. package/dist/agent-auth.d.ts +129 -0
  3. package/dist/agent-auth.d.ts.map +1 -0
  4. package/dist/agent-auth.js +210 -0
  5. package/dist/agents.d.ts +10 -0
  6. package/dist/agents.d.ts.map +1 -1
  7. package/dist/agents.js +51 -1
  8. package/dist/app-gate.d.ts +6 -0
  9. package/dist/app-gate.d.ts.map +1 -0
  10. package/dist/app-gate.js +69 -0
  11. package/dist/apps.d.ts +13 -4
  12. package/dist/apps.d.ts.map +1 -1
  13. package/dist/apps.js +30 -4
  14. package/dist/dashboard/account.d.ts +63 -0
  15. package/dist/dashboard/account.d.ts.map +1 -0
  16. package/dist/dashboard/account.js +488 -0
  17. package/dist/dashboard/api.js +15 -68
  18. package/dist/dashboard/auth.d.ts.map +1 -1
  19. package/dist/dashboard/auth.js +14 -14
  20. package/dist/dashboard/docs.d.ts.map +1 -1
  21. package/dist/dashboard/docs.js +146 -3
  22. package/dist/dashboard/layout.d.ts.map +1 -1
  23. package/dist/dashboard/layout.js +2 -2
  24. package/dist/dashboard/mcp-setup.d.ts +15 -0
  25. package/dist/dashboard/mcp-setup.d.ts.map +1 -0
  26. package/dist/dashboard/mcp-setup.js +391 -0
  27. package/dist/dashboard/showcase.d.ts +6 -10
  28. package/dist/dashboard/showcase.d.ts.map +1 -1
  29. package/dist/dashboard/showcase.js +67 -991
  30. package/dist/dashboard/whitepaper.d.ts.map +1 -1
  31. package/dist/dashboard/whitepaper.js +42 -4
  32. package/dist/index.d.ts +5 -0
  33. package/dist/index.d.ts.map +1 -1
  34. package/dist/index.js +660 -83
  35. package/dist/mcp.d.ts +20 -0
  36. package/dist/mcp.d.ts.map +1 -0
  37. package/dist/mcp.js +1290 -0
  38. package/dist/oauth-agent.d.ts +130 -0
  39. package/dist/oauth-agent.d.ts.map +1 -0
  40. package/dist/oauth-agent.js +194 -0
  41. package/dist/static.d.ts +781 -5
  42. package/dist/static.d.ts.map +1 -1
  43. package/dist/static.js +790 -111
  44. package/dist/tap-a2a-routes.d.ts +355 -0
  45. package/dist/tap-a2a-routes.d.ts.map +1 -0
  46. package/dist/tap-a2a-routes.js +475 -0
  47. package/dist/tap-a2a.d.ts +199 -0
  48. package/dist/tap-a2a.d.ts.map +1 -0
  49. package/dist/tap-a2a.js +502 -0
  50. package/dist/tap-agents.d.ts +15 -0
  51. package/dist/tap-agents.d.ts.map +1 -1
  52. package/dist/tap-agents.js +31 -1
  53. package/dist/tap-ans-routes.d.ts +302 -0
  54. package/dist/tap-ans-routes.d.ts.map +1 -0
  55. package/dist/tap-ans-routes.js +535 -0
  56. package/dist/tap-ans.d.ts +241 -0
  57. package/dist/tap-ans.d.ts.map +1 -0
  58. package/dist/tap-ans.js +481 -0
  59. package/dist/tap-delegation-routes.d.ts.map +1 -1
  60. package/dist/tap-delegation-routes.js +11 -0
  61. package/dist/tap-did.d.ts +140 -0
  62. package/dist/tap-did.d.ts.map +1 -0
  63. package/dist/tap-did.js +262 -0
  64. package/dist/tap-oidca-routes.d.ts +383 -0
  65. package/dist/tap-oidca-routes.d.ts.map +1 -0
  66. package/dist/tap-oidca-routes.js +597 -0
  67. package/dist/tap-oidca.d.ts +288 -0
  68. package/dist/tap-oidca.d.ts.map +1 -0
  69. package/dist/tap-oidca.js +461 -0
  70. package/dist/tap-routes.d.ts +24 -8
  71. package/dist/tap-routes.d.ts.map +1 -1
  72. package/dist/tap-routes.js +169 -23
  73. package/dist/tap-vc-routes.d.ts +358 -0
  74. package/dist/tap-vc-routes.d.ts.map +1 -0
  75. package/dist/tap-vc-routes.js +367 -0
  76. package/dist/tap-vc.d.ts +125 -0
  77. package/dist/tap-vc.d.ts.map +1 -0
  78. package/dist/tap-vc.js +245 -0
  79. package/dist/tap-x402-routes.d.ts +89 -0
  80. package/dist/tap-x402-routes.d.ts.map +1 -0
  81. package/dist/tap-x402-routes.js +579 -0
  82. package/dist/tap-x402.d.ts +222 -0
  83. package/dist/tap-x402.d.ts.map +1 -0
  84. package/dist/tap-x402.js +546 -0
  85. package/dist/webhooks.d.ts +99 -0
  86. package/dist/webhooks.d.ts.map +1 -0
  87. package/dist/webhooks.js +642 -0
  88. package/package.json +3 -1
@@ -0,0 +1,367 @@
1
+ /**
2
+ * DID/VC API Routes
3
+ *
4
+ * Endpoints:
5
+ * GET /.well-known/did.json — BOTCHA DID Document (did:web:botcha.ai)
6
+ * POST /v1/credentials/issue — Issue VC from a valid BOTCHA access_token
7
+ * POST /v1/credentials/verify — Verify a VC JWT
8
+ * GET /v1/dids/:did/resolve — Resolve a did:web DID Document
9
+ *
10
+ * All credential issuance requires a valid BOTCHA access_token in the
11
+ * Authorization header (Bearer <token>). The token is the result of a
12
+ * successful BOTCHA challenge solve (/v1/token/verify).
13
+ */
14
+ import { extractBearerToken, verifyToken, getSigningPublicKeyJWK, } from './auth.js';
15
+ import { generateBotchaDIDDocument, resolveDIDWeb, buildAgentDID, parseDID, } from './tap-did.js';
16
+ import { issueVC, verifyVC } from './tap-vc.js';
17
+ import { getTAPAgent } from './tap-agents.js';
18
+ // ============ HELPERS ============
19
+ function getSigningKey(env) {
20
+ const raw = env?.JWT_SIGNING_KEY;
21
+ if (!raw)
22
+ return undefined;
23
+ try {
24
+ return JSON.parse(raw);
25
+ }
26
+ catch {
27
+ return undefined;
28
+ }
29
+ }
30
+ function getPublicKeyJwk(env) {
31
+ const sk = getSigningKey(env);
32
+ return sk ? getSigningPublicKeyJWK(sk) : undefined;
33
+ }
34
+ // ============ ROUTES ============
35
+ /**
36
+ * GET /.well-known/did.json
37
+ *
38
+ * Returns the BOTCHA DID Document for did:web:botcha.ai.
39
+ * This is a public endpoint — no auth required.
40
+ * Resolvers use this to discover BOTCHA's public keys for VC verification.
41
+ */
42
+ export async function didDocumentRoute(c) {
43
+ try {
44
+ const baseUrl = new URL(c.req.url).origin;
45
+ const publicKey = getPublicKeyJwk(c.env);
46
+ const doc = generateBotchaDIDDocument(baseUrl, publicKey);
47
+ return new Response(JSON.stringify(doc, null, 2), {
48
+ status: 200,
49
+ headers: {
50
+ 'Content-Type': 'application/did+ld+json',
51
+ 'Cache-Control': 'public, max-age=3600',
52
+ 'Access-Control-Allow-Origin': '*',
53
+ },
54
+ });
55
+ }
56
+ catch (error) {
57
+ console.error('DID document error:', error);
58
+ return c.json({ error: 'INTERNAL_ERROR', message: 'Failed to generate DID document' }, 500);
59
+ }
60
+ }
61
+ /**
62
+ * POST /v1/credentials/issue
63
+ *
64
+ * Exchange a valid BOTCHA access_token for a W3C Verifiable Credential.
65
+ *
66
+ * Request (body, all optional):
67
+ * {
68
+ * "agent_id": "agent_xxx", // Override agent identity in VC
69
+ * "duration_seconds": 86400, // VC validity period (default: 24h, max: 30d)
70
+ * }
71
+ *
72
+ * Headers:
73
+ * Authorization: Bearer <access_token> (required — from /v1/token/verify)
74
+ *
75
+ * Response:
76
+ * {
77
+ * "success": true,
78
+ * "credential_id": "urn:botcha:vc:...",
79
+ * "vc": { ...W3C JSON-LD credential... },
80
+ * "vc_jwt": "eyJ...",
81
+ * "issued_at": "2026-...",
82
+ * "expires_at": "2026-...",
83
+ * }
84
+ */
85
+ export async function issueVCRoute(c) {
86
+ try {
87
+ // 1. Authenticate — require a valid BOTCHA access_token
88
+ const authHeader = c.req.header('authorization');
89
+ const token = extractBearerToken(authHeader);
90
+ if (!token) {
91
+ return c.json({
92
+ success: false,
93
+ error: 'UNAUTHORIZED',
94
+ message: 'Missing Bearer token. Solve a BOTCHA challenge first: POST /v1/token/verify',
95
+ }, 401);
96
+ }
97
+ const publicKey = getPublicKeyJwk(c.env);
98
+ const tokenResult = await verifyToken(token, c.env.JWT_SECRET, c.env, undefined, publicKey);
99
+ if (!tokenResult.valid || !tokenResult.payload) {
100
+ return c.json({
101
+ success: false,
102
+ error: 'INVALID_TOKEN',
103
+ message: tokenResult.error || 'Token is invalid or expired',
104
+ }, 401);
105
+ }
106
+ const tokenPayload = tokenResult.payload;
107
+ // 2. Parse optional request body
108
+ let body = {};
109
+ try {
110
+ body = await c.req.json();
111
+ }
112
+ catch {
113
+ // No body or non-JSON — that's fine, all fields are optional
114
+ }
115
+ const appId = tokenPayload.app_id;
116
+ if (!appId) {
117
+ return c.json({
118
+ success: false,
119
+ error: 'MISSING_APP_ID',
120
+ message: 'Token is missing app_id claim. Request a token scoped to your app.',
121
+ }, 403);
122
+ }
123
+ // 3. Look up agent DID if agent_id is provided (or from token)
124
+ const resolvedAgentId = body.agent_id || undefined;
125
+ let agentDid;
126
+ let capabilities;
127
+ let trustLevel = 'basic';
128
+ if (resolvedAgentId) {
129
+ const agentResult = await getTAPAgent(c.env.AGENTS, resolvedAgentId);
130
+ if (!agentResult.success || !agentResult.agent) {
131
+ return c.json({
132
+ success: false,
133
+ error: 'AGENT_NOT_FOUND',
134
+ message: `Agent ${resolvedAgentId} not found in BOTCHA registry`,
135
+ }, 404);
136
+ }
137
+ const agent = agentResult.agent;
138
+ if (agent.app_id !== appId) {
139
+ return c.json({
140
+ success: false,
141
+ error: 'APP_ID_MISMATCH',
142
+ message: 'Agent belongs to a different app. You can only issue credentials for agents in your own app.',
143
+ }, 403);
144
+ }
145
+ // Only include agent DID if it has a registered `did` field (custom) or
146
+ // derive it from their agent_id in BOTCHA's namespace
147
+ if (agent.did) {
148
+ agentDid = agent.did;
149
+ }
150
+ else if (agent.tap_enabled) {
151
+ // TAP-registered agents get a BOTCHA-namespace DID
152
+ agentDid = buildAgentDID(agent.agent_id);
153
+ }
154
+ // Collect capability strings
155
+ if (agent.capabilities && agent.capabilities.length > 0) {
156
+ capabilities = agent.capabilities.map((cap) => cap.scope && cap.scope.length > 0
157
+ ? `${cap.action}:${cap.scope.join(',')}`
158
+ : cap.action);
159
+ }
160
+ trustLevel = agent.trust_level || 'basic';
161
+ }
162
+ // 4. Issue the VC
163
+ const signingKey = getSigningKey(c.env);
164
+ const vcResult = await issueVC({
165
+ agent_id: resolvedAgentId,
166
+ app_id: appId,
167
+ solve_time_ms: tokenPayload.solveTime || 0,
168
+ challenge_type: 'speed', // access_tokens are always from speed challenges
169
+ trust_level: trustLevel,
170
+ capabilities,
171
+ agent_did: agentDid,
172
+ duration_seconds: body.duration_seconds,
173
+ }, signingKey, c.env.JWT_SECRET);
174
+ if (!vcResult.success) {
175
+ return c.json({
176
+ success: false,
177
+ error: 'VC_ISSUANCE_FAILED',
178
+ message: vcResult.error || 'Failed to issue credential',
179
+ }, 500);
180
+ }
181
+ return c.json({
182
+ success: true,
183
+ credential_id: vcResult.credential_id,
184
+ vc: vcResult.vc,
185
+ vc_jwt: vcResult.vc_jwt,
186
+ issued_at: vcResult.issued_at,
187
+ expires_at: vcResult.expires_at,
188
+ issuer: 'did:web:botcha.ai',
189
+ usage: {
190
+ note: 'Present vc_jwt to any service that accepts BOTCHA Verifiable Credentials.',
191
+ verify_endpoint: `${new URL(c.req.url).origin}/v1/credentials/verify`,
192
+ offline_verify: 'Fetch /.well-known/jwks and verify the JWT signature yourself.',
193
+ did_document: `${new URL(c.req.url).origin}/.well-known/did.json`,
194
+ },
195
+ }, 201);
196
+ }
197
+ catch (error) {
198
+ console.error('VC issuance route error:', error);
199
+ return c.json({
200
+ success: false,
201
+ error: 'INTERNAL_ERROR',
202
+ message: 'Internal server error',
203
+ }, 500);
204
+ }
205
+ }
206
+ /**
207
+ * POST /v1/credentials/verify
208
+ *
209
+ * Verify a BOTCHA VC JWT. No auth required — the VC is the credential.
210
+ *
211
+ * Request body:
212
+ * { "vc_jwt": "eyJ..." }
213
+ *
214
+ * Response (valid):
215
+ * {
216
+ * "valid": true,
217
+ * "issuer": "did:web:botcha.ai",
218
+ * "credential_id": "urn:botcha:vc:...",
219
+ * "credential_subject": { ... },
220
+ * "issued_at": "...",
221
+ * "expires_at": "...",
222
+ * }
223
+ *
224
+ * Response (invalid):
225
+ * { "valid": false, "error": "..." }
226
+ */
227
+ export async function verifyVCRoute(c) {
228
+ try {
229
+ let body = {};
230
+ try {
231
+ body = await c.req.json();
232
+ }
233
+ catch {
234
+ return c.json({
235
+ valid: false,
236
+ error: 'INVALID_REQUEST',
237
+ message: 'Request body must be JSON with a "vc_jwt" field',
238
+ }, 400);
239
+ }
240
+ if (!body.vc_jwt || typeof body.vc_jwt !== 'string') {
241
+ return c.json({
242
+ valid: false,
243
+ error: 'MISSING_VC_JWT',
244
+ message: 'Provide { "vc_jwt": "<JWT string>" } in the request body',
245
+ }, 400);
246
+ }
247
+ const signingKey = getSigningKey(c.env);
248
+ if (!signingKey && !c.env.JWT_SECRET) {
249
+ return c.json({
250
+ valid: false,
251
+ error: 'SERVICE_UNAVAILABLE',
252
+ message: 'VC verification is not configured on this server. Contact support.',
253
+ }, 503);
254
+ }
255
+ const result = await verifyVC(body.vc_jwt, signingKey, c.env.JWT_SECRET);
256
+ if (!result.valid) {
257
+ return c.json({
258
+ valid: false,
259
+ error: result.error || 'Verification failed',
260
+ }, 200); // 200 with valid:false — the request itself succeeded
261
+ }
262
+ return c.json({
263
+ valid: true,
264
+ issuer: result.issuer,
265
+ credential_id: result.credential_id,
266
+ credential_subject: result.credential_subject,
267
+ vc: result.vc,
268
+ issued_at: result.issued_at,
269
+ expires_at: result.expires_at,
270
+ });
271
+ }
272
+ catch (error) {
273
+ console.error('VC verification route error:', error);
274
+ return c.json({
275
+ valid: false,
276
+ error: 'INTERNAL_ERROR',
277
+ message: 'Internal server error',
278
+ }, 500);
279
+ }
280
+ }
281
+ /**
282
+ * GET /v1/dids/:did/resolve
283
+ *
284
+ * Resolve a did:web DID Document.
285
+ * This is a public endpoint — no auth required.
286
+ *
287
+ * Supports: did:web:* only (other methods return methodNotSupported)
288
+ *
289
+ * Special case: did:web:botcha.ai is resolved locally (no outbound fetch).
290
+ *
291
+ * Query params:
292
+ * (none currently)
293
+ *
294
+ * Response:
295
+ * W3C DID Resolution Result object
296
+ */
297
+ export async function resolveDIDRoute(c) {
298
+ try {
299
+ // The DID is URL-encoded in the path param — decode it
300
+ const rawParam = c.req.param('did');
301
+ if (!rawParam) {
302
+ return c.json({
303
+ '@context': 'https://w3id.org/did-resolution/v1',
304
+ didDocument: null,
305
+ didResolutionMetadata: { error: 'invalidDid: DID parameter is missing' },
306
+ didDocumentMetadata: {},
307
+ }, 400);
308
+ }
309
+ // Path parameters may be URL-encoded (e.g. "did%3Aweb%3Aexample.com")
310
+ const did = decodeURIComponent(rawParam);
311
+ // Validate DID format before attempting resolution
312
+ const parsed = parseDID(did);
313
+ if (!parsed.valid) {
314
+ return c.json({
315
+ '@context': 'https://w3id.org/did-resolution/v1',
316
+ didDocument: null,
317
+ didResolutionMetadata: { error: `invalidDid: ${parsed.error}` },
318
+ didDocumentMetadata: {},
319
+ }, 400);
320
+ }
321
+ if (parsed.method !== 'web') {
322
+ return c.json({
323
+ '@context': 'https://w3id.org/did-resolution/v1',
324
+ didDocument: null,
325
+ didResolutionMetadata: {
326
+ error: `methodNotSupported: Method "${parsed.method}" is not supported. Only did:web is implemented.`,
327
+ },
328
+ didDocumentMetadata: {},
329
+ }, 400);
330
+ }
331
+ // Special case: resolve botcha.ai locally
332
+ if (did === 'did:web:botcha.ai') {
333
+ const baseUrl = new URL(c.req.url).origin;
334
+ const publicKey = getPublicKeyJwk(c.env);
335
+ const doc = generateBotchaDIDDocument(baseUrl, publicKey);
336
+ return c.json({
337
+ '@context': 'https://w3id.org/did-resolution/v1',
338
+ didDocument: doc,
339
+ didResolutionMetadata: {
340
+ contentType: 'application/did+ld+json',
341
+ retrieved: new Date().toISOString(),
342
+ duration: 0,
343
+ },
344
+ didDocumentMetadata: {},
345
+ });
346
+ }
347
+ // Resolve external did:web
348
+ const result = await resolveDIDWeb(did);
349
+ const statusCode = result.didDocument ? 200 : 404;
350
+ return c.json(result, statusCode);
351
+ }
352
+ catch (error) {
353
+ console.error('DID resolution route error:', error);
354
+ return c.json({
355
+ '@context': 'https://w3id.org/did-resolution/v1',
356
+ didDocument: null,
357
+ didResolutionMetadata: { error: 'internalError: Internal server error' },
358
+ didDocumentMetadata: {},
359
+ }, 500);
360
+ }
361
+ }
362
+ export default {
363
+ didDocumentRoute,
364
+ issueVCRoute,
365
+ verifyVCRoute,
366
+ resolveDIDRoute,
367
+ };
@@ -0,0 +1,125 @@
1
+ /**
2
+ * BOTCHA Verifiable Credentials — W3C VC Data Model 2.0
3
+ *
4
+ * Implements:
5
+ * - VC issuance: sign a BotchaVerification credential as a JWT
6
+ * - VC verification: validate signature, expiry, and issuer
7
+ * - Credential schema aligned with the VC Data Model 2.0 spec
8
+ *
9
+ * Encoding:
10
+ * VCs are encoded as JWT-VCs per the VC Data Model 2.0 spec.
11
+ * The JWT payload contains a "vc" claim with the JSON-LD credential,
12
+ * plus standard JWT claims (iss, sub, jti, iat, nbf, exp).
13
+ *
14
+ * Signing:
15
+ * - Preferred: ES256 with the BOTCHA JWT_SIGNING_KEY (verifiable offline)
16
+ * - Fallback: HS256 with JWT_SECRET (verifiable only by botcha.ai)
17
+ *
18
+ * Standards:
19
+ * - W3C VC Data Model 2.0: https://www.w3.org/TR/vc-data-model-2.0/
20
+ * - VC-JWT: https://www.w3.org/TR/vc-data-model-2.0/#json-web-token
21
+ * - DID Core 1.0: https://www.w3.org/TR/did-core/
22
+ */
23
+ import type { ES256SigningKeyJWK } from './auth.js';
24
+ export interface BotchaCredentialSubject {
25
+ id?: string;
26
+ agent_id: string;
27
+ app_id: string;
28
+ challenge_type: string;
29
+ solve_time_ms: number;
30
+ trust_level: 'basic' | 'verified' | 'enterprise';
31
+ capabilities?: string[];
32
+ }
33
+ export interface VerifiableCredential {
34
+ '@context': string[];
35
+ type: string[];
36
+ id: string;
37
+ issuer: string;
38
+ credentialSubject: BotchaCredentialSubject;
39
+ validFrom: string;
40
+ validUntil: string;
41
+ }
42
+ export interface IssueVCOptions {
43
+ /** BOTCHA agent_id — from agent registration (optional; anonymous if not registered) */
44
+ agent_id?: string;
45
+ /** App that created the challenge */
46
+ app_id: string;
47
+ /** Challenge solve time in milliseconds */
48
+ solve_time_ms: number;
49
+ /** Challenge type (speed, hybrid, reasoning) */
50
+ challenge_type?: string;
51
+ /** Agent trust level */
52
+ trust_level?: 'basic' | 'verified' | 'enterprise';
53
+ /** Agent capabilities (strings like "browse:products") */
54
+ capabilities?: string[];
55
+ /** Agent DID — embedded as credentialSubject.id when present */
56
+ agent_did?: string;
57
+ /** Validity period in seconds (default: 86400 = 24 h; max: 2592000 = 30 days) */
58
+ duration_seconds?: number;
59
+ }
60
+ export interface VCIssuanceResult {
61
+ success: boolean;
62
+ /** The W3C VC JSON-LD object */
63
+ vc?: VerifiableCredential;
64
+ /** The signed JWT-VC (what you send to relying parties) */
65
+ vc_jwt?: string;
66
+ credential_id?: string;
67
+ issued_at?: string;
68
+ expires_at?: string;
69
+ error?: string;
70
+ }
71
+ export interface VCVerificationResult {
72
+ valid: boolean;
73
+ vc?: VerifiableCredential;
74
+ credential_subject?: BotchaCredentialSubject;
75
+ issuer?: string;
76
+ credential_id?: string;
77
+ issued_at?: string;
78
+ expires_at?: string;
79
+ error?: string;
80
+ }
81
+ /**
82
+ * Issue a W3C Verifiable Credential for a successful BOTCHA verification.
83
+ *
84
+ * The VC is encoded as a JWT-VC signed with BOTCHA's ES256 key.
85
+ * If no ES256 key is available, falls back to HS256.
86
+ *
87
+ * The JWT payload includes:
88
+ * iss = did:web:botcha.ai
89
+ * sub = agent DID or agent_id
90
+ * jti = credential ID (urn:botcha:vc:<uuid>)
91
+ * vc = the full JSON-LD credential object
92
+ * type = "botcha-vc" (BOTCHA-specific claim for quick type-checking)
93
+ */
94
+ export declare function issueVC(options: IssueVCOptions, signingKey?: ES256SigningKeyJWK, secret?: string): Promise<VCIssuanceResult>;
95
+ /**
96
+ * Verify a BOTCHA VC JWT.
97
+ *
98
+ * Checks (in order):
99
+ * 1. JWT signature (ES256 or HS256)
100
+ * 2. JWT expiration (exp claim)
101
+ * 3. Token type claim = "botcha-vc"
102
+ * 4. Issuer claim = "did:web:botcha.ai"
103
+ * 5. Presence of `vc` claim with credentialSubject
104
+ *
105
+ * Returns the decoded VC and credential subject if valid.
106
+ */
107
+ export declare function verifyVC(vcJwt: string, signingKey?: ES256SigningKeyJWK, secret?: string): Promise<VCVerificationResult>;
108
+ /**
109
+ * Extract the BOTCHA access_token payload from the Authorization header.
110
+ * Returns null if the token is missing or cannot be decoded (does NOT verify).
111
+ */
112
+ export declare function extractVCPayloadClaims(vcJwt: string): {
113
+ agent_id?: string;
114
+ app_id?: string;
115
+ solve_time_ms?: number;
116
+ challenge_type?: string;
117
+ trust_level?: string;
118
+ } | null;
119
+ declare const _default: {
120
+ issueVC: typeof issueVC;
121
+ verifyVC: typeof verifyVC;
122
+ extractVCPayloadClaims: typeof extractVCPayloadClaims;
123
+ };
124
+ export default _default;
125
+ //# sourceMappingURL=tap-vc.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tap-vc.d.ts","sourceRoot":"","sources":["../src/tap-vc.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAGH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAKpD,MAAM,WAAW,uBAAuB;IACtC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,OAAO,GAAG,UAAU,GAAG,YAAY,CAAC;IACjD,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;CACzB;AAED,MAAM,WAAW,oBAAoB;IACnC,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,iBAAiB,EAAE,uBAAuB,CAAC;IAC3C,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAA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