@verana-labs/vs-agent-sdk 1.12.0-dev.3 → 1.12.0-dev.31

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 (99) hide show
  1. package/README.md +35 -27
  2. package/build/agent/VsAgent.d.ts +16 -0
  3. package/build/agent/VsAgent.js +78 -14
  4. package/build/agent/VsAgent.js.map +1 -1
  5. package/build/agent/createVsAgent.d.ts +3 -0
  6. package/build/agent/createVsAgent.js +2 -0
  7. package/build/agent/createVsAgent.js.map +1 -1
  8. package/build/auth/adr036.d.ts +7 -0
  9. package/build/auth/adr036.js +22 -0
  10. package/build/auth/adr036.js.map +1 -0
  11. package/build/auth/index.d.ts +1 -0
  12. package/build/auth/index.js +18 -0
  13. package/build/auth/index.js.map +1 -0
  14. package/build/blockchain/AuthorizationService.d.ts +30 -0
  15. package/build/blockchain/AuthorizationService.js +100 -0
  16. package/build/blockchain/AuthorizationService.js.map +1 -0
  17. package/build/blockchain/IndexerWebSocketService.d.ts +15 -9
  18. package/build/blockchain/IndexerWebSocketService.js +201 -97
  19. package/build/blockchain/IndexerWebSocketService.js.map +1 -1
  20. package/build/blockchain/VeranaChainService.d.ts +29 -3
  21. package/build/blockchain/VeranaChainService.js +164 -27
  22. package/build/blockchain/VeranaChainService.js.map +1 -1
  23. package/build/blockchain/VeranaHelpers.js +1 -0
  24. package/build/blockchain/VeranaHelpers.js.map +1 -1
  25. package/build/blockchain/VeranaIndexerService.d.ts +13 -2
  26. package/build/blockchain/VeranaIndexerService.js +49 -6
  27. package/build/blockchain/VeranaIndexerService.js.map +1 -1
  28. package/build/blockchain/handlers/IndexerHandlerRegistry.d.ts +4 -3
  29. package/build/blockchain/handlers/IndexerHandlerRegistry.js +6 -0
  30. package/build/blockchain/handlers/IndexerHandlerRegistry.js.map +1 -1
  31. package/build/blockchain/handlers/authorizationHandlers.d.ts +4 -0
  32. package/build/blockchain/handlers/authorizationHandlers.js +54 -0
  33. package/build/blockchain/handlers/authorizationHandlers.js.map +1 -0
  34. package/build/blockchain/handlers/defaultHandlers.d.ts +4 -1
  35. package/build/blockchain/handlers/defaultHandlers.js +62 -35
  36. package/build/blockchain/handlers/defaultHandlers.js.map +1 -1
  37. package/build/blockchain/handlers/index.d.ts +1 -0
  38. package/build/blockchain/handlers/index.js +1 -0
  39. package/build/blockchain/handlers/index.js.map +1 -1
  40. package/build/blockchain/handlers/stateMutations.d.ts +6 -1
  41. package/build/blockchain/handlers/stateMutations.js +146 -10
  42. package/build/blockchain/handlers/stateMutations.js.map +1 -1
  43. package/build/blockchain/index.d.ts +1 -0
  44. package/build/blockchain/index.js +1 -0
  45. package/build/blockchain/index.js.map +1 -1
  46. package/build/blockchain/indexerSync.d.ts +10 -0
  47. package/build/blockchain/indexerSync.js +34 -0
  48. package/build/blockchain/indexerSync.js.map +1 -0
  49. package/build/blockchain/types.d.ts +123 -11
  50. package/build/blockchain/types.js +20 -1
  51. package/build/blockchain/types.js.map +1 -1
  52. package/build/bootstrap/EcsBootstrapService.d.ts +30 -0
  53. package/build/bootstrap/EcsBootstrapService.js +300 -0
  54. package/build/bootstrap/EcsBootstrapService.js.map +1 -0
  55. package/build/bootstrap/index.d.ts +1 -0
  56. package/build/bootstrap/index.js +18 -0
  57. package/build/bootstrap/index.js.map +1 -0
  58. package/build/credentials/FullTailsFileService.d.ts +4 -4
  59. package/build/credentials/FullTailsFileService.js +76 -65
  60. package/build/credentials/FullTailsFileService.js.map +1 -1
  61. package/build/did/adminApiService.d.ts +2 -0
  62. package/build/did/adminApiService.js +17 -0
  63. package/build/did/adminApiService.js.map +1 -0
  64. package/build/did/migrateWebVhVersionTime.d.ts +9 -0
  65. package/build/did/migrateWebVhVersionTime.js +191 -0
  66. package/build/did/migrateWebVhVersionTime.js.map +1 -0
  67. package/build/events/VsAgentEvents.d.ts +16 -2
  68. package/build/events/VsAgentEvents.js +2 -0
  69. package/build/events/VsAgentEvents.js.map +1 -1
  70. package/build/events/VtFlowEvents.d.ts +3 -0
  71. package/build/events/VtFlowEvents.js +35 -0
  72. package/build/events/VtFlowEvents.js.map +1 -0
  73. package/build/events/index.d.ts +1 -0
  74. package/build/events/index.js +1 -0
  75. package/build/events/index.js.map +1 -1
  76. package/build/index.d.ts +4 -1
  77. package/build/index.js +9 -4
  78. package/build/index.js.map +1 -1
  79. package/build/plugins/setupBaseDidComm.js +1 -1
  80. package/build/plugins/setupBaseDidComm.js.map +1 -1
  81. package/build/types.d.ts +4 -0
  82. package/build/types.js +5 -1
  83. package/build/types.js.map +1 -1
  84. package/build/utils/trustCredentialStore.d.ts +2 -0
  85. package/build/utils/trustCredentialStore.js +49 -2
  86. package/build/utils/trustCredentialStore.js.map +1 -1
  87. package/build/utils/util.d.ts +5 -1
  88. package/build/utils/util.js +17 -5
  89. package/build/utils/util.js.map +1 -1
  90. package/build/vtFlow/VtFlowOrchestrator.d.ts +16 -1
  91. package/build/vtFlow/VtFlowOrchestrator.js +215 -87
  92. package/build/vtFlow/VtFlowOrchestrator.js.map +1 -1
  93. package/build/vtFlow/assertVerifiableService.d.ts +8 -0
  94. package/build/vtFlow/assertVerifiableService.js +28 -0
  95. package/build/vtFlow/assertVerifiableService.js.map +1 -0
  96. package/build/vtFlow/index.d.ts +1 -0
  97. package/build/vtFlow/index.js +1 -0
  98. package/build/vtFlow/index.js.map +1 -1
  99. package/package.json +15 -11
@@ -114,6 +114,8 @@ export interface VeranaSyncState {
114
114
  ecosystems: Record<string, SyncedEcosystem>;
115
115
  credentialSchemas: Record<string, SyncedCredentialSchema>;
116
116
  participants: Record<string, SyncedParticipant>;
117
+ partialBlock?: number;
118
+ partialKeys?: string[];
117
119
  }
118
120
  export interface EcosystemDto {
119
121
  id: number;
@@ -132,11 +134,30 @@ export interface CredentialSchemaDto {
132
134
  created: string;
133
135
  modified: string;
134
136
  }
137
+ export declare enum ParticipantRole {
138
+ Issuer = "ISSUER",
139
+ Verifier = "VERIFIER",
140
+ IssuerGrantor = "ISSUER_GRANTOR",
141
+ VerifierGrantor = "VERIFIER_GRANTOR",
142
+ Ecosystem = "ECOSYSTEM",
143
+ Holder = "HOLDER"
144
+ }
145
+ export declare enum ParticipantState {
146
+ Active = "ACTIVE",
147
+ Future = "FUTURE",
148
+ Inactive = "INACTIVE",
149
+ Expired = "EXPIRED",
150
+ Revoked = "REVOKED",
151
+ Slashed = "SLASHED",
152
+ Repaid = "REPAID"
153
+ }
135
154
  export interface ParticipantDto {
136
155
  id: number;
137
156
  schema_id: number;
138
157
  did: string | null;
139
- role: string;
158
+ role: ParticipantRole;
159
+ vs_operator?: string | null;
160
+ participant_state?: ParticipantState;
140
161
  op_state?: string;
141
162
  revoked: string | null;
142
163
  slashed: string | null;
@@ -145,6 +166,30 @@ export interface ParticipantDto {
145
166
  validator_participant_id?: number | null;
146
167
  op_summary_digest?: string;
147
168
  }
169
+ export interface CorporationDto {
170
+ id: number;
171
+ did?: string | null;
172
+ policy_address?: string | null;
173
+ }
174
+ export interface ParticipantSessionRecordDto {
175
+ created?: string;
176
+ issuer_participant_id?: number;
177
+ verifier_participant_id?: number;
178
+ wallet_agent_participant_id?: number;
179
+ agent_participant_id?: number;
180
+ }
181
+ export interface ParticipantSessionDto {
182
+ id: string;
183
+ corporation_id?: number;
184
+ vs_operator?: string;
185
+ created?: string;
186
+ modified?: string;
187
+ session_records?: ParticipantSessionRecordDto[];
188
+ }
189
+ export interface DigestDto {
190
+ digest: string;
191
+ created: string;
192
+ }
148
193
  export interface RawParticipant {
149
194
  id: number;
150
195
  schemaId: number;
@@ -157,6 +202,47 @@ export interface RawParticipant {
157
202
  revoked: Date | undefined;
158
203
  slashed: Date | undefined;
159
204
  }
205
+ export interface Ecosystem {
206
+ id: number;
207
+ did: string;
208
+ corporationId: number;
209
+ archived: boolean;
210
+ activeVersion: number;
211
+ }
212
+ export interface CredentialSchema {
213
+ id: number;
214
+ ecosystemId: number;
215
+ jsonSchema: string;
216
+ issuerOnboardingMode: number;
217
+ verifierOnboardingMode: number;
218
+ holderOnboardingMode: number;
219
+ archived: Date | undefined;
220
+ }
221
+ export interface OperatorAuthorization {
222
+ id: number;
223
+ corporationId: number;
224
+ operator: string;
225
+ msgTypes: string[];
226
+ expiration?: Date;
227
+ period?: DurationParam;
228
+ }
229
+ export interface ParticipantAuthorizationRecord {
230
+ participantId: number;
231
+ msgTypes: string[];
232
+ withFeegrant: boolean;
233
+ expiration?: Date;
234
+ period?: DurationParam;
235
+ }
236
+ export interface CachedVsOperatorAuthorizationRecord extends ParticipantAuthorizationRecord {
237
+ corporationId: number;
238
+ vsOperator: string;
239
+ }
240
+ export interface VsOperatorAuthorization {
241
+ id: number;
242
+ corporationId: number;
243
+ vsOperator: string;
244
+ records: ParticipantAuthorizationRecord[];
245
+ }
160
246
  export interface ParticipantQueryClient {
161
247
  GetParticipant(req: {
162
248
  id: number;
@@ -172,6 +258,36 @@ export interface ParticipantQueryClient {
172
258
  session?: unknown;
173
259
  }>;
174
260
  }
261
+ export interface EcosystemQueryClient {
262
+ GetEcosystem(req: {
263
+ id: number;
264
+ }): Promise<{
265
+ ecosystem?: Ecosystem;
266
+ }>;
267
+ }
268
+ export interface CredentialSchemaQueryClient {
269
+ GetCredentialSchema(req: {
270
+ id: number;
271
+ }): Promise<{
272
+ schema?: CredentialSchema;
273
+ }>;
274
+ }
275
+ export interface DelegationQueryClient {
276
+ ListOperatorAuthorizations(req: {
277
+ corporationId: number;
278
+ operator: string;
279
+ responseMaxSize: number;
280
+ }): Promise<{
281
+ operatorAuthorizations: OperatorAuthorization[];
282
+ }>;
283
+ ListVSOperatorAuthorizations(req: {
284
+ corporationId: number;
285
+ vsOperator: string;
286
+ responseMaxSize: number;
287
+ }): Promise<{
288
+ vsOperatorAuthorizations: VsOperatorAuthorization[];
289
+ }>;
290
+ }
175
291
  export interface VeranaChainConfig {
176
292
  rpcUrl: string;
177
293
  chainId?: string;
@@ -179,13 +295,7 @@ export interface VeranaChainConfig {
179
295
  logger: BaseLogger;
180
296
  gasPrice?: string;
181
297
  corporationAddress?: string;
182
- /**
183
- * FIXME(verana setValidated->AUTHZ-CHECK-3): temporary. On the current chain, validating a participant
184
- * (OperatorAuthorization) and creating its session (VSOperatorAuthorization) need two mutually-exclusive
185
- * account permissions, so one account cannot do both. When set, the session is signed by this second
186
- * account. Remove once the chain authorizes both under one vs_operator (AUTHZ-CHECK-3).
187
- */
188
- sessionOperatorMnemonic?: string;
298
+ autoTriggerResolver?: boolean;
189
299
  }
190
300
  /** Wrapper for optional uint64 values per `verana.pp.v1.OptionalUInt64`. */
191
301
  export interface OptionalUInt64 {
@@ -198,6 +308,8 @@ export interface StartParticipantOPParams {
198
308
  validationFees?: OptionalUInt64;
199
309
  issuanceFees?: OptionalUInt64;
200
310
  verificationFees?: OptionalUInt64;
311
+ vsOperator?: string;
312
+ vsOperatorAuthzMsgTypes?: string[];
201
313
  }
202
314
  export interface SetParticipantOPToValidatedParams {
203
315
  id: number;
@@ -205,7 +317,7 @@ export interface SetParticipantOPToValidatedParams {
205
317
  validationFees?: number;
206
318
  issuanceFees?: number;
207
319
  verificationFees?: number;
208
- opSummaryDigest: string;
320
+ opSummaryDigest?: string;
209
321
  issuanceFeeDiscount?: number;
210
322
  verificationFeeDiscount?: number;
211
323
  corporation?: string;
@@ -289,9 +401,9 @@ export interface SelfCreateParticipantParams {
289
401
  validationFees?: number;
290
402
  verificationFees?: number;
291
403
  vsOperator?: string;
292
- vsOperatorAuthzEnabled?: boolean;
404
+ vsOperatorAuthzMsgTypes?: string[];
293
405
  vsOperatorAuthzSpendLimit?: Coin[];
294
406
  vsOperatorAuthzWithFeegrant?: boolean;
295
407
  vsOperatorAuthzFeeSpendLimit?: Coin[];
296
- vsOperatorAuthzSpendPeriod?: DurationParam;
408
+ vsOperatorAuthzPeriod?: DurationParam;
297
409
  }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RECORD_ID = exports.VERANA_BECH32_PREFIX = exports.ValidationState = void 0;
3
+ exports.ParticipantState = exports.ParticipantRole = exports.RECORD_ID = exports.VERANA_BECH32_PREFIX = exports.ValidationState = void 0;
4
4
  var ValidationState;
5
5
  (function (ValidationState) {
6
6
  ValidationState[ValidationState["UNSPECIFIED"] = 0] = "UNSPECIFIED";
@@ -10,4 +10,23 @@ var ValidationState;
10
10
  })(ValidationState || (exports.ValidationState = ValidationState = {}));
11
11
  exports.VERANA_BECH32_PREFIX = 'verana';
12
12
  exports.RECORD_ID = 'verana-blockchain-sync-state';
13
+ var ParticipantRole;
14
+ (function (ParticipantRole) {
15
+ ParticipantRole["Issuer"] = "ISSUER";
16
+ ParticipantRole["Verifier"] = "VERIFIER";
17
+ ParticipantRole["IssuerGrantor"] = "ISSUER_GRANTOR";
18
+ ParticipantRole["VerifierGrantor"] = "VERIFIER_GRANTOR";
19
+ ParticipantRole["Ecosystem"] = "ECOSYSTEM";
20
+ ParticipantRole["Holder"] = "HOLDER";
21
+ })(ParticipantRole || (exports.ParticipantRole = ParticipantRole = {}));
22
+ var ParticipantState;
23
+ (function (ParticipantState) {
24
+ ParticipantState["Active"] = "ACTIVE";
25
+ ParticipantState["Future"] = "FUTURE";
26
+ ParticipantState["Inactive"] = "INACTIVE";
27
+ ParticipantState["Expired"] = "EXPIRED";
28
+ ParticipantState["Revoked"] = "REVOKED";
29
+ ParticipantState["Slashed"] = "SLASHED";
30
+ ParticipantState["Repaid"] = "REPAID";
31
+ })(ParticipantState || (exports.ParticipantState = ParticipantState = {}));
13
32
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/blockchain/types.ts"],"names":[],"mappings":";;;AAEA,IAAY,eAKX;AALD,WAAY,eAAe;IACzB,mEAAe,CAAA;IACf,2DAAW,CAAA;IACX,+DAAa,CAAA;IACb,iEAAc,CAAA;AAChB,CAAC,EALW,eAAe,+BAAf,eAAe,QAK1B;AAeY,QAAA,oBAAoB,GAAG,QAAQ,CAAA;AAC/B,QAAA,SAAS,GAAG,8BAA8B,CAAA"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/blockchain/types.ts"],"names":[],"mappings":";;;AAEA,IAAY,eAKX;AALD,WAAY,eAAe;IACzB,mEAAe,CAAA;IACf,2DAAW,CAAA;IACX,+DAAa,CAAA;IACb,iEAAc,CAAA;AAChB,CAAC,EALW,eAAe,+BAAf,eAAe,QAK1B;AAeY,QAAA,oBAAoB,GAAG,QAAQ,CAAA;AAC/B,QAAA,SAAS,GAAG,8BAA8B,CAAA;AAyIvD,IAAY,eAOX;AAPD,WAAY,eAAe;IACzB,oCAAiB,CAAA;IACjB,wCAAqB,CAAA;IACrB,mDAAgC,CAAA;IAChC,uDAAoC,CAAA;IACpC,0CAAuB,CAAA;IACvB,oCAAiB,CAAA;AACnB,CAAC,EAPW,eAAe,+BAAf,eAAe,QAO1B;AAED,IAAY,gBAQX;AARD,WAAY,gBAAgB;IAC1B,qCAAiB,CAAA;IACjB,qCAAiB,CAAA;IACjB,yCAAqB,CAAA;IACrB,uCAAmB,CAAA;IACnB,uCAAmB,CAAA;IACnB,uCAAmB,CAAA;IACnB,qCAAiB,CAAA;AACnB,CAAC,EARW,gBAAgB,gCAAhB,gBAAgB,QAQ3B"}
@@ -0,0 +1,30 @@
1
+ import { BaseLogger } from '@credo-ts/core';
2
+ import { VsAgent } from '../agent/VsAgent';
3
+ import { VeranaIndexerService } from '../blockchain';
4
+ export interface EcsBootstrapOptions {
5
+ mode: 'standalone' | 'delegated';
6
+ trustedEcosystemDids?: string[];
7
+ delegatedParentVsDid?: string;
8
+ verifyPeer?: (peerDid: string) => Promise<boolean>;
9
+ }
10
+ export declare class EcsBootstrapService {
11
+ private readonly agent;
12
+ private readonly indexer;
13
+ private readonly options;
14
+ private readonly logger;
15
+ constructor(agent: VsAgent, indexer: VeranaIndexerService | undefined, options: EcsBootstrapOptions, logger: BaseLogger);
16
+ run(): Promise<void>;
17
+ private runStandalone;
18
+ private preflight;
19
+ private acceptPendingOffers;
20
+ private discoverEcsSchemas;
21
+ private discoverFromEcosystem;
22
+ private classifySchema;
23
+ private ensureHolderParticipant;
24
+ private ensureServiceIssuer;
25
+ private findActiveValidator;
26
+ private isUsableParticipant;
27
+ private runDelegated;
28
+ private findParentServiceSchemaId;
29
+ private awaitDelegatedOutcome;
30
+ }
@@ -0,0 +1,300 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EcsBootstrapService = void 0;
4
+ const credo_ts_didcomm_vt_flow_1 = require("@verana-labs/credo-ts-didcomm-vt-flow");
5
+ const vs_agent_model_1 = require("@verana-labs/vs-agent-model");
6
+ const blockchain_1 = require("../blockchain");
7
+ const types_1 = require("../types");
8
+ const START_OP_MSG = '/verana.pp.v1.MsgStartParticipantOP';
9
+ const SELF_CREATE_MSG = '/verana.pp.v1.MsgSelfCreateParticipant';
10
+ const ISSUER_ONBOARDING_MODE_OPEN = 1;
11
+ const ISSUER_ONBOARDING_MODE_GRANTOR = 3;
12
+ const ECS_TITLE_BY_TYPE = {
13
+ ServiceCredential: vs_agent_model_1.ECS.SERVICE,
14
+ OrganizationCredential: vs_agent_model_1.ECS.ORG,
15
+ PersonaCredential: vs_agent_model_1.ECS.PERSONA,
16
+ UserAgentCredential: vs_agent_model_1.ECS.USER_AGENT,
17
+ };
18
+ const DELEGATED_OUTCOME_TIMEOUT_MS = 15 * 60000;
19
+ class EcsBootstrapService {
20
+ constructor(agent, indexer, options, logger) {
21
+ this.agent = agent;
22
+ this.indexer = indexer;
23
+ this.options = options;
24
+ this.logger = logger;
25
+ }
26
+ async run() {
27
+ if (this.options.mode === 'delegated')
28
+ return this.runDelegated();
29
+ return this.runStandalone();
30
+ }
31
+ async runStandalone() {
32
+ const skip = await this.preflight();
33
+ if (skip) {
34
+ this.logger.info(`[EcsBootstrap] standalone bootstrap skipped: ${skip}`);
35
+ return;
36
+ }
37
+ const chain = this.agent.veranaChain;
38
+ const indexer = this.indexer;
39
+ await this.acceptPendingOffers();
40
+ const { credential, credentialType, service } = await this.discoverEcsSchemas(indexer);
41
+ await this.ensureHolderParticipant(chain, indexer, credential, credentialType);
42
+ await this.ensureServiceIssuer(chain, indexer, service);
43
+ }
44
+ async preflight() {
45
+ var _a;
46
+ if (!this.agent.did)
47
+ return 'the agent has no public DID';
48
+ const chain = this.agent.veranaChain;
49
+ if (!chain)
50
+ return 'the Verana chain is not configured';
51
+ if (!this.indexer)
52
+ return 'the Verana indexer is not configured';
53
+ if (!((_a = this.options.trustedEcosystemDids) === null || _a === void 0 ? void 0 : _a.length))
54
+ return 'TRUSTED_ECS_ECOSYSTEM_DIDS is not set';
55
+ const operatorAuths = await chain.listOperatorAuthorizations();
56
+ if (!operatorAuths.some(a => a.msgTypes.includes(START_OP_MSG))) {
57
+ return `operator ${chain.address} has no OperatorAuthorization covering MsgStartParticipantOP`;
58
+ }
59
+ const balance = await chain.getBalance();
60
+ if (Number(balance.amount) === 0) {
61
+ return `operator ${chain.address} has no ${balance.denom} balance for fees and trust deposits`;
62
+ }
63
+ return null;
64
+ }
65
+ // Live offers are accepted by the vt-flow autoAcceptCredentialOffer pipeline; this only
66
+ // re-drives flows that were sitting at CRED_OFFERED when the agent restarted.
67
+ async acceptPendingOffers() {
68
+ const api = this.agent.dependencyManager.resolve(credo_ts_didcomm_vt_flow_1.VtFlowApi);
69
+ const pending = await api.findAllByQuery({
70
+ flowState: credo_ts_didcomm_vt_flow_1.VtFlowState.CredOffered,
71
+ role: credo_ts_didcomm_vt_flow_1.VtFlowRole.Applicant,
72
+ });
73
+ for (const record of pending) {
74
+ if (!record.credentialExchangeRecordId)
75
+ continue;
76
+ try {
77
+ await this.agent.didcomm.credentials.acceptOffer({
78
+ credentialExchangeRecordId: record.credentialExchangeRecordId,
79
+ });
80
+ this.logger.info(`[EcsBootstrap] re-accepted the pending credential offer for flow ${record.id}`);
81
+ }
82
+ catch (error) {
83
+ this.logger.warn(`[EcsBootstrap] could not re-accept the offer for flow ${record.id}: ${error.message}`);
84
+ }
85
+ }
86
+ }
87
+ // WL-ECS: only ecosystems on the configured allowlist may provide the essential credential schemas.
88
+ async discoverEcsSchemas(indexer) {
89
+ const ecosystems = await indexer.listEcosystems();
90
+ const failures = [];
91
+ for (const did of this.options.trustedEcosystemDids) {
92
+ const ecosystem = ecosystems.find(e => e.did === did && !e.archived);
93
+ if (!ecosystem) {
94
+ failures.push(`${did}: not a known active ecosystem`);
95
+ continue;
96
+ }
97
+ try {
98
+ return await this.discoverFromEcosystem(indexer, ecosystem.id);
99
+ }
100
+ catch (error) {
101
+ failures.push(`${did}: ${error.message}`);
102
+ }
103
+ }
104
+ throw new Error(`no trusted ECS ecosystem is usable: ${failures.join('; ')}`);
105
+ }
106
+ async discoverFromEcosystem(indexer, ecosystemId) {
107
+ const schemas = await indexer.listCredentialSchemas(ecosystemId);
108
+ const classified = await Promise.all(schemas
109
+ .filter(schema => !schema.archived)
110
+ .map(async (schema) => ({ schema, type: await this.classifySchema(schema) })));
111
+ const byType = (type) => { var _a; return (_a = classified.find(c => c.type === type)) === null || _a === void 0 ? void 0 : _a.schema; };
112
+ const service = byType(vs_agent_model_1.ECS.SERVICE);
113
+ if (!service)
114
+ throw new Error('no ECS Service credential schema');
115
+ const org = byType(vs_agent_model_1.ECS.ORG);
116
+ const persona = byType(vs_agent_model_1.ECS.PERSONA);
117
+ const credential = org !== null && org !== void 0 ? org : persona;
118
+ if (!credential)
119
+ throw new Error('no ECS Organization or Persona credential schema');
120
+ return { credential, credentialType: org ? vs_agent_model_1.ECS.ORG : vs_agent_model_1.ECS.PERSONA, service };
121
+ }
122
+ async classifySchema(schema) {
123
+ var _a;
124
+ try {
125
+ const parsed = JSON.parse(schema.json_schema);
126
+ const byDigest = await (0, vs_agent_model_1.identifySchema)(parsed);
127
+ if (byDigest)
128
+ return byDigest;
129
+ const title = typeof parsed.title === 'string' ? parsed.title : '';
130
+ return (_a = ECS_TITLE_BY_TYPE[title]) !== null && _a !== void 0 ? _a : null;
131
+ }
132
+ catch (_b) {
133
+ return null;
134
+ }
135
+ }
136
+ async ensureHolderParticipant(chain, indexer, schema, credentialType) {
137
+ const existing = await indexer.listParticipants({
138
+ schemaId: schema.id,
139
+ did: this.agent.did,
140
+ role: blockchain_1.ParticipantRole.Holder,
141
+ });
142
+ const usable = existing.find(p => this.isUsableParticipant(p));
143
+ if (usable) {
144
+ this.logger.info(`[EcsBootstrap] reusing HOLDER participant ${usable.id} for the ECS ${credentialType} schema`);
145
+ return;
146
+ }
147
+ const validator = await this.findActiveValidator(indexer, schema.id, blockchain_1.ParticipantRole.Issuer);
148
+ if (!validator) {
149
+ throw new Error(`no active ISSUER found for the ECS ${credentialType} schema ${schema.id}`);
150
+ }
151
+ // No vs_operator on bootstrap OPs: the operator account holds the OA that signs them,
152
+ // and the chain forbids the same account from also holding a VSOA.
153
+ const { participantId } = await chain.startParticipantOP({
154
+ role: types_1.HOLDER_PARTICIPANT_TYPE,
155
+ validatorParticipantId: validator.id,
156
+ did: this.agent.did,
157
+ });
158
+ this.logger.info(`[EcsBootstrap] started HOLDER onboarding ${participantId} for the ECS ${credentialType} schema with validator ${validator.id}`);
159
+ }
160
+ async ensureServiceIssuer(chain, indexer, schema) {
161
+ const existing = await indexer.listParticipants({
162
+ schemaId: schema.id,
163
+ did: this.agent.did,
164
+ role: blockchain_1.ParticipantRole.Issuer,
165
+ });
166
+ const usable = existing.find(p => this.isUsableParticipant(p));
167
+ if (usable) {
168
+ this.logger.info(`[EcsBootstrap] reusing Service ISSUER participant ${usable.id}`);
169
+ return;
170
+ }
171
+ const onChainSchema = await chain.getCredentialSchema(schema.id);
172
+ if (!onChainSchema)
173
+ throw new Error(`Service schema ${schema.id} not found on chain`);
174
+ if (onChainSchema.issuerOnboardingMode === ISSUER_ONBOARDING_MODE_OPEN) {
175
+ const operatorAuths = await chain.listOperatorAuthorizations();
176
+ if (!operatorAuths.some(a => a.msgTypes.includes(SELF_CREATE_MSG))) {
177
+ throw new Error(`operator ${chain.address} has no OperatorAuthorization covering MsgSelfCreateParticipant (required for OPEN issuer onboarding)`);
178
+ }
179
+ const root = await this.findActiveValidator(indexer, schema.id, blockchain_1.ParticipantRole.Ecosystem);
180
+ if (!root)
181
+ throw new Error(`no active ECOSYSTEM participant found for Service schema ${schema.id}`);
182
+ const { participantId } = await chain.selfCreateParticipant({
183
+ role: types_1.ISSUER_PARTICIPANT_TYPE,
184
+ validatorParticipantId: root.id,
185
+ did: this.agent.did,
186
+ effectiveUntil: root.effective_until ? new Date(root.effective_until) : undefined,
187
+ });
188
+ this.logger.info(`[EcsBootstrap] self-created Service ISSUER participant ${participantId}`);
189
+ return;
190
+ }
191
+ const validatorRole = onChainSchema.issuerOnboardingMode === ISSUER_ONBOARDING_MODE_GRANTOR
192
+ ? blockchain_1.ParticipantRole.IssuerGrantor
193
+ : blockchain_1.ParticipantRole.Ecosystem;
194
+ const validator = await this.findActiveValidator(indexer, schema.id, validatorRole);
195
+ if (!validator) {
196
+ throw new Error(`no active ${validatorRole} validator found for Service schema ${schema.id}`);
197
+ }
198
+ const { participantId } = await chain.startParticipantOP({
199
+ role: types_1.ISSUER_PARTICIPANT_TYPE,
200
+ validatorParticipantId: validator.id,
201
+ did: this.agent.did,
202
+ });
203
+ this.logger.info(`[EcsBootstrap] started Service ISSUER onboarding ${participantId} with validator ${validator.id}`);
204
+ }
205
+ async findActiveValidator(indexer, schemaId, role) {
206
+ const candidates = await indexer.listParticipants({
207
+ schemaId,
208
+ role,
209
+ participantState: blockchain_1.ParticipantState.Active,
210
+ });
211
+ return candidates.find(p => !p.revoked && !p.slashed && p.did !== this.agent.did);
212
+ }
213
+ isUsableParticipant(p) {
214
+ return (!p.revoked &&
215
+ !p.slashed &&
216
+ (p.participant_state === blockchain_1.ParticipantState.Active ||
217
+ p.participant_state === blockchain_1.ParticipantState.Future ||
218
+ p.op_state === 'PENDING'));
219
+ }
220
+ async runDelegated() {
221
+ const parentDid = this.options.delegatedParentVsDid;
222
+ if (!parentDid)
223
+ throw new Error('AGENT_DELEGATED_PARENT_VS_DID is not set');
224
+ if (!this.agent.did)
225
+ throw new Error('delegated bootstrap requires a public DID');
226
+ if (!this.indexer)
227
+ throw new Error('delegated bootstrap requires the Verana indexer');
228
+ if (!this.options.verifyPeer) {
229
+ throw new Error(`cannot verify parent VS ${parentDid}: verifiable public registries are not configured (set VERANA_CHAIN_ID)`);
230
+ }
231
+ const verified = await this.options.verifyPeer(parentDid).catch(() => false);
232
+ if (!verified) {
233
+ throw new Error(`parent VS ${parentDid} is not a Verifiable Service`);
234
+ }
235
+ const schemaId = await this.findParentServiceSchemaId(parentDid);
236
+ let connectionId;
237
+ try {
238
+ const { connectionRecord } = await this.agent.didcomm.oob.receiveImplicitInvitation({
239
+ did: parentDid,
240
+ ourDid: this.agent.did,
241
+ label: this.agent.label,
242
+ didCommVersion: 'v2',
243
+ });
244
+ if (!connectionRecord)
245
+ throw new Error('no connection record returned');
246
+ const ready = await this.agent.didcomm.connections.returnWhenIsConnected(connectionRecord.id);
247
+ connectionId = ready.id;
248
+ }
249
+ catch (error) {
250
+ throw new Error(`parent VS ${parentDid} is unreachable: ${error.message}`);
251
+ }
252
+ const api = this.agent.dependencyManager.resolve(credo_ts_didcomm_vt_flow_1.VtFlowApi);
253
+ const record = await api.sendIssuanceRequest({
254
+ connectionId,
255
+ schemaId: String(schemaId),
256
+ agentParticipantId: '0',
257
+ walletAgentParticipantId: '0',
258
+ });
259
+ this.logger.info(`[EcsBootstrap] requested the Service credential (schema ${schemaId}) from parent VS ${parentDid}`);
260
+ await this.awaitDelegatedOutcome(record.id, parentDid);
261
+ }
262
+ async findParentServiceSchemaId(parentDid) {
263
+ const participants = await this.indexer.listParticipants({
264
+ did: parentDid,
265
+ role: blockchain_1.ParticipantRole.Issuer,
266
+ participantState: blockchain_1.ParticipantState.Active,
267
+ });
268
+ for (const participant of participants) {
269
+ const schema = await this.indexer.getCredentialSchema(participant.schema_id).catch(() => undefined);
270
+ if (!schema)
271
+ continue;
272
+ if ((await this.classifySchema(schema)) === vs_agent_model_1.ECS.SERVICE)
273
+ return schema.id;
274
+ }
275
+ throw new Error(`parent VS ${parentDid} holds no active ISSUER participant for an ECS Service schema`);
276
+ }
277
+ awaitDelegatedOutcome(recordId, parentDid) {
278
+ return new Promise((resolve, reject) => {
279
+ const timer = setTimeout(() => {
280
+ reject(new Error(`parent VS ${parentDid} did not complete the issuance in time`));
281
+ }, DELEGATED_OUTCOME_TIMEOUT_MS);
282
+ timer.unref();
283
+ this.agent.events.on(credo_ts_didcomm_vt_flow_1.VtFlowEventTypes.VtFlowStateChanged, ({ payload }) => {
284
+ if (payload.vtFlowRecordId !== recordId)
285
+ return;
286
+ if (payload.state === credo_ts_didcomm_vt_flow_1.VtFlowState.Completed) {
287
+ clearTimeout(timer);
288
+ resolve();
289
+ }
290
+ else if (payload.state === credo_ts_didcomm_vt_flow_1.VtFlowState.TerminatedByValidator ||
291
+ payload.state === credo_ts_didcomm_vt_flow_1.VtFlowState.Error) {
292
+ clearTimeout(timer);
293
+ reject(new Error(`parent VS ${parentDid} rejected the Service credential request`));
294
+ }
295
+ });
296
+ });
297
+ }
298
+ }
299
+ exports.EcsBootstrapService = EcsBootstrapService;
300
+ //# sourceMappingURL=EcsBootstrapService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EcsBootstrapService.js","sourceRoot":"","sources":["../../src/bootstrap/EcsBootstrapService.ts"],"names":[],"mappings":";;;AACA,oFAM8C;AAC9C,gEAAiE;AAGjE,8CAOsB;AACtB,oCAA2E;AAE3E,MAAM,YAAY,GAAG,qCAAqC,CAAA;AAC1D,MAAM,eAAe,GAAG,wCAAwC,CAAA;AAEhE,MAAM,2BAA2B,GAAG,CAAC,CAAA;AACrC,MAAM,8BAA8B,GAAG,CAAC,CAAA;AAExC,MAAM,iBAAiB,GAAwB;IAC7C,iBAAiB,EAAE,oBAAG,CAAC,OAAO;IAC9B,sBAAsB,EAAE,oBAAG,CAAC,GAAG;IAC/B,iBAAiB,EAAE,oBAAG,CAAC,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Aa,SAAS,+DAA+D,CAAC,CAAA;IACxG,CAAC;IAEO,qBAAqB,CAAC,QAAgB,EAAE,SAAiB;QAC/D,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE;gBAC5B,MAAM,CAAC,IAAI,KAAK,CAAC,aAAa,SAAS,wCAAwC,CAAC,CAAC,CAAA;YACnF,CAAC,EAAE,4BAA4B,CAAC,CAAA;YAChC,KAAK,CAAC,KAAK,EAAE,CAAA;YACb,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAA0B,2CAAgB,CAAC,kBAAkB,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE;gBACjG,IAAI,OAAO,CAAC,cAAc,KAAK,QAAQ;oBAAE,OAAM;gBAC/C,IAAI,OAAO,CAAC,KAAK,KAAK,sCAAW,CAAC,SAAS,EAAE,CAAC;oBAC5C,YAAY,CAAC,KAAK,CAAC,CAAA;oBACnB,OAAO,EAAE,CAAA;gBACX,CAAC;qBAAM,IACL,OAAO,CAAC,KAAK,KAAK,sCAAW,CAAC,qBAAqB;oBACnD,OAAO,CAAC,KAAK,KAAK,sCAAW,CAAC,KAAK,EACnC,CAAC;oBACD,YAAY,CAAC,KAAK,CAAC,CAAA;oBACnB,MAAM,CAAC,IAAI,KAAK,CAAC,aAAa,SAAS,0CAA0C,CAAC,CAAC,CAAA;gBACrF,CAAC;YACH,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;IACJ,CAAC;CACF;AApUD,kDAoUC"}
@@ -0,0 +1 @@
1
+ export * from './EcsBootstrapService';
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./EcsBootstrapService"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/bootstrap/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wDAAqC"}
@@ -1,10 +1,12 @@
1
1
  import type { AnonCredsRevocationRegistryDefinition } from '@credo-ts/anoncreds';
2
2
  import type { AgentContext } from '@credo-ts/core';
3
3
  import { BasicTailsFileService } from '@credo-ts/anoncreds';
4
+ export declare function isValidTailsFileName(name: string): boolean;
5
+ export declare function getTailsDirectoryPath(agentContext: AgentContext): string;
6
+ export declare function migrateLegacyTailsFiles(agentContext: AgentContext): void;
4
7
  export declare class FullTailsFileService extends BasicTailsFileService {
5
8
  private tailsServerBaseUrl;
6
9
  constructor(options: {
7
- tailsDirectoryPath?: string;
8
10
  tailsServerBaseUrl: string;
9
11
  });
10
12
  uploadTailsFile(agentContext: AgentContext, options: {
@@ -13,6 +15,4 @@ export declare class FullTailsFileService extends BasicTailsFileService {
13
15
  tailsFileUrl: string;
14
16
  }>;
15
17
  }
16
- export declare const baseFilePath: string;
17
- export declare const tailsIndex: Record<string, string>;
18
- export declare function deleteTailsEntry(tailsFileUrl: string): void;
18
+ export declare function deleteTailsFile(agentContext: AgentContext, tailsFileUrl: string): void;