@vess-id/ai-identity 0.2.0 → 0.3.1

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 (90) hide show
  1. package/dist/agent/agent-did-manager.d.ts +50 -0
  2. package/dist/agent/agent-did-manager.d.ts.map +1 -0
  3. package/dist/auth/auth-provider.d.ts +51 -0
  4. package/dist/auth/auth-provider.d.ts.map +1 -0
  5. package/dist/auth/index.d.ts +2 -0
  6. package/dist/auth/index.d.ts.map +1 -0
  7. package/dist/client.d.ts +80 -0
  8. package/dist/client.d.ts.map +1 -0
  9. package/dist/config/index.d.ts +30 -0
  10. package/dist/config/index.d.ts.map +1 -0
  11. package/dist/constraint/__tests__/fixtures/constraint.fixtures.d.ts +56 -0
  12. package/dist/constraint/__tests__/fixtures/constraint.fixtures.d.ts.map +1 -0
  13. package/dist/constraint/constraint-evaluator.d.ts +72 -0
  14. package/dist/constraint/constraint-evaluator.d.ts.map +1 -0
  15. package/dist/constraint/index.d.ts +5 -0
  16. package/dist/constraint/index.d.ts.map +1 -0
  17. package/dist/did/agent.d.ts +52 -0
  18. package/dist/did/agent.d.ts.map +1 -0
  19. package/dist/did/did-utils.d.ts +75 -0
  20. package/dist/did/did-utils.d.ts.map +1 -0
  21. package/dist/did/key-manager.d.ts +19 -0
  22. package/dist/did/key-manager.d.ts.map +1 -0
  23. package/dist/gateway/gateway-client.d.ts +103 -0
  24. package/dist/gateway/gateway-client.d.ts.map +1 -0
  25. package/dist/gateway/index.d.ts +2 -0
  26. package/dist/gateway/index.d.ts.map +1 -0
  27. package/dist/grant/grant-manager.d.ts +140 -0
  28. package/dist/grant/grant-manager.d.ts.map +1 -0
  29. package/dist/grant/index.d.ts +2 -0
  30. package/dist/grant/index.d.ts.map +1 -0
  31. package/dist/identity/device-enroll-manager.d.ts +111 -0
  32. package/dist/identity/device-enroll-manager.d.ts.map +1 -0
  33. package/dist/identity/user-identity-manager.d.ts +69 -0
  34. package/dist/identity/user-identity-manager.d.ts.map +1 -0
  35. package/dist/identity/user-key-pair-manager.d.ts +22 -0
  36. package/dist/identity/user-key-pair-manager.d.ts.map +1 -0
  37. package/dist/index.d.ts +32 -3013
  38. package/dist/index.d.ts.map +1 -0
  39. package/dist/index.js +483 -45
  40. package/dist/index.js.map +1 -1
  41. package/dist/index.mjs +482 -49
  42. package/dist/index.mjs.map +1 -1
  43. package/dist/memory/memory-manager.d.ts +71 -0
  44. package/dist/memory/memory-manager.d.ts.map +1 -0
  45. package/dist/monitoring/metrics-manager.d.ts +74 -0
  46. package/dist/monitoring/metrics-manager.d.ts.map +1 -0
  47. package/dist/organization/disclosure-config-manager.d.ts +61 -0
  48. package/dist/organization/disclosure-config-manager.d.ts.map +1 -0
  49. package/dist/organization/key-rotation-manager.d.ts +63 -0
  50. package/dist/organization/key-rotation-manager.d.ts.map +1 -0
  51. package/dist/organization/organization-manager.d.ts +38 -0
  52. package/dist/organization/organization-manager.d.ts.map +1 -0
  53. package/dist/registry/access-orchestrator.d.ts +183 -0
  54. package/dist/registry/access-orchestrator.d.ts.map +1 -0
  55. package/dist/registry/action-registry-json.d.ts +1363 -0
  56. package/dist/registry/action-registry-json.d.ts.map +1 -0
  57. package/dist/registry/action-registry.d.ts +65 -0
  58. package/dist/registry/action-registry.d.ts.map +1 -0
  59. package/dist/registry/index.d.ts +4 -0
  60. package/dist/registry/index.d.ts.map +1 -0
  61. package/dist/revocation/revocation-manager.d.ts +98 -0
  62. package/dist/revocation/revocation-manager.d.ts.map +1 -0
  63. package/dist/state/index.d.ts +3 -0
  64. package/dist/state/index.d.ts.map +1 -0
  65. package/dist/state/json-state-store.d.ts +24 -0
  66. package/dist/state/json-state-store.d.ts.map +1 -0
  67. package/dist/state/state-store.interface.d.ts +37 -0
  68. package/dist/state/state-store.interface.d.ts.map +1 -0
  69. package/dist/storage/filesystem-key-storage.d.ts +16 -0
  70. package/dist/storage/filesystem-key-storage.d.ts.map +1 -0
  71. package/dist/storage/index.d.ts +4 -0
  72. package/dist/storage/index.d.ts.map +1 -0
  73. package/dist/storage/key-storage.interface.d.ts +42 -0
  74. package/dist/storage/key-storage.interface.d.ts.map +1 -0
  75. package/dist/storage/memory-key-storage.d.ts +17 -0
  76. package/dist/storage/memory-key-storage.d.ts.map +1 -0
  77. package/dist/tool/tool-manager.d.ts +44 -0
  78. package/dist/tool/tool-manager.d.ts.map +1 -0
  79. package/dist/utils/crypto.d.ts +22 -0
  80. package/dist/utils/crypto.d.ts.map +1 -0
  81. package/dist/utils/sdjwt-client.d.ts +168 -0
  82. package/dist/utils/sdjwt-client.d.ts.map +1 -0
  83. package/dist/vc/api-vc-manager.d.ts +40 -0
  84. package/dist/vc/api-vc-manager.d.ts.map +1 -0
  85. package/dist/vc/vc-manager.d.ts +55 -0
  86. package/dist/vc/vc-manager.d.ts.map +1 -0
  87. package/dist/vp/vp-manager.d.ts +40 -0
  88. package/dist/vp/vp-manager.d.ts.map +1 -0
  89. package/package.json +2 -2
  90. package/dist/index.d.mts +0 -3014
package/dist/index.d.ts CHANGED
@@ -1,3014 +1,33 @@
1
- import { VerifiablePresentation, VPRequest, Agent, DIDDocument, VCTemplate, ConnectorResponse, ToolPermissionRequest, OrganizationConfig, Grant, CreateGrantRequest, GrantStatus, CheckGrantPermissionRequest, CheckGrantPermissionResult, UpdateGrantRequest, CredentialType, IssueSDJWTVCRequest, IssueSDJWTVCResult, VerifySDJWTVCResult, GrantConstraints, EvaluationContext, ConstraintEvaluationResult, ConstraintViolation, ConstraintWarning, TimeWindowConstraint, RiskLevel } from '@vess-id/ai-identity-types';
1
+ export { AIdentityClient, getClient } from './client';
2
+ export { configure, AIdentityConfig } from './config';
3
+ export { AgentManager } from './did/agent';
4
+ export { KeyManager } from './did/key-manager';
5
+ export { AgentDIDManager } from './agent/agent-did-manager';
6
+ export { UserIdentityManager } from './identity/user-identity-manager';
7
+ export { UserKeyPairManager } from './identity/user-key-pair-manager';
8
+ export type { KeyPairGenerationResult } from './identity/user-key-pair-manager';
9
+ export { DeviceEnrollManager, DeviceEnrollStartParams, DeviceEnrollServerSideParams, DeviceEnrollStartResult, DeviceEnrollPollResult, } from './identity/device-enroll-manager';
10
+ export { VCManager } from './vc/vc-manager';
11
+ export { APIVCManager } from './vc/api-vc-manager';
12
+ export { VPManager } from './vp/vp-manager';
13
+ export { ToolManager, ToolDefinition } from './tool/tool-manager';
14
+ export { MemoryManager, MemoryDocument, MemoryQuery, MemoryQueryResult, } from './memory/memory-manager';
15
+ export { KeyRotationManager, KeyRotationConfig, KeyRotationInfo, } from './organization/key-rotation-manager';
16
+ export { DisclosureConfigManager, OrganizationDisclosureConfig, CredentialDisclosureConfig, } from './organization/disclosure-config-manager';
17
+ export { MetricsManager, SDJWTMetrics, OperationMetric } from './monitoring/metrics-manager';
18
+ export { RevocationManager, RevocationList, RevocationListEntry, CredentialStatusInfo, } from './revocation/revocation-manager';
19
+ export { ConstraintEvaluator, ConstraintEvaluatorOptions, defaultConstraintEvaluator, evaluateConstraints } from './constraint/constraint-evaluator';
20
+ export * from './storage';
21
+ export type { IStateStore } from './state/state-store.interface';
22
+ export { JsonStateStore } from './state/json-state-store';
23
+ export { GatewayClient, GatewayError, } from './gateway/gateway-client';
24
+ export type { GatewayEvent, GetEventsResponse, GetEventsOptions, AckEventResponse, ApiKeyValidationResult, } from './gateway/gateway-client';
25
+ export { AuthProvider } from './auth/auth-provider';
26
+ export type { AuthState } from './auth/auth-provider';
27
+ export * from './registry';
28
+ export { generateKeyPair, signJWT, verifyJWT, generateNonce } from './utils/crypto';
29
+ export { SDJwtClient } from './utils/sdjwt-client';
30
+ export { createDidJwk, extractPublicKey, extractPublicKeyFromDid, isValidDidJwk, getKeyIdFromDid, } from './did/did-utils';
2
31
  export * from '@vess-id/ai-identity-types';
3
- import * as jose from 'jose';
4
- import { JWK } from 'jose';
5
- import Ajv from 'ajv';
6
- import { SDJwtVcInstance } from '@sd-jwt/sd-jwt-vc';
7
- import { DisclosureFrame } from '@sd-jwt/types';
8
-
9
- /**
10
- * Interface for key storage persistence
11
- * Allows different storage backends (filesystem, database, memory, etc.)
12
- */
13
- interface KeyStorageProvider {
14
- /**
15
- * Store an encrypted key
16
- * @param id Unique identifier for the key (e.g., DID hash)
17
- * @param encryptedKey Encrypted key data
18
- */
19
- store(id: string, encryptedKey: string): Promise<void>;
20
- /**
21
- * Retrieve an encrypted key
22
- * @param id Unique identifier for the key
23
- * @returns Encrypted key data, or null if not found
24
- */
25
- retrieve(id: string): Promise<string | null>;
26
- /**
27
- * Delete a key
28
- * @param id Unique identifier for the key
29
- */
30
- delete(id: string): Promise<void>;
31
- /**
32
- * List all stored key identifiers
33
- * @returns Array of key identifiers
34
- */
35
- list(): Promise<string[]>;
36
- /**
37
- * Check if the storage is available and initialized
38
- */
39
- isAvailable(): Promise<boolean>;
40
- }
41
- /**
42
- * Configuration for key storage
43
- */
44
- interface KeyStorageConfig {
45
- /** Storage type identifier */
46
- type: string;
47
- /** Storage-specific options */
48
- options?: Record<string, any>;
49
- }
50
-
51
- /**
52
- * Filesystem-based key storage provider
53
- */
54
- declare class FilesystemKeyStorage implements KeyStorageProvider {
55
- private keyStorePath;
56
- constructor(config?: KeyStorageConfig);
57
- store(id: string, encryptedKey: string): Promise<void>;
58
- retrieve(id: string): Promise<string | null>;
59
- delete(id: string): Promise<void>;
60
- list(): Promise<string[]>;
61
- isAvailable(): Promise<boolean>;
62
- private ensureKeyStoreExists;
63
- private getKeyPath;
64
- }
65
-
66
- /**
67
- * In-memory key storage provider (for testing)
68
- */
69
- declare class MemoryKeyStorage implements KeyStorageProvider {
70
- private keys;
71
- store(id: string, encryptedKey: string): Promise<void>;
72
- retrieve(id: string): Promise<string | null>;
73
- delete(id: string): Promise<void>;
74
- list(): Promise<string[]>;
75
- isAvailable(): Promise<boolean>;
76
- /**
77
- * Clear all stored keys (for testing)
78
- */
79
- clear(): void;
80
- }
81
-
82
- declare class KeyManager {
83
- private encryptionKey?;
84
- private storageProvider;
85
- constructor(password?: string, storageProvider?: KeyStorageProvider);
86
- private createDefaultStorageProvider;
87
- storeKey(did: string, privateKey: any): Promise<void>;
88
- getKey(did: string): Promise<any | null>;
89
- deleteKey(did: string): Promise<void>;
90
- listDids(): Promise<string[]>;
91
- /**
92
- * Check if storage is available
93
- */
94
- isAvailable(): Promise<boolean>;
95
- private didFromKeyId;
96
- private encrypt;
97
- private decrypt;
98
- }
99
-
100
- declare class VPManager {
101
- private keyManager;
102
- constructor(keyManager?: KeyManager);
103
- /**
104
- * Create a SD-JWT presentation using the present() method
105
- * This properly binds the holder's key to the SD-JWT VC
106
- */
107
- create(vcs: string[], // Array of SD-JWT VC strings
108
- options: {
109
- holderDid: string;
110
- challenge: string;
111
- domain: string;
112
- purpose?: string;
113
- }): Promise<string>;
114
- /**
115
- * Verify a Verifiable Presentation
116
- */
117
- verify(vpJwt: string, options: {
118
- expectedChallenge: string;
119
- expectedDomain: string;
120
- expectedHolder?: string;
121
- }): Promise<VerifiablePresentation>;
122
- /**
123
- * Create a VP request
124
- */
125
- createRequest(domain: string, query?: {
126
- type?: string;
127
- credentialQuery?: any;
128
- }): VPRequest;
129
- /**
130
- * Submit VP to a verifier
131
- */
132
- submit(vpJwt: string, verifierEndpoint: string): Promise<{
133
- verified: boolean;
134
- result?: any;
135
- }>;
136
- }
137
-
138
- interface MemoryDocument {
139
- id: string;
140
- namespace: string;
141
- content: string;
142
- metadata?: Record<string, any>;
143
- embedding?: number[];
144
- createdAt: string;
145
- updatedAt: string;
146
- }
147
- interface MemoryQuery {
148
- query: string;
149
- namespace?: string;
150
- limit?: number;
151
- filter?: Record<string, any>;
152
- includeEmbedding?: boolean;
153
- }
154
- interface MemoryQueryResult {
155
- documents: MemoryDocument[];
156
- scores?: number[];
157
- total: number;
158
- }
159
- declare class MemoryManager {
160
- private vpManager;
161
- private proxyApiUrl;
162
- constructor(vpManager?: VPManager);
163
- /**
164
- * Write a document to memory
165
- */
166
- write(content: string, options: {
167
- namespace: string;
168
- metadata?: Record<string, any>;
169
- vcs: string[];
170
- holderDid: string;
171
- }): Promise<MemoryDocument>;
172
- /**
173
- * Query memory with vector search
174
- */
175
- query(query: string, options: {
176
- namespace?: string;
177
- limit?: number;
178
- filter?: Record<string, any>;
179
- vcs: string[];
180
- holderDid: string;
181
- }): Promise<MemoryQueryResult>;
182
- /**
183
- * Delete a document from memory
184
- */
185
- delete(documentId: string, options: {
186
- namespace: string;
187
- vcs: string[];
188
- holderDid: string;
189
- }): Promise<void>;
190
- /**
191
- * List documents in a namespace
192
- */
193
- list(options: {
194
- namespace: string;
195
- limit?: number;
196
- offset?: number;
197
- vcs: string[];
198
- holderDid: string;
199
- }): Promise<MemoryQueryResult>;
200
- /**
201
- * Check if VCs authorize memory access
202
- */
203
- checkAuthorization(vcs: string[], action: 'read' | 'write' | 'delete', resource: string): Promise<boolean>;
204
- private matchResource;
205
- private generateChallenge;
206
- }
207
-
208
- interface AIdentityConfig {
209
- didApi?: {
210
- baseUrl: string;
211
- apiKey?: string;
212
- bearerToken?: string;
213
- };
214
- issuerApi?: {
215
- baseUrl: string;
216
- apiKey?: string;
217
- bearerToken?: string;
218
- };
219
- verifierApi?: {
220
- baseUrl: string;
221
- apiKey?: string;
222
- bearerToken?: string;
223
- };
224
- proxyApi?: {
225
- baseUrl: string;
226
- };
227
- storage?: {
228
- keyStorePath?: string;
229
- };
230
- }
231
- declare function configure(config: AIdentityConfig): void;
232
-
233
- declare class AgentManager {
234
- private keyManager;
235
- private agentDIDManager;
236
- constructor(keyManager?: KeyManager);
237
- /**
238
- * Create a new AI agent with unique ID and DID
239
- */
240
- create(metadata?: Record<string, any>): Promise<Agent & {
241
- id: string;
242
- }>;
243
- /**
244
- * Get agent DID by agent ID
245
- */
246
- getAgentDID(agentId: string): Promise<string>;
247
- /**
248
- * Get agent by ID
249
- */
250
- getAgent(agentId: string): Promise<Agent & {
251
- id: string;
252
- }>;
253
- /**
254
- * Delete an agent and its DID
255
- */
256
- deleteAgent(agentId: string): Promise<void>;
257
- /**
258
- * Resolve a DID to get DID Document
259
- */
260
- resolve(did: string): Promise<DIDDocument>;
261
- /**
262
- * Export agent with private key (for backup)
263
- */
264
- export(did: string): Promise<{
265
- agent: Agent;
266
- privateKey: any;
267
- }>;
268
- /**
269
- * Import agent from backup
270
- */
271
- import(agent: Agent, privateKey: any): Promise<void>;
272
- /**
273
- * List all locally stored agents
274
- */
275
- list(): Promise<Array<Agent & {
276
- id: string;
277
- }>>;
278
- private createDidDocument;
279
- private resolveDidJwkLocally;
280
- private registerDid;
281
- }
282
-
283
- /**
284
- * User Identity Manager
285
- * Manages DID generation and lifecycle for Users (Issuers) specifically
286
- * Separate from Agent management to avoid confusion
287
- */
288
- declare class UserIdentityManager {
289
- private keyManager;
290
- private currentUserDID;
291
- constructor(keyManager?: KeyManager);
292
- /**
293
- * Get or create current user DID
294
- * This represents the user who will be the issuer of VCs
295
- */
296
- getCurrentUserDID(): Promise<string>;
297
- /**
298
- * Create a new user DID (for issuing VCs)
299
- */
300
- createUserDID(): Promise<string>;
301
- /**
302
- * Get user's key pair
303
- */
304
- getUserKeyPair(): Promise<any>;
305
- /**
306
- * Resolve user DID to DID Document
307
- */
308
- resolveUserDID(did?: string): Promise<DIDDocument>;
309
- /**
310
- * Export user identity for backup
311
- */
312
- exportUserIdentity(): Promise<{
313
- did: string;
314
- privateKey: any;
315
- didDocument: DIDDocument;
316
- }>;
317
- /**
318
- * Import user identity from backup
319
- */
320
- importUserIdentity(backup: {
321
- did: string;
322
- privateKey: any;
323
- }): Promise<void>;
324
- /**
325
- * Reset user identity (create new DID)
326
- */
327
- resetUserIdentity(): Promise<string>;
328
- /**
329
- * Resolve did:jwk locally
330
- */
331
- private resolveDidJwkLocally;
332
- /**
333
- * Create DID Document
334
- */
335
- private createDidDocument;
336
- /**
337
- * Save current user DID to persistent storage
338
- */
339
- private saveUserDID;
340
- /**
341
- * Load current user DID from persistent storage
342
- */
343
- private loadUserDID;
344
- /**
345
- * Clear saved user DID
346
- */
347
- private clearUserDID;
348
- }
349
-
350
- declare class VCManager {
351
- private keyManager;
352
- private templates;
353
- private agentManager;
354
- private userIdentityManager;
355
- constructor(keyManager?: KeyManager, agentManager?: AgentManager, userIdentityManager?: UserIdentityManager);
356
- /**
357
- * Get fields that should be selectively disclosable based on VC type
358
- */
359
- private getSelectivelyDisclosableFields;
360
- /**
361
- * Issue a Verifiable Credential as SD-JWT VC
362
- * Enhanced to support User/Agent DID separation
363
- */
364
- issue(template: string, claims: any, options: {
365
- issuerDid?: string;
366
- subjectDid?: string;
367
- agentId?: string;
368
- expiresIn?: string;
369
- }): Promise<string>;
370
- /**
371
- * Get subject's public key for cnf claim
372
- */
373
- private getSubjectPublicKey;
374
- /**
375
- * Issue using existing Issuer API (OID4VCI)
376
- */
377
- issueViaAPI(credentialType: string, claims: any, options: {
378
- issuerDid: string;
379
- subjectDid: string;
380
- }): Promise<string>;
381
- /**
382
- * Verify a SD-JWT VC
383
- */
384
- verify(sdjwtVc: string, options?: {
385
- expectedIssuer?: string;
386
- expectedSubject?: string;
387
- requiredClaims?: string[];
388
- }): Promise<any>;
389
- /**
390
- * Revoke a Verifiable Credential
391
- */
392
- revoke(_vcId: string, _issuerDid: string): Promise<void>;
393
- /**
394
- * Register a custom VC template
395
- */
396
- registerTemplate(template: VCTemplate): void;
397
- private registerDefaultTemplates;
398
- private calculateExpirationDate;
399
- }
400
-
401
- interface ToolDefinition {
402
- name: string;
403
- description: string;
404
- actions: {
405
- name: string;
406
- description: string;
407
- parameters: Record<string, any>;
408
- }[];
409
- }
410
- declare class ToolManager {
411
- private vpManager;
412
- private tools;
413
- private proxyApiUrl;
414
- constructor(vpManager?: VPManager);
415
- /**
416
- * Invoke a tool action with VC authorization
417
- */
418
- invoke<T = any>(tool: string, action: string, params: Record<string, any>, options: {
419
- vcs: string[];
420
- holderDid: string;
421
- }): Promise<ConnectorResponse<T>>;
422
- /**
423
- * List available tools
424
- */
425
- list(): ToolDefinition[];
426
- /**
427
- * Get a specific tool definition
428
- */
429
- getTool(name: string): ToolDefinition | undefined;
430
- /**
431
- * Register a custom tool
432
- */
433
- registerTool(tool: ToolDefinition): void;
434
- /**
435
- * Check if VCs authorize a tool action
436
- */
437
- checkAuthorization(vcs: string[], tool: string, action: string, resourceScope?: Record<string, any>): Promise<boolean>;
438
- private matchScope;
439
- private generateChallenge;
440
- private registerDefaultTools;
441
- }
442
-
443
- declare class OrganizationManager {
444
- private vpManager;
445
- private vcManager;
446
- private apiBaseUrl;
447
- constructor(vpManager?: VPManager, vcManager?: VCManager);
448
- /**
449
- * Request tool permissions using employee VC
450
- */
451
- requestToolPermissions(employeeVCJWT: string, requestedTools: ToolPermissionRequest[], holderDid: string): Promise<{
452
- permittedPermissions: ToolPermissionRequest[];
453
- employee: any;
454
- }>;
455
- /**
456
- * Issue tool permissions to AI Agent based on organization approval
457
- */
458
- issueOrganizationDelegatedPermissions(agentDid: string, employeeVCJWT: string, requestedTools: ToolPermissionRequest[], issuerDid: string): Promise<string[]>;
459
- /**
460
- * Create simplified workflow for employee to AI Agent delegation
461
- */
462
- delegateToAIAgent(employeeVCJWT: string, agentDid: string, tools: string[], // ['slack', 'gmail', 'github']
463
- issuerDid: string, options?: {
464
- duration?: string;
465
- justification?: string;
466
- }): Promise<{
467
- issuedVCs: string[];
468
- permissionSummary: Record<string, string[]>;
469
- }>;
470
- /**
471
- * Register organization with AIdentity
472
- */
473
- registerOrganization(config: OrganizationConfig): Promise<void>;
474
- private generateChallenge;
475
- private extractActionFromVC;
476
- }
477
-
478
- /**
479
- * Grant提案レスポンス
480
- */
481
- interface GrantSuggestion {
482
- id: string;
483
- oauthTokenId: string;
484
- userId?: string;
485
- projectId: string;
486
- provider: string;
487
- suggestedActions: string[];
488
- suggestedResources: Array<{
489
- type: string;
490
- id?: string;
491
- pattern?: string;
492
- name?: string;
493
- }>;
494
- metadata: {
495
- providerInfo: any;
496
- scopes: string[];
497
- };
498
- createdAt: string;
499
- }
500
- /**
501
- * Grant提案確認リクエスト
502
- */
503
- interface ConfirmGrantRequest {
504
- suggestionId: string;
505
- selectedActions: string[];
506
- selectedResources: Array<{
507
- type: string;
508
- id?: string;
509
- pattern?: string;
510
- name?: string;
511
- selected: boolean;
512
- }>;
513
- constraints: {
514
- maxInvocations?: number;
515
- expiresAt?: string;
516
- timeWindow?: {
517
- start: string;
518
- end: string;
519
- timezone: string;
520
- daysOfWeek: number[];
521
- };
522
- };
523
- name?: string;
524
- description?: string;
525
- }
526
- /**
527
- * GrantManager
528
- * Grants APIを操作するSDKクライアント
529
- */
530
- declare class GrantManager {
531
- constructor(_vpManager: VPManager);
532
- /**
533
- * Grant提案を取得
534
- * @param options - 提案オプション
535
- * @param options.oauthTokenId - OAuthトークンID
536
- * @param options.userId - 対象ユーザーID
537
- * @param options.projectId - プロジェクトID
538
- * @param authOptions - 認証オプション(VP or issuerDid)
539
- */
540
- suggest(options: {
541
- oauthTokenId: string;
542
- userId: string;
543
- projectId: string;
544
- }, authOptions: {
545
- vpJwt?: string;
546
- issuerDid?: string;
547
- }): Promise<GrantSuggestion>;
548
- /**
549
- * Grant提案を確認して作成
550
- * @param request - 確認リクエスト
551
- * @param authOptions - 認証オプション
552
- */
553
- confirm(request: ConfirmGrantRequest, authOptions: {
554
- vpJwt?: string;
555
- issuerDid?: string;
556
- }): Promise<Grant>;
557
- /**
558
- * Grantを直接作成
559
- * @param request - Grant作成リクエスト
560
- * @param authOptions - 認証オプション
561
- */
562
- create(request: CreateGrantRequest, authOptions: {
563
- vpJwt?: string;
564
- issuerDid?: string;
565
- }): Promise<Grant>;
566
- /**
567
- * ユーザー用のGrant一覧を取得
568
- * @param userId - ユーザーID
569
- * @param status - フィルタするステータス(オプション)
570
- */
571
- listForUser(userId: string, status?: GrantStatus): Promise<{
572
- grants: Grant[];
573
- total: number;
574
- }>;
575
- /**
576
- * Issuer用のGrant一覧を取得
577
- * @param issuerDid - IssuerのDID
578
- * @param status - フィルタするステータス(オプション)
579
- */
580
- listForIssuer(issuerDid: string, status?: GrantStatus): Promise<{
581
- grants: Grant[];
582
- total: number;
583
- }>;
584
- /**
585
- * Grantを取得
586
- * @param grantId - GrantのID
587
- */
588
- get(grantId: string): Promise<Grant>;
589
- /**
590
- * Grantを取り消し
591
- * @param grantId - GrantのID
592
- * @param reason - 取り消し理由
593
- * @param authOptions - 認証オプション
594
- */
595
- revoke(grantId: string, reason: string, authOptions: {
596
- vpJwt?: string;
597
- issuerDid?: string;
598
- }): Promise<Grant>;
599
- /**
600
- * Grant権限をチェック
601
- * @param request - 権限チェックリクエスト
602
- */
603
- checkPermission(request: CheckGrantPermissionRequest): Promise<CheckGrantPermissionResult>;
604
- /**
605
- * Grant更新
606
- * @param grantId - GrantのID
607
- * @param request - 更新リクエスト
608
- * @param authOptions - 認証オプション
609
- */
610
- update(grantId: string, request: UpdateGrantRequest, authOptions: {
611
- vpJwt?: string;
612
- issuerDid?: string;
613
- }): Promise<Grant>;
614
- }
615
-
616
- declare class AIdentityClient {
617
- readonly agent: AgentManager;
618
- readonly user: UserIdentityManager;
619
- readonly vc: VCManager;
620
- readonly vp: VPManager;
621
- readonly tool: ToolManager;
622
- readonly memory: MemoryManager;
623
- readonly organization: OrganizationManager;
624
- readonly grant: GrantManager;
625
- private keyManager;
626
- private currentAgent?;
627
- constructor(config?: AIdentityConfig, password?: string);
628
- /**
629
- * Quick setup: Create or load an agent
630
- */
631
- setup(did?: string): Promise<Agent>;
632
- /**
633
- * Get current agent
634
- */
635
- getCurrentAgent(): Agent | undefined;
636
- /**
637
- * Get current user DID
638
- */
639
- getCurrentUserDID(): Promise<string>;
640
- /**
641
- * Create or reset user identity
642
- */
643
- resetUserIdentity(): Promise<string>;
644
- /**
645
- * Issue a VC for tool permission
646
- * Enhanced to support User → Agent delegation pattern
647
- */
648
- issueToolPermission(tool: string, action: string, options: {
649
- subjectDid?: string;
650
- agentId?: string;
651
- issuerDid?: string;
652
- resourceScope?: Record<string, any>;
653
- expiresIn?: string;
654
- }): Promise<string>;
655
- /**
656
- * Issue a VC for data access
657
- * Enhanced to support User → Agent delegation pattern
658
- */
659
- issueDataAccess(resource: string, actions: ('read' | 'write' | 'delete')[], options: {
660
- subjectDid?: string;
661
- agentId?: string;
662
- issuerDid?: string;
663
- expiresIn?: string;
664
- }): Promise<string>;
665
- /**
666
- * Invoke a tool with automatic VP creation
667
- */
668
- invokeTool<T = any>(tool: string, action: string, params: Record<string, any>, vcs: string[]): Promise<ConnectorResponse<T>>;
669
- /**
670
- * Write to memory with automatic VP creation
671
- */
672
- writeMemory(content: string, namespace: string, vcs: string[], metadata?: Record<string, any>): Promise<MemoryDocument>;
673
- /**
674
- * Query memory with automatic VP creation
675
- */
676
- queryMemory(query: string, vcs: string[], options?: {
677
- namespace?: string;
678
- limit?: number;
679
- filter?: Record<string, any>;
680
- }): Promise<MemoryQueryResult>;
681
- }
682
- declare function getClient(config?: AIdentityConfig, password?: string): AIdentityClient;
683
-
684
- /**
685
- * Agent DID Manager
686
- * Manages DID generation and lifecycle for AI Agents specifically
687
- */
688
- declare class AgentDIDManager {
689
- private keyManager;
690
- private agentDIDMap;
691
- constructor(keyManager?: KeyManager);
692
- /**
693
- * Generate a new DID for an AI Agent
694
- */
695
- generateAgentDID(agentId: string): Promise<string>;
696
- /**
697
- * Get DID for a specific agent
698
- */
699
- getAgentDID(agentId: string): Promise<string>;
700
- /**
701
- * Check if agent has a DID
702
- */
703
- hasAgentDID(agentId: string): Promise<boolean>;
704
- /**
705
- * Get agent's key pair
706
- */
707
- getAgentKeyPair(agentId: string): Promise<any>;
708
- /**
709
- * Delete agent DID and associated keys
710
- */
711
- deleteAgentDID(agentId: string): Promise<void>;
712
- /**
713
- * List all agent DIDs
714
- */
715
- listAgentDIDs(): Promise<Array<{
716
- agentId: string;
717
- did: string;
718
- }>>;
719
- /**
720
- * Save agent ID -> DID mapping to persistent storage
721
- */
722
- private saveAgentDIDMapping;
723
- /**
724
- * Load agent ID -> DID mapping from persistent storage
725
- */
726
- private loadAgentDIDMapping;
727
- /**
728
- * Delete agent ID -> DID mapping from persistent storage
729
- */
730
- private deleteAgentDIDMapping;
731
- }
732
-
733
- interface KeyPairGenerationResult {
734
- did: string;
735
- publicKey: JWK;
736
- privateKey: JWK;
737
- }
738
- declare class UserKeyPairManager {
739
- generateKeyPair(): Promise<KeyPairGenerationResult>;
740
- extractPublicKeyInfo(did: string): JWK;
741
- }
742
-
743
- interface OrganizationDisclosureConfig {
744
- organizationDid: string;
745
- defaultFields: string[];
746
- credentialTypeConfigs: Map<CredentialType, CredentialDisclosureConfig>;
747
- createdAt: Date;
748
- updatedAt: Date;
749
- }
750
- interface CredentialDisclosureConfig {
751
- type: CredentialType;
752
- mandatoryFields: string[];
753
- selectiveFields: string[];
754
- neverDisclose: string[];
755
- decoyFields?: number;
756
- }
757
- declare class DisclosureConfigManager {
758
- private configs;
759
- /**
760
- * Set disclosure configuration for an organization
761
- */
762
- setOrganizationConfig(organizationDid: string, config: Partial<OrganizationDisclosureConfig>): Promise<void>;
763
- /**
764
- * Get disclosure configuration for an organization
765
- */
766
- getOrganizationConfig(organizationDid: string): Promise<OrganizationDisclosureConfig | null>;
767
- /**
768
- * Set credential type specific disclosure configuration
769
- */
770
- setCredentialTypeConfig(organizationDid: string, credentialType: CredentialType, config: CredentialDisclosureConfig): Promise<void>;
771
- /**
772
- * Get selective disclosure fields for a specific credential type and organization
773
- */
774
- getSelectiveDisclosureFields(organizationDid: string, credentialType: CredentialType, requestedFields?: string[]): Promise<{
775
- selectiveFields: string[];
776
- mandatoryFields: string[];
777
- neverDisclose: string[];
778
- decoyCount: number;
779
- }>;
780
- /**
781
- * Get default configuration for credential types
782
- */
783
- private getDefaultConfiguration;
784
- /**
785
- * Validate disclosure request against organization policy
786
- */
787
- validateDisclosureRequest(organizationDid: string, credentialType: CredentialType, requestedFields: string[]): Promise<{
788
- valid: boolean;
789
- allowedFields: string[];
790
- rejectedFields: string[];
791
- errors: string[];
792
- }>;
793
- /**
794
- * Get all organization configurations (for admin purposes)
795
- */
796
- getAllConfigurations(): Promise<OrganizationDisclosureConfig[]>;
797
- /**
798
- * Delete organization configuration
799
- */
800
- deleteOrganizationConfig(organizationDid: string): Promise<boolean>;
801
- }
802
-
803
- /**
804
- * API-focused VC Manager for server-side operations
805
- * Provides stateless SD-JWT operations without local persistence
806
- */
807
- declare class APIVCManager {
808
- private keyManager;
809
- private disclosureManager;
810
- constructor(keyManager?: KeyManager, disclosureManager?: DisclosureConfigManager);
811
- /**
812
- * Issue an SD-JWT VC with selective disclosure
813
- */
814
- issueSDJWTVC(request: IssueSDJWTVCRequest): Promise<IssueSDJWTVCResult>;
815
- /**
816
- * Verify an SD-JWT VC
817
- */
818
- verifySDJWTVC(credential: string): Promise<VerifySDJWTVCResult>;
819
- /**
820
- * Issue a project access credential
821
- */
822
- issueProjectAccessCredential(agentDid: string, projectId: string, permissions: string[], issuerDid: string, expirationHours?: number): Promise<IssueSDJWTVCResult>;
823
- /**
824
- * Issue a tool access credential
825
- */
826
- issueToolAccessCredential(agentDid: string, toolName: string, actions: string[], projectId: string, issuerDid: string, expirationHours?: number): Promise<IssueSDJWTVCResult>;
827
- /**
828
- * Issue a multi-tool access credential
829
- */
830
- issueMultiToolCredential(agentDid: string, toolPermissions: Array<{
831
- tool: string;
832
- actions: string[];
833
- }>, projectId: string, issuerDid: string, expirationHours?: number): Promise<IssueSDJWTVCResult>;
834
- /**
835
- * Issue an admin credential
836
- */
837
- issueAdminCredential(agentDid: string, scope: 'project' | 'global', projectId: string | undefined, issuerDid: string, expirationHours?: number): Promise<IssueSDJWTVCResult>;
838
- }
839
-
840
- interface KeyRotationConfig {
841
- /** How often keys should be rotated (in hours) */
842
- rotationInterval: number;
843
- /** How many old keys to keep for verification */
844
- keepOldKeys: number;
845
- /** Warning threshold before rotation (in hours) */
846
- warningThreshold: number;
847
- }
848
- interface KeyRotationInfo {
849
- currentKeyId: string;
850
- nextRotationDate: Date;
851
- oldKeys: Array<{
852
- keyId: string;
853
- rotatedAt: Date;
854
- expiresAt: Date;
855
- }>;
856
- needsRotation: boolean;
857
- warningActive: boolean;
858
- }
859
- declare class KeyRotationManager {
860
- private keyManager;
861
- private config;
862
- constructor(keyManager: KeyManager, config?: Partial<KeyRotationConfig>);
863
- /**
864
- * Check if organization keys need rotation
865
- */
866
- checkRotationStatus(organizationDid: string): Promise<KeyRotationInfo>;
867
- /**
868
- * Rotate organization keys
869
- * NOTE: Currently not implemented for did:jwk
870
- */
871
- rotateOrganizationKeys(organizationDid: string): Promise<{
872
- newDid: string;
873
- newPrivateKey: any;
874
- rotationDate: Date;
875
- }>;
876
- /**
877
- * Get old keys for verification (useful for grace periods)
878
- */
879
- getOldKeysForVerification(organizationDid: string): Promise<Array<{
880
- keyId: string;
881
- publicKey: any;
882
- validUntil: Date;
883
- }>>;
884
- /**
885
- * Plan future key rotation (for did:web or other mutable DID methods)
886
- */
887
- planKeyRotation(organizationDid: string): Promise<{
888
- plannedRotationDate: Date;
889
- currentKeyAge: number;
890
- recommendedAction: 'none' | 'prepare' | 'rotate_now' | 'urgent';
891
- }>;
892
- /**
893
- * Update rotation configuration
894
- */
895
- updateConfig(newConfig: Partial<KeyRotationConfig>): void;
896
- /**
897
- * Get current configuration
898
- */
899
- getConfig(): KeyRotationConfig;
900
- }
901
-
902
- interface SDJWTMetrics {
903
- issuanceCount: number;
904
- verificationCount: number;
905
- failedIssuances: number;
906
- failedVerifications: number;
907
- averageIssuanceTime: number;
908
- averageVerificationTime: number;
909
- cacheHitRate: number;
910
- lastActivity: Date;
911
- }
912
- interface OperationMetric {
913
- operation: 'issue' | 'verify';
914
- startTime: number;
915
- endTime: number;
916
- success: boolean;
917
- error?: string;
918
- issuerDid?: string;
919
- credentialType?: string;
920
- }
921
- declare class MetricsManager {
922
- private metrics;
923
- private operations;
924
- private maxOperationHistory;
925
- /**
926
- * Start tracking an operation
927
- */
928
- startOperation(operation: 'issue' | 'verify', metadata?: Record<string, any>): string;
929
- /**
930
- * End tracking an operation
931
- */
932
- endOperation(_operationId: string, success: boolean, error?: string): void;
933
- /**
934
- * Update aggregated metrics
935
- */
936
- private updateMetrics;
937
- /**
938
- * Get metrics for a specific issuer or global
939
- */
940
- getMetrics(issuerDid?: string): SDJWTMetrics | null;
941
- /**
942
- * Get all metrics
943
- */
944
- getAllMetrics(): Map<string, SDJWTMetrics>;
945
- /**
946
- * Get recent operations
947
- */
948
- getRecentOperations(limit?: number): OperationMetric[];
949
- /**
950
- * Get operation statistics
951
- */
952
- getOperationStats(): {
953
- totalOperations: number;
954
- successRate: number;
955
- averageResponseTime: number;
956
- operationsPerMinute: number;
957
- };
958
- /**
959
- * Update cache hit rate
960
- */
961
- updateCacheHitRate(issuerDid: string, hit: boolean): void;
962
- /**
963
- * Reset metrics
964
- */
965
- resetMetrics(issuerDid?: string): void;
966
- /**
967
- * Export metrics as JSON
968
- */
969
- exportMetrics(): {
970
- aggregatedMetrics: Record<string, SDJWTMetrics>;
971
- recentOperations: OperationMetric[];
972
- summary: ReturnType<any>;
973
- };
974
- }
975
-
976
- interface RevocationListEntry {
977
- credentialId: string;
978
- revocationDate: Date;
979
- reason?: string;
980
- revokedBy: string;
981
- }
982
- interface RevocationList {
983
- id: string;
984
- issuer: string;
985
- type: 'StatusList2021' | 'BitStringStatusList';
986
- statusPurpose: 'revocation' | 'suspension';
987
- encodedList: string;
988
- entries: RevocationListEntry[];
989
- createdAt: Date;
990
- updatedAt: Date;
991
- }
992
- interface CredentialStatusInfo {
993
- id: string;
994
- type: string;
995
- statusListIndex: number;
996
- statusListCredential: string;
997
- revocationReason?: string;
998
- revocationDate?: Date;
999
- }
1000
- declare class RevocationManager {
1001
- private revocationLists;
1002
- private credentialStatuses;
1003
- /**
1004
- * Create a new revocation list
1005
- */
1006
- createRevocationList(issuer: string, type?: 'StatusList2021' | 'BitStringStatusList', purpose?: 'revocation' | 'suspension'): Promise<RevocationList>;
1007
- /**
1008
- * Add credential to revocation list
1009
- */
1010
- addCredentialToRevocationList(credentialId: string, listId: string, statusIndex?: number): Promise<CredentialStatusInfo>;
1011
- /**
1012
- * Revoke a credential
1013
- */
1014
- revokeCredential(credentialId: string, reason?: string, revokedBy?: string): Promise<boolean>;
1015
- /**
1016
- * Check if credential is revoked
1017
- */
1018
- isCredentialRevoked(credentialId: string): Promise<{
1019
- revoked: boolean;
1020
- reason?: string;
1021
- revokedDate?: Date;
1022
- revokedBy?: string;
1023
- }>;
1024
- /**
1025
- * Get credential status info
1026
- */
1027
- getCredentialStatus(credentialId: string): Promise<CredentialStatusInfo | null>;
1028
- /**
1029
- * Get revocation list
1030
- */
1031
- getRevocationList(listId: string): Promise<RevocationList | null>;
1032
- /**
1033
- * Get all revocation lists for an issuer
1034
- */
1035
- getIssuerRevocationLists(issuer: string): Promise<RevocationList[]>;
1036
- /**
1037
- * Restore/unreovke a credential
1038
- */
1039
- restoreCredential(credentialId: string): Promise<boolean>;
1040
- /**
1041
- * Create empty bit string
1042
- */
1043
- private createEmptyBitString;
1044
- /**
1045
- * Set bit in encoded string
1046
- */
1047
- private setBitInString;
1048
- /**
1049
- * Get bit from encoded string
1050
- */
1051
- private getBitFromString;
1052
- /**
1053
- * Find next available index in revocation list
1054
- */
1055
- private findNextAvailableIndex;
1056
- /**
1057
- * Export revocation list in standard format
1058
- */
1059
- exportRevocationList(listId: string): Promise<{
1060
- '@context': string[];
1061
- id: string;
1062
- type: string[];
1063
- issuer: string;
1064
- validFrom: string;
1065
- credentialSubject: {
1066
- id: string;
1067
- type: string;
1068
- statusPurpose: string;
1069
- encodedList: string;
1070
- };
1071
- } | null>;
1072
- }
1073
-
1074
- /**
1075
- * ConstraintEvaluator
1076
- * Grant制約の評価ロジック
1077
- */
1078
-
1079
- interface ConstraintEvaluatorOptions {
1080
- /** 警告を発する残り実行回数の閾値 */
1081
- invocationWarningThreshold?: number;
1082
- /** 警告を発するリスクスコアの閾値(riskThresholdに対する割合) */
1083
- riskWarningRatio?: number;
1084
- /** デフォルトタイムゾーン */
1085
- defaultTimezone?: string;
1086
- }
1087
- /**
1088
- * 制約評価クラス
1089
- */
1090
- declare class ConstraintEvaluator {
1091
- private options;
1092
- constructor(options?: Partial<ConstraintEvaluatorOptions>);
1093
- /**
1094
- * 制約を総合評価
1095
- */
1096
- evaluate(constraints: GrantConstraints, context: EvaluationContext, currentInvocations: number, expiresAt?: Date): ConstraintEvaluationResult;
1097
- /**
1098
- * 期限チェック
1099
- */
1100
- checkExpiration(grantExpiresAt?: Date, constraintExpiresAt?: string): {
1101
- violation?: ConstraintViolation;
1102
- };
1103
- /**
1104
- * 実行回数チェック
1105
- */
1106
- checkInvocationLimit(maxInvocations?: number, currentInvocations?: number): {
1107
- violation?: ConstraintViolation;
1108
- warning?: ConstraintWarning;
1109
- };
1110
- /**
1111
- * 時間帯チェック
1112
- */
1113
- checkTimeWindow(timeWindow: TimeWindowConstraint, currentTime: Date): {
1114
- violation?: ConstraintViolation;
1115
- warning?: ConstraintWarning;
1116
- };
1117
- /**
1118
- * IPアドレスチェック
1119
- */
1120
- checkIpAllowlist(allowlist: string[], ipAddress: string): {
1121
- violation?: ConstraintViolation;
1122
- };
1123
- /**
1124
- * リスクスコアチェック
1125
- */
1126
- checkRiskThreshold(threshold: number, currentScore: number): {
1127
- violation?: ConstraintViolation;
1128
- warning?: ConstraintWarning;
1129
- };
1130
- private getDayOfWeekInTimezone;
1131
- private getTimeInTimezone;
1132
- private getDayName;
1133
- private timeToMinutes;
1134
- private isIpInCidr;
1135
- private ipToNumber;
1136
- }
1137
- /**
1138
- * デフォルトのConstraintEvaluatorインスタンス
1139
- */
1140
- declare const defaultConstraintEvaluator: ConstraintEvaluator;
1141
- /**
1142
- * 簡易評価関数
1143
- */
1144
- declare function evaluateConstraints(constraints: GrantConstraints, context: EvaluationContext, currentInvocations: number, expiresAt?: Date): ConstraintEvaluationResult;
1145
-
1146
- type Relation = 'viewer' | 'editor' | 'admin' | 'owner' | 'act_as';
1147
- /** MVPの対象リソース(必要に応じて拡張) */
1148
- type ResourceType = 'SlackChannel' | 'GitHubRepo' | 'DriveFile';
1149
- /** JSON Schema を受け取るための型。Ajvで別途メタ検証します。 */
1150
- type JsonSchema = Record<string, unknown>;
1151
- interface ActionMeta {
1152
- action: string;
1153
- resource_type: ResourceType;
1154
- required_relations: Relation[];
1155
- required_scopes: string[];
1156
- capability?: string;
1157
- input_schema?: JsonSchema;
1158
- constraints?: Record<string, unknown>;
1159
- effects?: string[];
1160
- risk?: RiskLevel;
1161
- version: string;
1162
- }
1163
- interface CapabilityMeta {
1164
- capability: string;
1165
- description?: string;
1166
- includes: string[];
1167
- version: string;
1168
- }
1169
- interface ActionRegistry {
1170
- registry_version: string;
1171
- actions: ActionMeta[];
1172
- capabilities?: CapabilityMeta[];
1173
- }
1174
-
1175
- /**
1176
- * Ajv インスタンスを作成。
1177
- * - 本体スキーマ(registry/actions/capabilities)を登録
1178
- * - formats 追加
1179
- * - $id付きで利用
1180
- */
1181
- declare function createAjv(): Ajv;
1182
- /**
1183
- * Registry全体の構文検証 + 各Actionの input_schema を「JSON Schemaとして」検証。
1184
- * @returns { ok, errors } 失敗時は diag を含む
1185
- */
1186
- declare function validateRegistryObject(registry: unknown): {
1187
- ok: boolean;
1188
- errors?: string[];
1189
- };
1190
- /**
1191
- * JSONファイルからAction Registryを読み込み、完全検証して返す。
1192
- * @throws Error 検証エラー時は詳細メッセージ付きでthrow
1193
- */
1194
- declare function loadActionRegistryFromFile(filePath: string): Promise<ActionRegistry>;
1195
- /**
1196
- * 既にパース済みのオブジェクトを検証して返す。
1197
- * @throws Error 検証エラー時は詳細メッセージ付きでthrow
1198
- */
1199
- declare function loadActionRegistryFromObject(obj: unknown): ActionRegistry;
1200
- /** アクション名→ActionMeta のルックアップを作成 */
1201
- declare function indexActions(reg: ActionRegistry): Map<string, ActionMeta>;
1202
- /** Capability名→CapabilityMeta のルックアップを作成 */
1203
- declare function indexCapabilities(reg: ActionRegistry): Map<string, CapabilityMeta>;
1204
- /** 指定アクションの required_scopes を取得(無ければ空配列) */
1205
- declare function getRequiredScopes(regIndex: Map<string, ActionMeta>, action: string): string[];
1206
- /** 指定アクションの required_relations(OR解釈)を取得(無ければ空配列) */
1207
- declare function getRequiredRelations(regIndex: Map<string, ActionMeta>, action: string): Relation[];
1208
-
1209
- /** ReBAC: 関係性チェック(SpiceDB/Zanzibar想定)。OR解釈で複数relationのいずれか成立でtrue */
1210
- interface ReBACChecker {
1211
- check(subjectDid: string, // User DID or Agent DID
1212
- relations: Relation[], // ["editor","act_as"] など
1213
- resourceRef: ResourceRef): Promise<boolean>;
1214
- }
1215
- /** ABAC: 条件判定(Cerbos/OPA想定)。trueなら許可。 */
1216
- interface ABACPolicyEngine {
1217
- evaluate(input: AbacInput): Promise<AbacDecision>;
1218
- }
1219
- interface AbacInput {
1220
- principal: {
1221
- id: string;
1222
- roles?: string[];
1223
- claims?: Record<string, unknown>;
1224
- };
1225
- resource: {
1226
- kind: ResourceType;
1227
- id: string;
1228
- attr?: Record<string, unknown>;
1229
- };
1230
- action: string;
1231
- context?: Record<string, unknown>;
1232
- }
1233
- interface AbacDecision {
1234
- allow: boolean;
1235
- ruleId?: string;
1236
- reason?: string;
1237
- }
1238
- /** Credential選択:最小スコープを満たす外部トークンを取得(Bot/Installation/OAuth) */
1239
- interface CredentialStore {
1240
- pickMinimal(provider: Provider, // "slack" | "github" | "google"
1241
- iaId: string, // IntegrationAccount ID
1242
- requiredScopes: string[], subjectDid: string): Promise<CredentialRef | null>;
1243
- }
1244
- type Provider = 'slack' | 'github' | 'google';
1245
- interface CredentialRef {
1246
- id: string;
1247
- provider: Provider;
1248
- scopes: string[];
1249
- }
1250
- /** VP検証(SD-JWT/ISO 23220/mdoc/OID4VP):成功時にVCクレームを返す */
1251
- interface VpVerifier {
1252
- verifyAndExtractClaims(vpToken: string): Promise<VerifiedVcClaims>;
1253
- }
1254
- /** 発行した Delegation VC に含めることを想定した最小構造 */
1255
- interface VerifiedVcClaims {
1256
- allowed_actions: string[];
1257
- resource_scope: ResourceScope[];
1258
- expires_at?: string;
1259
- actor?: string;
1260
- assurance_level?: number;
1261
- cnf?: {
1262
- jwk_thumbprint?: string;
1263
- };
1264
- [k: string]: unknown;
1265
- }
1266
- interface ResourceRef {
1267
- /** プロバイダ別のリソース識別子(例:Slack channel id, GitHub repo full_name, Drive file id) */
1268
- id: string;
1269
- type: ResourceType;
1270
- /** 紐づくIntegrationAccountのID(どのSlackワークスペース/どのGitHub Orgか) */
1271
- iaId: string;
1272
- /** 追加属性(機密度など) */
1273
- attr?: Record<string, unknown>;
1274
- }
1275
- /** VCに刻む「スコープ」表現の一例(最小定義) */
1276
- type ResourceScope = {
1277
- kind: 'Workspace';
1278
- id: string;
1279
- } | {
1280
- kind: 'IntegrationAccount';
1281
- id: string;
1282
- } | {
1283
- kind: 'Resource';
1284
- type: ResourceType;
1285
- id: string;
1286
- };
1287
- /** 監査用の判定理由 */
1288
- interface DecisionTrace {
1289
- rebac?: {
1290
- ok: boolean;
1291
- relations: Relation[];
1292
- };
1293
- delegation?: {
1294
- ok: boolean;
1295
- matched_action?: boolean;
1296
- in_scope?: boolean;
1297
- notExpired?: boolean;
1298
- };
1299
- abac?: {
1300
- ok: boolean;
1301
- ruleId?: string;
1302
- reason?: string;
1303
- };
1304
- scope?: {
1305
- ok: boolean;
1306
- required: string[];
1307
- chosenCredentialId?: string;
1308
- };
1309
- }
1310
- /** Capability名やAction名(混在OK)から、実アクション配列に解決 */
1311
- declare function resolveActionsFromSelection(registry: ActionRegistry, selection: string[]): string[];
1312
- interface PlanDelegationInput {
1313
- registry: ActionRegistry;
1314
- issuerUserDid: string;
1315
- delegateAgentDid: string;
1316
- /** ユーザーが UI 等で選んだアクション/ケイパビリティ */
1317
- requested: string[];
1318
- /** この委任が及ぶスコープ(Workspace/IA/Resource) */
1319
- resourceScope: ResourceScope[];
1320
- /** 有効期限(ISO) */
1321
- expiresAt?: string;
1322
- /** ABAC前提で要求する最小アシュアランス等(必要なら) */
1323
- minAssuranceLevel?: number;
1324
- /** ABAC/Cerbos用のruntime context(時間帯/場所/リスク等) */
1325
- context?: Record<string, unknown>;
1326
- /** Provider 推測のためのヒント(Credential選択時に使う) */
1327
- providerByIa?: Record<string, Provider>;
1328
- /** 実行時に用いるReBAC/ABAC/Credentialのハンドラ */
1329
- rebac: ReBACChecker;
1330
- abac: ABACPolicyEngine;
1331
- creds: CredentialStore;
1332
- }
1333
- interface PlanDelegationResult {
1334
- granted_actions: string[];
1335
- rejected_actions: string[];
1336
- traceByAction: Record<string, DecisionTrace>;
1337
- }
1338
- /**
1339
- * VC発行前に、リクエストされたアクション群を
1340
- * - Registryに存在
1341
- * - ReBAC(委任元=issuerUserDid が十分な関係を持つ)
1342
- * - ABACポリシー適合
1343
- * - 必要スコープを満たすクレデンシャルが存在
1344
- * の観点で絞り込み、発行して良いものだけ返す。
1345
- */
1346
- declare function planDelegationForVC(input: PlanDelegationInput): Promise<PlanDelegationResult>;
1347
- interface CheckPermissionInput {
1348
- registry: ActionRegistry;
1349
- actorDid: string;
1350
- onBehalfOfDid?: string;
1351
- action: string;
1352
- resource: ResourceRef;
1353
- vpToken: string;
1354
- context?: Record<string, unknown>;
1355
- rebac: ReBACChecker;
1356
- abac: ABACPolicyEngine;
1357
- creds: CredentialStore;
1358
- vpVerifier: VpVerifier;
1359
- }
1360
- interface CheckPermissionResult {
1361
- allow: boolean;
1362
- reason?: string;
1363
- trace: DecisionTrace;
1364
- credential?: CredentialRef | null;
1365
- }
1366
- /**
1367
- * 実行直前のフル判定。
1368
- * 1) ReBAC: actor がresourceに対する 基本関係/act_as を満たすか
1369
- * 2) Delegation(VC): actionがallowedか / resourceがscope内か / 期限内か
1370
- * 3) ABAC: コンテキストやassurance levelに適合するか
1371
- * 4) Scope/Credential: 必要スコープを満たすクレデンシャルが取得できるか
1372
- */
1373
- declare function checkPermissionWithVP(input: CheckPermissionInput): Promise<CheckPermissionResult>;
1374
- declare class AllowAllAbac implements ABACPolicyEngine {
1375
- evaluate(): Promise<AbacDecision>;
1376
- }
1377
- declare class SimpleRebac implements ReBACChecker {
1378
- private allowRelations;
1379
- constructor(allowRelations?: Relation[]);
1380
- check(_sub: string, relations: Relation[]): Promise<boolean>;
1381
- }
1382
- declare class DummyCreds implements CredentialStore {
1383
- pickMinimal(provider: Provider, _iaId: string, requiredScopes: string[]): Promise<CredentialRef | null>;
1384
- }
1385
- declare class DummyVpVerifier implements VpVerifier {
1386
- private vc;
1387
- constructor(vc: VerifiedVcClaims);
1388
- verifyAndExtractClaims(): Promise<VerifiedVcClaims>;
1389
- }
1390
-
1391
- declare const ACTION_REGISTRY: {
1392
- registry_version: string;
1393
- actions: ({
1394
- action: string;
1395
- resource_type: string;
1396
- required_relations: string[];
1397
- required_scopes: string[];
1398
- capability: string;
1399
- input_schema: {
1400
- type: string;
1401
- properties: {
1402
- text: {
1403
- type: string;
1404
- minLength: number;
1405
- maxLength: number;
1406
- };
1407
- thread_ts: {
1408
- type: string;
1409
- };
1410
- attachments: {
1411
- type: string;
1412
- };
1413
- latest?: undefined;
1414
- oldest?: undefined;
1415
- limit?: undefined;
1416
- name?: undefined;
1417
- timestamp?: undefined;
1418
- path?: undefined;
1419
- ref?: undefined;
1420
- title?: undefined;
1421
- body?: undefined;
1422
- labels?: undefined;
1423
- assignees?: undefined;
1424
- issue_number?: undefined;
1425
- head?: undefined;
1426
- base?: undefined;
1427
- draft?: undefined;
1428
- pr_number?: undefined;
1429
- merge_method?: undefined;
1430
- fields?: undefined;
1431
- mimeType?: undefined;
1432
- content_base64?: undefined;
1433
- parent_folder_id?: undefined;
1434
- folder_id?: undefined;
1435
- q?: undefined;
1436
- page_size?: undefined;
1437
- jql?: undefined;
1438
- maxResults?: undefined;
1439
- startAt?: undefined;
1440
- issueIdOrKey?: undefined;
1441
- recent?: undefined;
1442
- projectKeyOrId?: undefined;
1443
- type?: undefined;
1444
- boardId?: undefined;
1445
- state?: undefined;
1446
- sprintId?: undefined;
1447
- projectKey?: undefined;
1448
- summary?: undefined;
1449
- description?: undefined;
1450
- issueType?: undefined;
1451
- priority?: undefined;
1452
- assignee?: undefined;
1453
- };
1454
- required: string[];
1455
- additionalProperties: boolean;
1456
- };
1457
- constraints: {
1458
- rate_bucket: string;
1459
- requires_reviews_passed?: undefined;
1460
- max_size_mb?: undefined;
1461
- };
1462
- effects: string[];
1463
- risk: string;
1464
- version: string;
1465
- } | {
1466
- action: string;
1467
- resource_type: string;
1468
- required_relations: string[];
1469
- required_scopes: string[];
1470
- capability: string;
1471
- input_schema: {
1472
- type: string;
1473
- properties: {
1474
- latest: {
1475
- type: string;
1476
- };
1477
- oldest: {
1478
- type: string;
1479
- };
1480
- limit: {
1481
- type: string;
1482
- minimum: number;
1483
- maximum: number;
1484
- };
1485
- text?: undefined;
1486
- thread_ts?: undefined;
1487
- attachments?: undefined;
1488
- name?: undefined;
1489
- timestamp?: undefined;
1490
- path?: undefined;
1491
- ref?: undefined;
1492
- title?: undefined;
1493
- body?: undefined;
1494
- labels?: undefined;
1495
- assignees?: undefined;
1496
- issue_number?: undefined;
1497
- head?: undefined;
1498
- base?: undefined;
1499
- draft?: undefined;
1500
- pr_number?: undefined;
1501
- merge_method?: undefined;
1502
- fields?: undefined;
1503
- mimeType?: undefined;
1504
- content_base64?: undefined;
1505
- parent_folder_id?: undefined;
1506
- folder_id?: undefined;
1507
- q?: undefined;
1508
- page_size?: undefined;
1509
- jql?: undefined;
1510
- maxResults?: undefined;
1511
- startAt?: undefined;
1512
- issueIdOrKey?: undefined;
1513
- recent?: undefined;
1514
- projectKeyOrId?: undefined;
1515
- type?: undefined;
1516
- boardId?: undefined;
1517
- state?: undefined;
1518
- sprintId?: undefined;
1519
- projectKey?: undefined;
1520
- summary?: undefined;
1521
- description?: undefined;
1522
- issueType?: undefined;
1523
- priority?: undefined;
1524
- assignee?: undefined;
1525
- };
1526
- additionalProperties: boolean;
1527
- required?: undefined;
1528
- };
1529
- constraints: {
1530
- rate_bucket: string;
1531
- requires_reviews_passed?: undefined;
1532
- max_size_mb?: undefined;
1533
- };
1534
- effects: string[];
1535
- risk: string;
1536
- version: string;
1537
- } | {
1538
- action: string;
1539
- resource_type: string;
1540
- required_relations: string[];
1541
- required_scopes: string[];
1542
- capability: string;
1543
- input_schema: {
1544
- type: string;
1545
- properties: {
1546
- name: {
1547
- type: string;
1548
- minLength: number;
1549
- };
1550
- timestamp: {
1551
- type: string;
1552
- };
1553
- text?: undefined;
1554
- thread_ts?: undefined;
1555
- attachments?: undefined;
1556
- latest?: undefined;
1557
- oldest?: undefined;
1558
- limit?: undefined;
1559
- path?: undefined;
1560
- ref?: undefined;
1561
- title?: undefined;
1562
- body?: undefined;
1563
- labels?: undefined;
1564
- assignees?: undefined;
1565
- issue_number?: undefined;
1566
- head?: undefined;
1567
- base?: undefined;
1568
- draft?: undefined;
1569
- pr_number?: undefined;
1570
- merge_method?: undefined;
1571
- fields?: undefined;
1572
- mimeType?: undefined;
1573
- content_base64?: undefined;
1574
- parent_folder_id?: undefined;
1575
- folder_id?: undefined;
1576
- q?: undefined;
1577
- page_size?: undefined;
1578
- jql?: undefined;
1579
- maxResults?: undefined;
1580
- startAt?: undefined;
1581
- issueIdOrKey?: undefined;
1582
- recent?: undefined;
1583
- projectKeyOrId?: undefined;
1584
- type?: undefined;
1585
- boardId?: undefined;
1586
- state?: undefined;
1587
- sprintId?: undefined;
1588
- projectKey?: undefined;
1589
- summary?: undefined;
1590
- description?: undefined;
1591
- issueType?: undefined;
1592
- priority?: undefined;
1593
- assignee?: undefined;
1594
- };
1595
- required: string[];
1596
- additionalProperties: boolean;
1597
- };
1598
- constraints: {
1599
- rate_bucket: string;
1600
- requires_reviews_passed?: undefined;
1601
- max_size_mb?: undefined;
1602
- };
1603
- effects: string[];
1604
- risk: string;
1605
- version: string;
1606
- } | {
1607
- action: string;
1608
- resource_type: string;
1609
- required_relations: string[];
1610
- required_scopes: string[];
1611
- capability: string;
1612
- input_schema: {
1613
- type: string;
1614
- properties: {
1615
- path: {
1616
- type: string;
1617
- };
1618
- ref: {
1619
- type: string;
1620
- };
1621
- text?: undefined;
1622
- thread_ts?: undefined;
1623
- attachments?: undefined;
1624
- latest?: undefined;
1625
- oldest?: undefined;
1626
- limit?: undefined;
1627
- name?: undefined;
1628
- timestamp?: undefined;
1629
- title?: undefined;
1630
- body?: undefined;
1631
- labels?: undefined;
1632
- assignees?: undefined;
1633
- issue_number?: undefined;
1634
- head?: undefined;
1635
- base?: undefined;
1636
- draft?: undefined;
1637
- pr_number?: undefined;
1638
- merge_method?: undefined;
1639
- fields?: undefined;
1640
- mimeType?: undefined;
1641
- content_base64?: undefined;
1642
- parent_folder_id?: undefined;
1643
- folder_id?: undefined;
1644
- q?: undefined;
1645
- page_size?: undefined;
1646
- jql?: undefined;
1647
- maxResults?: undefined;
1648
- startAt?: undefined;
1649
- issueIdOrKey?: undefined;
1650
- recent?: undefined;
1651
- projectKeyOrId?: undefined;
1652
- type?: undefined;
1653
- boardId?: undefined;
1654
- state?: undefined;
1655
- sprintId?: undefined;
1656
- projectKey?: undefined;
1657
- summary?: undefined;
1658
- description?: undefined;
1659
- issueType?: undefined;
1660
- priority?: undefined;
1661
- assignee?: undefined;
1662
- };
1663
- additionalProperties: boolean;
1664
- required?: undefined;
1665
- };
1666
- constraints: {
1667
- rate_bucket: string;
1668
- requires_reviews_passed?: undefined;
1669
- max_size_mb?: undefined;
1670
- };
1671
- effects: string[];
1672
- risk: string;
1673
- version: string;
1674
- } | {
1675
- action: string;
1676
- resource_type: string;
1677
- required_relations: string[];
1678
- required_scopes: string[];
1679
- capability: string;
1680
- input_schema: {
1681
- type: string;
1682
- properties: {
1683
- title: {
1684
- type: string;
1685
- minLength: number;
1686
- };
1687
- body: {
1688
- type: string;
1689
- minLength?: undefined;
1690
- };
1691
- labels: {
1692
- type: string;
1693
- items: {
1694
- type: string;
1695
- };
1696
- };
1697
- assignees: {
1698
- type: string;
1699
- items: {
1700
- type: string;
1701
- };
1702
- };
1703
- text?: undefined;
1704
- thread_ts?: undefined;
1705
- attachments?: undefined;
1706
- latest?: undefined;
1707
- oldest?: undefined;
1708
- limit?: undefined;
1709
- name?: undefined;
1710
- timestamp?: undefined;
1711
- path?: undefined;
1712
- ref?: undefined;
1713
- issue_number?: undefined;
1714
- head?: undefined;
1715
- base?: undefined;
1716
- draft?: undefined;
1717
- pr_number?: undefined;
1718
- merge_method?: undefined;
1719
- fields?: undefined;
1720
- mimeType?: undefined;
1721
- content_base64?: undefined;
1722
- parent_folder_id?: undefined;
1723
- folder_id?: undefined;
1724
- q?: undefined;
1725
- page_size?: undefined;
1726
- jql?: undefined;
1727
- maxResults?: undefined;
1728
- startAt?: undefined;
1729
- issueIdOrKey?: undefined;
1730
- recent?: undefined;
1731
- projectKeyOrId?: undefined;
1732
- type?: undefined;
1733
- boardId?: undefined;
1734
- state?: undefined;
1735
- sprintId?: undefined;
1736
- projectKey?: undefined;
1737
- summary?: undefined;
1738
- description?: undefined;
1739
- issueType?: undefined;
1740
- priority?: undefined;
1741
- assignee?: undefined;
1742
- };
1743
- required: string[];
1744
- additionalProperties: boolean;
1745
- };
1746
- constraints: {
1747
- rate_bucket: string;
1748
- requires_reviews_passed?: undefined;
1749
- max_size_mb?: undefined;
1750
- };
1751
- effects: string[];
1752
- risk: string;
1753
- version: string;
1754
- } | {
1755
- action: string;
1756
- resource_type: string;
1757
- required_relations: string[];
1758
- required_scopes: string[];
1759
- capability: string;
1760
- input_schema: {
1761
- type: string;
1762
- properties: {
1763
- issue_number: {
1764
- type: string;
1765
- minimum: number;
1766
- };
1767
- body: {
1768
- type: string;
1769
- minLength: number;
1770
- };
1771
- text?: undefined;
1772
- thread_ts?: undefined;
1773
- attachments?: undefined;
1774
- latest?: undefined;
1775
- oldest?: undefined;
1776
- limit?: undefined;
1777
- name?: undefined;
1778
- timestamp?: undefined;
1779
- path?: undefined;
1780
- ref?: undefined;
1781
- title?: undefined;
1782
- labels?: undefined;
1783
- assignees?: undefined;
1784
- head?: undefined;
1785
- base?: undefined;
1786
- draft?: undefined;
1787
- pr_number?: undefined;
1788
- merge_method?: undefined;
1789
- fields?: undefined;
1790
- mimeType?: undefined;
1791
- content_base64?: undefined;
1792
- parent_folder_id?: undefined;
1793
- folder_id?: undefined;
1794
- q?: undefined;
1795
- page_size?: undefined;
1796
- jql?: undefined;
1797
- maxResults?: undefined;
1798
- startAt?: undefined;
1799
- issueIdOrKey?: undefined;
1800
- recent?: undefined;
1801
- projectKeyOrId?: undefined;
1802
- type?: undefined;
1803
- boardId?: undefined;
1804
- state?: undefined;
1805
- sprintId?: undefined;
1806
- projectKey?: undefined;
1807
- summary?: undefined;
1808
- description?: undefined;
1809
- issueType?: undefined;
1810
- priority?: undefined;
1811
- assignee?: undefined;
1812
- };
1813
- required: string[];
1814
- additionalProperties: boolean;
1815
- };
1816
- constraints: {
1817
- rate_bucket: string;
1818
- requires_reviews_passed?: undefined;
1819
- max_size_mb?: undefined;
1820
- };
1821
- effects: string[];
1822
- risk: string;
1823
- version: string;
1824
- } | {
1825
- action: string;
1826
- resource_type: string;
1827
- required_relations: string[];
1828
- required_scopes: string[];
1829
- capability: string;
1830
- input_schema: {
1831
- type: string;
1832
- properties: {
1833
- title: {
1834
- type: string;
1835
- minLength: number;
1836
- };
1837
- head: {
1838
- type: string;
1839
- minLength: number;
1840
- };
1841
- base: {
1842
- type: string;
1843
- minLength: number;
1844
- };
1845
- body: {
1846
- type: string;
1847
- minLength?: undefined;
1848
- };
1849
- draft: {
1850
- type: string;
1851
- };
1852
- text?: undefined;
1853
- thread_ts?: undefined;
1854
- attachments?: undefined;
1855
- latest?: undefined;
1856
- oldest?: undefined;
1857
- limit?: undefined;
1858
- name?: undefined;
1859
- timestamp?: undefined;
1860
- path?: undefined;
1861
- ref?: undefined;
1862
- labels?: undefined;
1863
- assignees?: undefined;
1864
- issue_number?: undefined;
1865
- pr_number?: undefined;
1866
- merge_method?: undefined;
1867
- fields?: undefined;
1868
- mimeType?: undefined;
1869
- content_base64?: undefined;
1870
- parent_folder_id?: undefined;
1871
- folder_id?: undefined;
1872
- q?: undefined;
1873
- page_size?: undefined;
1874
- jql?: undefined;
1875
- maxResults?: undefined;
1876
- startAt?: undefined;
1877
- issueIdOrKey?: undefined;
1878
- recent?: undefined;
1879
- projectKeyOrId?: undefined;
1880
- type?: undefined;
1881
- boardId?: undefined;
1882
- state?: undefined;
1883
- sprintId?: undefined;
1884
- projectKey?: undefined;
1885
- summary?: undefined;
1886
- description?: undefined;
1887
- issueType?: undefined;
1888
- priority?: undefined;
1889
- assignee?: undefined;
1890
- };
1891
- required: string[];
1892
- additionalProperties: boolean;
1893
- };
1894
- constraints: {
1895
- rate_bucket: string;
1896
- requires_reviews_passed?: undefined;
1897
- max_size_mb?: undefined;
1898
- };
1899
- effects: string[];
1900
- risk: string;
1901
- version: string;
1902
- } | {
1903
- action: string;
1904
- resource_type: string;
1905
- required_relations: string[];
1906
- required_scopes: string[];
1907
- capability: string;
1908
- input_schema: {
1909
- type: string;
1910
- properties: {
1911
- pr_number: {
1912
- type: string;
1913
- minimum: number;
1914
- };
1915
- merge_method: {
1916
- type: string;
1917
- enum: string[];
1918
- };
1919
- text?: undefined;
1920
- thread_ts?: undefined;
1921
- attachments?: undefined;
1922
- latest?: undefined;
1923
- oldest?: undefined;
1924
- limit?: undefined;
1925
- name?: undefined;
1926
- timestamp?: undefined;
1927
- path?: undefined;
1928
- ref?: undefined;
1929
- title?: undefined;
1930
- body?: undefined;
1931
- labels?: undefined;
1932
- assignees?: undefined;
1933
- issue_number?: undefined;
1934
- head?: undefined;
1935
- base?: undefined;
1936
- draft?: undefined;
1937
- fields?: undefined;
1938
- mimeType?: undefined;
1939
- content_base64?: undefined;
1940
- parent_folder_id?: undefined;
1941
- folder_id?: undefined;
1942
- q?: undefined;
1943
- page_size?: undefined;
1944
- jql?: undefined;
1945
- maxResults?: undefined;
1946
- startAt?: undefined;
1947
- issueIdOrKey?: undefined;
1948
- recent?: undefined;
1949
- projectKeyOrId?: undefined;
1950
- type?: undefined;
1951
- boardId?: undefined;
1952
- state?: undefined;
1953
- sprintId?: undefined;
1954
- projectKey?: undefined;
1955
- summary?: undefined;
1956
- description?: undefined;
1957
- issueType?: undefined;
1958
- priority?: undefined;
1959
- assignee?: undefined;
1960
- };
1961
- required: string[];
1962
- additionalProperties: boolean;
1963
- };
1964
- constraints: {
1965
- rate_bucket: string;
1966
- requires_reviews_passed: boolean;
1967
- max_size_mb?: undefined;
1968
- };
1969
- effects: string[];
1970
- risk: string;
1971
- version: string;
1972
- } | {
1973
- action: string;
1974
- resource_type: string;
1975
- required_relations: string[];
1976
- required_scopes: string[];
1977
- capability: string;
1978
- input_schema: {
1979
- type: string;
1980
- properties: {
1981
- fields: {
1982
- type: string;
1983
- };
1984
- text?: undefined;
1985
- thread_ts?: undefined;
1986
- attachments?: undefined;
1987
- latest?: undefined;
1988
- oldest?: undefined;
1989
- limit?: undefined;
1990
- name?: undefined;
1991
- timestamp?: undefined;
1992
- path?: undefined;
1993
- ref?: undefined;
1994
- title?: undefined;
1995
- body?: undefined;
1996
- labels?: undefined;
1997
- assignees?: undefined;
1998
- issue_number?: undefined;
1999
- head?: undefined;
2000
- base?: undefined;
2001
- draft?: undefined;
2002
- pr_number?: undefined;
2003
- merge_method?: undefined;
2004
- mimeType?: undefined;
2005
- content_base64?: undefined;
2006
- parent_folder_id?: undefined;
2007
- folder_id?: undefined;
2008
- q?: undefined;
2009
- page_size?: undefined;
2010
- jql?: undefined;
2011
- maxResults?: undefined;
2012
- startAt?: undefined;
2013
- issueIdOrKey?: undefined;
2014
- recent?: undefined;
2015
- projectKeyOrId?: undefined;
2016
- type?: undefined;
2017
- boardId?: undefined;
2018
- state?: undefined;
2019
- sprintId?: undefined;
2020
- projectKey?: undefined;
2021
- summary?: undefined;
2022
- description?: undefined;
2023
- issueType?: undefined;
2024
- priority?: undefined;
2025
- assignee?: undefined;
2026
- };
2027
- additionalProperties: boolean;
2028
- required?: undefined;
2029
- };
2030
- constraints: {
2031
- rate_bucket: string;
2032
- requires_reviews_passed?: undefined;
2033
- max_size_mb?: undefined;
2034
- };
2035
- effects: string[];
2036
- risk: string;
2037
- version: string;
2038
- } | {
2039
- action: string;
2040
- resource_type: string;
2041
- required_relations: string[];
2042
- required_scopes: string[];
2043
- capability: string;
2044
- input_schema: {
2045
- type: string;
2046
- properties: {
2047
- mimeType: {
2048
- type: string;
2049
- };
2050
- content_base64: {
2051
- type: string;
2052
- };
2053
- text?: undefined;
2054
- thread_ts?: undefined;
2055
- attachments?: undefined;
2056
- latest?: undefined;
2057
- oldest?: undefined;
2058
- limit?: undefined;
2059
- name?: undefined;
2060
- timestamp?: undefined;
2061
- path?: undefined;
2062
- ref?: undefined;
2063
- title?: undefined;
2064
- body?: undefined;
2065
- labels?: undefined;
2066
- assignees?: undefined;
2067
- issue_number?: undefined;
2068
- head?: undefined;
2069
- base?: undefined;
2070
- draft?: undefined;
2071
- pr_number?: undefined;
2072
- merge_method?: undefined;
2073
- fields?: undefined;
2074
- parent_folder_id?: undefined;
2075
- folder_id?: undefined;
2076
- q?: undefined;
2077
- page_size?: undefined;
2078
- jql?: undefined;
2079
- maxResults?: undefined;
2080
- startAt?: undefined;
2081
- issueIdOrKey?: undefined;
2082
- recent?: undefined;
2083
- projectKeyOrId?: undefined;
2084
- type?: undefined;
2085
- boardId?: undefined;
2086
- state?: undefined;
2087
- sprintId?: undefined;
2088
- projectKey?: undefined;
2089
- summary?: undefined;
2090
- description?: undefined;
2091
- issueType?: undefined;
2092
- priority?: undefined;
2093
- assignee?: undefined;
2094
- };
2095
- required: string[];
2096
- additionalProperties: boolean;
2097
- };
2098
- constraints: {
2099
- rate_bucket: string;
2100
- max_size_mb: number;
2101
- requires_reviews_passed?: undefined;
2102
- };
2103
- effects: string[];
2104
- risk: string;
2105
- version: string;
2106
- } | {
2107
- action: string;
2108
- resource_type: string;
2109
- required_relations: string[];
2110
- required_scopes: string[];
2111
- capability: string;
2112
- input_schema: {
2113
- type: string;
2114
- properties: {
2115
- name: {
2116
- type: string;
2117
- minLength: number;
2118
- };
2119
- mimeType: {
2120
- type: string;
2121
- };
2122
- parent_folder_id: {
2123
- type: string;
2124
- };
2125
- content_base64: {
2126
- type: string;
2127
- };
2128
- text?: undefined;
2129
- thread_ts?: undefined;
2130
- attachments?: undefined;
2131
- latest?: undefined;
2132
- oldest?: undefined;
2133
- limit?: undefined;
2134
- timestamp?: undefined;
2135
- path?: undefined;
2136
- ref?: undefined;
2137
- title?: undefined;
2138
- body?: undefined;
2139
- labels?: undefined;
2140
- assignees?: undefined;
2141
- issue_number?: undefined;
2142
- head?: undefined;
2143
- base?: undefined;
2144
- draft?: undefined;
2145
- pr_number?: undefined;
2146
- merge_method?: undefined;
2147
- fields?: undefined;
2148
- folder_id?: undefined;
2149
- q?: undefined;
2150
- page_size?: undefined;
2151
- jql?: undefined;
2152
- maxResults?: undefined;
2153
- startAt?: undefined;
2154
- issueIdOrKey?: undefined;
2155
- recent?: undefined;
2156
- projectKeyOrId?: undefined;
2157
- type?: undefined;
2158
- boardId?: undefined;
2159
- state?: undefined;
2160
- sprintId?: undefined;
2161
- projectKey?: undefined;
2162
- summary?: undefined;
2163
- description?: undefined;
2164
- issueType?: undefined;
2165
- priority?: undefined;
2166
- assignee?: undefined;
2167
- };
2168
- required: string[];
2169
- additionalProperties: boolean;
2170
- };
2171
- constraints: {
2172
- rate_bucket: string;
2173
- max_size_mb: number;
2174
- requires_reviews_passed?: undefined;
2175
- };
2176
- effects: string[];
2177
- risk: string;
2178
- version: string;
2179
- } | {
2180
- action: string;
2181
- resource_type: string;
2182
- required_relations: string[];
2183
- required_scopes: string[];
2184
- capability: string;
2185
- input_schema: {
2186
- type: string;
2187
- properties: {
2188
- folder_id: {
2189
- type: string;
2190
- };
2191
- q: {
2192
- type: string;
2193
- };
2194
- page_size: {
2195
- type: string;
2196
- minimum: number;
2197
- maximum: number;
2198
- };
2199
- text?: undefined;
2200
- thread_ts?: undefined;
2201
- attachments?: undefined;
2202
- latest?: undefined;
2203
- oldest?: undefined;
2204
- limit?: undefined;
2205
- name?: undefined;
2206
- timestamp?: undefined;
2207
- path?: undefined;
2208
- ref?: undefined;
2209
- title?: undefined;
2210
- body?: undefined;
2211
- labels?: undefined;
2212
- assignees?: undefined;
2213
- issue_number?: undefined;
2214
- head?: undefined;
2215
- base?: undefined;
2216
- draft?: undefined;
2217
- pr_number?: undefined;
2218
- merge_method?: undefined;
2219
- fields?: undefined;
2220
- mimeType?: undefined;
2221
- content_base64?: undefined;
2222
- parent_folder_id?: undefined;
2223
- jql?: undefined;
2224
- maxResults?: undefined;
2225
- startAt?: undefined;
2226
- issueIdOrKey?: undefined;
2227
- recent?: undefined;
2228
- projectKeyOrId?: undefined;
2229
- type?: undefined;
2230
- boardId?: undefined;
2231
- state?: undefined;
2232
- sprintId?: undefined;
2233
- projectKey?: undefined;
2234
- summary?: undefined;
2235
- description?: undefined;
2236
- issueType?: undefined;
2237
- priority?: undefined;
2238
- assignee?: undefined;
2239
- };
2240
- required: string[];
2241
- additionalProperties: boolean;
2242
- };
2243
- constraints: {
2244
- rate_bucket: string;
2245
- requires_reviews_passed?: undefined;
2246
- max_size_mb?: undefined;
2247
- };
2248
- effects: string[];
2249
- risk: string;
2250
- version: string;
2251
- } | {
2252
- action: string;
2253
- resource_type: string;
2254
- required_relations: string[];
2255
- required_scopes: string[];
2256
- capability: string;
2257
- input_schema: {
2258
- type: string;
2259
- properties: {
2260
- jql: {
2261
- type: string;
2262
- minLength: number;
2263
- };
2264
- maxResults: {
2265
- type: string;
2266
- minimum: number;
2267
- maximum: number;
2268
- };
2269
- startAt: {
2270
- type: string;
2271
- minimum: number;
2272
- };
2273
- text?: undefined;
2274
- thread_ts?: undefined;
2275
- attachments?: undefined;
2276
- latest?: undefined;
2277
- oldest?: undefined;
2278
- limit?: undefined;
2279
- name?: undefined;
2280
- timestamp?: undefined;
2281
- path?: undefined;
2282
- ref?: undefined;
2283
- title?: undefined;
2284
- body?: undefined;
2285
- labels?: undefined;
2286
- assignees?: undefined;
2287
- issue_number?: undefined;
2288
- head?: undefined;
2289
- base?: undefined;
2290
- draft?: undefined;
2291
- pr_number?: undefined;
2292
- merge_method?: undefined;
2293
- fields?: undefined;
2294
- mimeType?: undefined;
2295
- content_base64?: undefined;
2296
- parent_folder_id?: undefined;
2297
- folder_id?: undefined;
2298
- q?: undefined;
2299
- page_size?: undefined;
2300
- issueIdOrKey?: undefined;
2301
- recent?: undefined;
2302
- projectKeyOrId?: undefined;
2303
- type?: undefined;
2304
- boardId?: undefined;
2305
- state?: undefined;
2306
- sprintId?: undefined;
2307
- projectKey?: undefined;
2308
- summary?: undefined;
2309
- description?: undefined;
2310
- issueType?: undefined;
2311
- priority?: undefined;
2312
- assignee?: undefined;
2313
- };
2314
- required: string[];
2315
- additionalProperties: boolean;
2316
- };
2317
- constraints: {
2318
- rate_bucket: string;
2319
- requires_reviews_passed?: undefined;
2320
- max_size_mb?: undefined;
2321
- };
2322
- effects: string[];
2323
- risk: string;
2324
- version: string;
2325
- } | {
2326
- action: string;
2327
- resource_type: string;
2328
- required_relations: string[];
2329
- required_scopes: string[];
2330
- capability: string;
2331
- input_schema: {
2332
- type: string;
2333
- properties: {
2334
- issueIdOrKey: {
2335
- type: string;
2336
- minLength: number;
2337
- };
2338
- text?: undefined;
2339
- thread_ts?: undefined;
2340
- attachments?: undefined;
2341
- latest?: undefined;
2342
- oldest?: undefined;
2343
- limit?: undefined;
2344
- name?: undefined;
2345
- timestamp?: undefined;
2346
- path?: undefined;
2347
- ref?: undefined;
2348
- title?: undefined;
2349
- body?: undefined;
2350
- labels?: undefined;
2351
- assignees?: undefined;
2352
- issue_number?: undefined;
2353
- head?: undefined;
2354
- base?: undefined;
2355
- draft?: undefined;
2356
- pr_number?: undefined;
2357
- merge_method?: undefined;
2358
- fields?: undefined;
2359
- mimeType?: undefined;
2360
- content_base64?: undefined;
2361
- parent_folder_id?: undefined;
2362
- folder_id?: undefined;
2363
- q?: undefined;
2364
- page_size?: undefined;
2365
- jql?: undefined;
2366
- maxResults?: undefined;
2367
- startAt?: undefined;
2368
- recent?: undefined;
2369
- projectKeyOrId?: undefined;
2370
- type?: undefined;
2371
- boardId?: undefined;
2372
- state?: undefined;
2373
- sprintId?: undefined;
2374
- projectKey?: undefined;
2375
- summary?: undefined;
2376
- description?: undefined;
2377
- issueType?: undefined;
2378
- priority?: undefined;
2379
- assignee?: undefined;
2380
- };
2381
- required: string[];
2382
- additionalProperties: boolean;
2383
- };
2384
- constraints: {
2385
- rate_bucket: string;
2386
- requires_reviews_passed?: undefined;
2387
- max_size_mb?: undefined;
2388
- };
2389
- effects: string[];
2390
- risk: string;
2391
- version: string;
2392
- } | {
2393
- action: string;
2394
- resource_type: string;
2395
- required_relations: string[];
2396
- required_scopes: string[];
2397
- capability: string;
2398
- input_schema: {
2399
- type: string;
2400
- properties: {
2401
- recent: {
2402
- type: string;
2403
- };
2404
- text?: undefined;
2405
- thread_ts?: undefined;
2406
- attachments?: undefined;
2407
- latest?: undefined;
2408
- oldest?: undefined;
2409
- limit?: undefined;
2410
- name?: undefined;
2411
- timestamp?: undefined;
2412
- path?: undefined;
2413
- ref?: undefined;
2414
- title?: undefined;
2415
- body?: undefined;
2416
- labels?: undefined;
2417
- assignees?: undefined;
2418
- issue_number?: undefined;
2419
- head?: undefined;
2420
- base?: undefined;
2421
- draft?: undefined;
2422
- pr_number?: undefined;
2423
- merge_method?: undefined;
2424
- fields?: undefined;
2425
- mimeType?: undefined;
2426
- content_base64?: undefined;
2427
- parent_folder_id?: undefined;
2428
- folder_id?: undefined;
2429
- q?: undefined;
2430
- page_size?: undefined;
2431
- jql?: undefined;
2432
- maxResults?: undefined;
2433
- startAt?: undefined;
2434
- issueIdOrKey?: undefined;
2435
- projectKeyOrId?: undefined;
2436
- type?: undefined;
2437
- boardId?: undefined;
2438
- state?: undefined;
2439
- sprintId?: undefined;
2440
- projectKey?: undefined;
2441
- summary?: undefined;
2442
- description?: undefined;
2443
- issueType?: undefined;
2444
- priority?: undefined;
2445
- assignee?: undefined;
2446
- };
2447
- additionalProperties: boolean;
2448
- required?: undefined;
2449
- };
2450
- constraints: {
2451
- rate_bucket: string;
2452
- requires_reviews_passed?: undefined;
2453
- max_size_mb?: undefined;
2454
- };
2455
- effects: string[];
2456
- risk: string;
2457
- version: string;
2458
- } | {
2459
- action: string;
2460
- resource_type: string;
2461
- required_relations: string[];
2462
- required_scopes: string[];
2463
- capability: string;
2464
- input_schema: {
2465
- type: string;
2466
- properties: {
2467
- projectKeyOrId: {
2468
- type: string;
2469
- };
2470
- type: {
2471
- type: string;
2472
- };
2473
- text?: undefined;
2474
- thread_ts?: undefined;
2475
- attachments?: undefined;
2476
- latest?: undefined;
2477
- oldest?: undefined;
2478
- limit?: undefined;
2479
- name?: undefined;
2480
- timestamp?: undefined;
2481
- path?: undefined;
2482
- ref?: undefined;
2483
- title?: undefined;
2484
- body?: undefined;
2485
- labels?: undefined;
2486
- assignees?: undefined;
2487
- issue_number?: undefined;
2488
- head?: undefined;
2489
- base?: undefined;
2490
- draft?: undefined;
2491
- pr_number?: undefined;
2492
- merge_method?: undefined;
2493
- fields?: undefined;
2494
- mimeType?: undefined;
2495
- content_base64?: undefined;
2496
- parent_folder_id?: undefined;
2497
- folder_id?: undefined;
2498
- q?: undefined;
2499
- page_size?: undefined;
2500
- jql?: undefined;
2501
- maxResults?: undefined;
2502
- startAt?: undefined;
2503
- issueIdOrKey?: undefined;
2504
- recent?: undefined;
2505
- boardId?: undefined;
2506
- state?: undefined;
2507
- sprintId?: undefined;
2508
- projectKey?: undefined;
2509
- summary?: undefined;
2510
- description?: undefined;
2511
- issueType?: undefined;
2512
- priority?: undefined;
2513
- assignee?: undefined;
2514
- };
2515
- additionalProperties: boolean;
2516
- required?: undefined;
2517
- };
2518
- constraints: {
2519
- rate_bucket: string;
2520
- requires_reviews_passed?: undefined;
2521
- max_size_mb?: undefined;
2522
- };
2523
- effects: string[];
2524
- risk: string;
2525
- version: string;
2526
- } | {
2527
- action: string;
2528
- resource_type: string;
2529
- required_relations: string[];
2530
- required_scopes: string[];
2531
- capability: string;
2532
- input_schema: {
2533
- type: string;
2534
- properties: {
2535
- boardId: {
2536
- type: string;
2537
- minimum: number;
2538
- };
2539
- state: {
2540
- type: string;
2541
- };
2542
- text?: undefined;
2543
- thread_ts?: undefined;
2544
- attachments?: undefined;
2545
- latest?: undefined;
2546
- oldest?: undefined;
2547
- limit?: undefined;
2548
- name?: undefined;
2549
- timestamp?: undefined;
2550
- path?: undefined;
2551
- ref?: undefined;
2552
- title?: undefined;
2553
- body?: undefined;
2554
- labels?: undefined;
2555
- assignees?: undefined;
2556
- issue_number?: undefined;
2557
- head?: undefined;
2558
- base?: undefined;
2559
- draft?: undefined;
2560
- pr_number?: undefined;
2561
- merge_method?: undefined;
2562
- fields?: undefined;
2563
- mimeType?: undefined;
2564
- content_base64?: undefined;
2565
- parent_folder_id?: undefined;
2566
- folder_id?: undefined;
2567
- q?: undefined;
2568
- page_size?: undefined;
2569
- jql?: undefined;
2570
- maxResults?: undefined;
2571
- startAt?: undefined;
2572
- issueIdOrKey?: undefined;
2573
- recent?: undefined;
2574
- projectKeyOrId?: undefined;
2575
- type?: undefined;
2576
- sprintId?: undefined;
2577
- projectKey?: undefined;
2578
- summary?: undefined;
2579
- description?: undefined;
2580
- issueType?: undefined;
2581
- priority?: undefined;
2582
- assignee?: undefined;
2583
- };
2584
- required: string[];
2585
- additionalProperties: boolean;
2586
- };
2587
- constraints: {
2588
- rate_bucket: string;
2589
- requires_reviews_passed?: undefined;
2590
- max_size_mb?: undefined;
2591
- };
2592
- effects: string[];
2593
- risk: string;
2594
- version: string;
2595
- } | {
2596
- action: string;
2597
- resource_type: string;
2598
- required_relations: string[];
2599
- required_scopes: string[];
2600
- capability: string;
2601
- input_schema: {
2602
- type: string;
2603
- properties: {
2604
- sprintId: {
2605
- type: string;
2606
- minimum: number;
2607
- };
2608
- maxResults: {
2609
- type: string;
2610
- minimum: number;
2611
- maximum: number;
2612
- };
2613
- text?: undefined;
2614
- thread_ts?: undefined;
2615
- attachments?: undefined;
2616
- latest?: undefined;
2617
- oldest?: undefined;
2618
- limit?: undefined;
2619
- name?: undefined;
2620
- timestamp?: undefined;
2621
- path?: undefined;
2622
- ref?: undefined;
2623
- title?: undefined;
2624
- body?: undefined;
2625
- labels?: undefined;
2626
- assignees?: undefined;
2627
- issue_number?: undefined;
2628
- head?: undefined;
2629
- base?: undefined;
2630
- draft?: undefined;
2631
- pr_number?: undefined;
2632
- merge_method?: undefined;
2633
- fields?: undefined;
2634
- mimeType?: undefined;
2635
- content_base64?: undefined;
2636
- parent_folder_id?: undefined;
2637
- folder_id?: undefined;
2638
- q?: undefined;
2639
- page_size?: undefined;
2640
- jql?: undefined;
2641
- startAt?: undefined;
2642
- issueIdOrKey?: undefined;
2643
- recent?: undefined;
2644
- projectKeyOrId?: undefined;
2645
- type?: undefined;
2646
- boardId?: undefined;
2647
- state?: undefined;
2648
- projectKey?: undefined;
2649
- summary?: undefined;
2650
- description?: undefined;
2651
- issueType?: undefined;
2652
- priority?: undefined;
2653
- assignee?: undefined;
2654
- };
2655
- required: string[];
2656
- additionalProperties: boolean;
2657
- };
2658
- constraints: {
2659
- rate_bucket: string;
2660
- requires_reviews_passed?: undefined;
2661
- max_size_mb?: undefined;
2662
- };
2663
- effects: string[];
2664
- risk: string;
2665
- version: string;
2666
- } | {
2667
- action: string;
2668
- resource_type: string;
2669
- required_relations: string[];
2670
- required_scopes: string[];
2671
- capability: string;
2672
- input_schema: {
2673
- type: string;
2674
- properties: {
2675
- projectKey: {
2676
- type: string;
2677
- minLength: number;
2678
- };
2679
- summary: {
2680
- type: string;
2681
- minLength: number;
2682
- };
2683
- description: {
2684
- type: string;
2685
- };
2686
- issueType: {
2687
- type: string;
2688
- minLength: number;
2689
- };
2690
- priority: {
2691
- type: string;
2692
- };
2693
- assignee: {
2694
- type: string;
2695
- };
2696
- text?: undefined;
2697
- thread_ts?: undefined;
2698
- attachments?: undefined;
2699
- latest?: undefined;
2700
- oldest?: undefined;
2701
- limit?: undefined;
2702
- name?: undefined;
2703
- timestamp?: undefined;
2704
- path?: undefined;
2705
- ref?: undefined;
2706
- title?: undefined;
2707
- body?: undefined;
2708
- labels?: undefined;
2709
- assignees?: undefined;
2710
- issue_number?: undefined;
2711
- head?: undefined;
2712
- base?: undefined;
2713
- draft?: undefined;
2714
- pr_number?: undefined;
2715
- merge_method?: undefined;
2716
- fields?: undefined;
2717
- mimeType?: undefined;
2718
- content_base64?: undefined;
2719
- parent_folder_id?: undefined;
2720
- folder_id?: undefined;
2721
- q?: undefined;
2722
- page_size?: undefined;
2723
- jql?: undefined;
2724
- maxResults?: undefined;
2725
- startAt?: undefined;
2726
- issueIdOrKey?: undefined;
2727
- recent?: undefined;
2728
- projectKeyOrId?: undefined;
2729
- type?: undefined;
2730
- boardId?: undefined;
2731
- state?: undefined;
2732
- sprintId?: undefined;
2733
- };
2734
- required: string[];
2735
- additionalProperties: boolean;
2736
- };
2737
- constraints: {
2738
- rate_bucket: string;
2739
- requires_reviews_passed?: undefined;
2740
- max_size_mb?: undefined;
2741
- };
2742
- effects: string[];
2743
- risk: string;
2744
- version: string;
2745
- })[];
2746
- capabilities: {
2747
- capability: string;
2748
- description: string;
2749
- includes: string[];
2750
- version: string;
2751
- }[];
2752
- };
2753
-
2754
- interface KeyPair {
2755
- publicKey: any;
2756
- privateKey: any;
2757
- }
2758
- declare function generateKeyPair(): Promise<KeyPair>;
2759
- declare function signJWT(payload: any, privateKey: any, options?: {
2760
- issuer?: string;
2761
- audience?: string;
2762
- expiresIn?: string;
2763
- notBefore?: string;
2764
- subject?: string;
2765
- jti?: string;
2766
- }): Promise<string>;
2767
- declare function verifyJWT(jwt: string, publicKey: any, options?: {
2768
- issuer?: string;
2769
- audience?: string;
2770
- }): Promise<jose.JWTPayload>;
2771
- declare function generateNonce(): string;
2772
-
2773
- declare class SDJwtClient {
2774
- private static instances;
2775
- private static keyManager;
2776
- private static signerCache;
2777
- private static verifierCache;
2778
- private constructor();
2779
- /**
2780
- * Initialize with KeyManager for DID-based key management
2781
- */
2782
- static setKeyManager(keyManager: KeyManager): void;
2783
- /**
2784
- * Get SDJwtVcInstance for issuer role (VC issuance)
2785
- */
2786
- static getIssuerInstance(issuerDid: string): Promise<SDJwtVcInstance>;
2787
- /**
2788
- * Get SDJwtVcInstance for holder role (VP presentation)
2789
- */
2790
- static getHolderInstance(holderDid: string): Promise<SDJwtVcInstance>;
2791
- /**
2792
- * Get SDJwtVcInstance with specified role (backward compatibility)
2793
- */
2794
- static getSDJwtInstance(did: string, options?: {
2795
- role?: 'issuer' | 'holder';
2796
- }): Promise<SDJwtVcInstance>;
2797
- /**
2798
- * Create a new SDJwtVcInstance with DID-based keys and role
2799
- */
2800
- private static createInstance;
2801
- /**
2802
- * Create disclosure frame for selective disclosure
2803
- */
2804
- static createDisclosureFrame<T extends Record<string, any>>(claims: T, selectivelyDisclosable?: string[]): DisclosureFrame<T>;
2805
- /**
2806
- * Issue an SD-JWT with selective disclosure
2807
- */
2808
- static issueSDJWT(payload: Record<string, any>, _privateKey: any, // Not used since we get key from KeyManager based on issuer DID
2809
- selectiveDisclosureFields?: string[]): Promise<string>;
2810
- /**
2811
- * Verify an SD-JWT
2812
- */
2813
- static verifySDJWT(credential: string): Promise<{
2814
- valid: boolean;
2815
- payload?: any;
2816
- error?: string;
2817
- }>;
2818
- /**
2819
- * Legacy methods for backward compatibility
2820
- */
2821
- static createSignerVerifier(): Promise<{
2822
- signer: (data: string) => Promise<string>;
2823
- verifier: (data: string, signatureBase64url: string) => Promise<boolean>;
2824
- }>;
2825
- static generateKeyPair(): Promise<KeyPair>;
2826
- /**
2827
- * Clear caches for optimization
2828
- */
2829
- static clearCaches(): void;
2830
- /**
2831
- * Clear cache for specific issuer
2832
- */
2833
- static clearIssuerCache(issuerDid: string): void;
2834
- /**
2835
- * Get cache statistics
2836
- */
2837
- static getCacheStats(): {
2838
- instanceCount: number;
2839
- signerCount: number;
2840
- verifierCount: number;
2841
- };
2842
- /**
2843
- * Create a verifier function from an external public key
2844
- * This is used for verifying SD-JWTs when you don't have the private key
2845
- * (e.g., API side verifying credentials issued by MCP)
2846
- */
2847
- private static getVerifierFromPublicKey;
2848
- /**
2849
- * Get SDJwtVcInstance for verification with an external public key
2850
- * Used when verifying credentials without having the issuer's private key
2851
- */
2852
- private static getVerificationInstance;
2853
- /**
2854
- * Get SDJwtVcInstance for decoding without verification
2855
- */
2856
- private static getDecodingInstance;
2857
- /**
2858
- * Verify an SD-JWT with an external public key
2859
- * Use this when you have the issuer's public key but not their private key
2860
- *
2861
- * @param credential - The SD-JWT credential string
2862
- * @param publicKey - The issuer's public key (JWK format)
2863
- * @returns Verification result with valid flag and payload
2864
- *
2865
- * @example
2866
- * ```typescript
2867
- * const publicKey = extractPublicKeyFromDid(issuerDid)
2868
- * const result = await SDJwtClient.verifyWithExternalKey(credential, publicKey)
2869
- * if (result.valid) {
2870
- * console.log('Verified claims:', result.payload.claims)
2871
- * }
2872
- * ```
2873
- */
2874
- static verifyWithExternalKey(credential: string, publicKey: JWK): Promise<{
2875
- valid: boolean;
2876
- payload?: any;
2877
- claims?: any;
2878
- error?: string;
2879
- }>;
2880
- /**
2881
- * Verify an SD-JWT by extracting the issuer's public key from the DID
2882
- * Automatically resolves did:jwk DIDs
2883
- *
2884
- * @param credential - The SD-JWT credential string
2885
- * @returns Verification result with valid flag and payload
2886
- *
2887
- * @example
2888
- * ```typescript
2889
- * const result = await SDJwtClient.verifyWithIssuerDid(credential)
2890
- * if (result.valid) {
2891
- * console.log('Issuer:', result.payload.iss)
2892
- * }
2893
- * ```
2894
- */
2895
- static verifyWithIssuerDid(credential: string): Promise<{
2896
- valid: boolean;
2897
- payload?: any;
2898
- claims?: any;
2899
- issuerDid?: string;
2900
- error?: string;
2901
- }>;
2902
- /**
2903
- * Decode an SD-JWT without verification
2904
- * Use this when you need to inspect the credential before verification
2905
- * or when you don't have the issuer's public key
2906
- *
2907
- * WARNING: The returned payload has not been verified!
2908
- * Only use this for inspection purposes, not for authorization decisions.
2909
- *
2910
- * @param credential - The SD-JWT credential string
2911
- * @returns Decoded JWT payload, header, and disclosures
2912
- *
2913
- * @example
2914
- * ```typescript
2915
- * const decoded = await SDJwtClient.decodeWithoutVerification(credential)
2916
- * console.log('Issuer (unverified):', decoded.payload?.iss)
2917
- * console.log('Disclosures:', decoded.disclosures?.length)
2918
- * ```
2919
- */
2920
- static decodeWithoutVerification(credential: string): Promise<{
2921
- payload?: any;
2922
- header?: any;
2923
- disclosures?: any[];
2924
- claims?: any;
2925
- error?: string;
2926
- }>;
2927
- /**
2928
- * Extract issuer DID from an SD-JWT without verification
2929
- * Useful for determining the issuer before verification
2930
- *
2931
- * @param credential - The SD-JWT credential string
2932
- * @returns The issuer DID or null if not found
2933
- */
2934
- static extractIssuerDid(credential: string): string | null;
2935
- }
2936
-
2937
- /**
2938
- * DID Utilities
2939
- *
2940
- * Common utility functions for DID operations.
2941
- * These functions are shared across AgentDIDManager, EphemeralDIDManager,
2942
- * UserIdentityManager, and UserRootDIDManager.
2943
- */
2944
-
2945
- /**
2946
- * Public key JWK properties for did:jwk creation
2947
- */
2948
- interface PublicKeyJWK {
2949
- kty: string;
2950
- crv?: string;
2951
- x?: string;
2952
- y?: string;
2953
- use?: string;
2954
- alg?: string;
2955
- }
2956
- /**
2957
- * Create did:jwk from a public key JWK
2958
- *
2959
- * @param publicKey - The public key JWK (can include private key fields, they will be filtered)
2960
- * @returns The did:jwk string
2961
- *
2962
- * @example
2963
- * ```typescript
2964
- * const keyPair = await SDJwtClient.generateKeyPair()
2965
- * const did = createDidJwk(keyPair.publicKey)
2966
- * // => did:jwk:eyJrdHkiOiJFQyIsImNydiI6IlAtMjU2IiwieCI6Ii4uLiIsInkiOiIuLi4ifQ
2967
- * ```
2968
- */
2969
- declare function createDidJwk(publicKey: JWK | PublicKeyJWK): string;
2970
- /**
2971
- * Extract public key JWK from a private key JWK
2972
- *
2973
- * @param privateKey - The private key JWK containing the 'd' parameter
2974
- * @returns The public key JWK (without private key material)
2975
- *
2976
- * @example
2977
- * ```typescript
2978
- * const keyPair = await SDJwtClient.generateKeyPair()
2979
- * const publicKey = extractPublicKey(keyPair.privateKey)
2980
- * ```
2981
- */
2982
- declare function extractPublicKey(privateKey: JWK): JWK;
2983
- /**
2984
- * Extract public key JWK from a did:jwk string
2985
- *
2986
- * @param did - The did:jwk string
2987
- * @returns The public key JWK decoded from the DID
2988
- * @throws Error if the DID is not in did:jwk format
2989
- *
2990
- * @example
2991
- * ```typescript
2992
- * const publicKey = extractPublicKeyFromDid('did:jwk:eyJrdHkiOiJFQyIsImNydiI6IlAtMjU2IiwieCI6Ii4uLiIsInkiOiIuLi4ifQ')
2993
- * ```
2994
- */
2995
- declare function extractPublicKeyFromDid(did: string): JWK;
2996
- /**
2997
- * Validate that a string is a valid did:jwk
2998
- *
2999
- * @param did - The string to validate
3000
- * @returns true if valid did:jwk, false otherwise
3001
- */
3002
- declare function isValidDidJwk(did: string): boolean;
3003
- /**
3004
- * Get the key ID (kid) from a did:jwk
3005
- * Following the did:jwk specification, the key ID is the DID with #0 appended
3006
- *
3007
- * @param did - The did:jwk string
3008
- * @returns The key ID
3009
- */
3010
- declare function getKeyIdFromDid(did: string): string;
3011
-
3012
- declare const version = "0.0.1";
3013
-
3014
- export { type ABACPolicyEngine, ACTION_REGISTRY, AIdentityClient, type AIdentityConfig, APIVCManager, type AbacDecision, type AbacInput, type ActionMeta, type ActionRegistry, AgentDIDManager, AgentManager, AllowAllAbac, type CapabilityMeta, type CheckPermissionInput, type CheckPermissionResult, ConstraintEvaluator, type ConstraintEvaluatorOptions, type CredentialDisclosureConfig, type CredentialRef, type CredentialStatusInfo, type CredentialStore, type DecisionTrace, DisclosureConfigManager, DummyCreds, DummyVpVerifier, FilesystemKeyStorage, type JsonSchema, KeyManager, type KeyPairGenerationResult, type KeyRotationConfig, type KeyRotationInfo, KeyRotationManager, type KeyStorageConfig, type KeyStorageProvider, type MemoryDocument, MemoryKeyStorage, MemoryManager, type MemoryQuery, type MemoryQueryResult, MetricsManager, type OperationMetric, type OrganizationDisclosureConfig, type PlanDelegationInput, type PlanDelegationResult, type Provider, type ReBACChecker, type Relation, type ResourceRef, type ResourceScope, type ResourceType, type RevocationList, type RevocationListEntry, RevocationManager, type SDJWTMetrics, SDJwtClient, SimpleRebac, type ToolDefinition, ToolManager, UserIdentityManager, UserKeyPairManager, VCManager, VPManager, type VerifiedVcClaims, type VpVerifier, checkPermissionWithVP, configure, createAjv, createDidJwk, defaultConstraintEvaluator, evaluateConstraints, extractPublicKey, extractPublicKeyFromDid, generateKeyPair, generateNonce, getClient, getKeyIdFromDid, getRequiredRelations, getRequiredScopes, indexActions, indexCapabilities, isValidDidJwk, loadActionRegistryFromFile, loadActionRegistryFromObject, planDelegationForVC, resolveActionsFromSelection, signJWT, validateRegistryObject, verifyJWT, version };
32
+ export declare const version = "0.0.1";
33
+ //# sourceMappingURL=index.d.ts.map