@verana-labs/vs-agent-sdk 2.0.0-dev.5 → 2.0.0-dev.51

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 (123) hide show
  1. package/build/agent/VsAgent.d.ts +11 -16
  2. package/build/agent/VsAgent.js +82 -172
  3. package/build/agent/VsAgent.js.map +1 -1
  4. package/build/agent/createVsAgent.d.ts +5 -0
  5. package/build/agent/createVsAgent.js +3 -0
  6. package/build/agent/createVsAgent.js.map +1 -1
  7. package/build/blockchain/AnonCredsTrustService.d.ts +53 -0
  8. package/build/blockchain/AnonCredsTrustService.js +238 -0
  9. package/build/blockchain/AnonCredsTrustService.js.map +1 -0
  10. package/build/blockchain/AuthorizationService.d.ts +5 -3
  11. package/build/blockchain/AuthorizationService.js +17 -29
  12. package/build/blockchain/AuthorizationService.js.map +1 -1
  13. package/build/blockchain/IndexerWebSocketService.d.ts +7 -1
  14. package/build/blockchain/IndexerWebSocketService.js +68 -36
  15. package/build/blockchain/IndexerWebSocketService.js.map +1 -1
  16. package/build/blockchain/VeranaChainService.d.ts +2 -13
  17. package/build/blockchain/VeranaChainService.js +8 -113
  18. package/build/blockchain/VeranaChainService.js.map +1 -1
  19. package/build/blockchain/VeranaIndexerService.d.ts +14 -1
  20. package/build/blockchain/VeranaIndexerService.js +122 -8
  21. package/build/blockchain/VeranaIndexerService.js.map +1 -1
  22. package/build/blockchain/handlers/authorizationHandlers.js +2 -2
  23. package/build/blockchain/handlers/authorizationHandlers.js.map +1 -1
  24. package/build/blockchain/handlers/defaultHandlers.js +2 -0
  25. package/build/blockchain/handlers/defaultHandlers.js.map +1 -1
  26. package/build/blockchain/handlers/index.d.ts +1 -0
  27. package/build/blockchain/handlers/index.js +1 -0
  28. package/build/blockchain/handlers/index.js.map +1 -1
  29. package/build/blockchain/handlers/selfIssuanceHandlers.d.ts +13 -0
  30. package/build/blockchain/handlers/selfIssuanceHandlers.js +71 -0
  31. package/build/blockchain/handlers/selfIssuanceHandlers.js.map +1 -0
  32. package/build/blockchain/handlers/stateMutations.d.ts +21 -2
  33. package/build/blockchain/handlers/stateMutations.js +272 -34
  34. package/build/blockchain/handlers/stateMutations.js.map +1 -1
  35. package/build/blockchain/index.d.ts +2 -0
  36. package/build/blockchain/index.js +2 -0
  37. package/build/blockchain/index.js.map +1 -1
  38. package/build/blockchain/indexerMappers.d.ts +3 -0
  39. package/build/blockchain/indexerMappers.js +53 -0
  40. package/build/blockchain/indexerMappers.js.map +1 -0
  41. package/build/blockchain/types.d.ts +5 -57
  42. package/build/blockchain/types.js.map +1 -1
  43. package/build/bootstrap/EcsBootstrapService.d.ts +16 -3
  44. package/build/bootstrap/EcsBootstrapService.js +202 -77
  45. package/build/bootstrap/EcsBootstrapService.js.map +1 -1
  46. package/build/did/CachedWebDidResolver.d.ts +0 -4
  47. package/build/did/CachedWebDidResolver.js +1 -5
  48. package/build/did/CachedWebDidResolver.js.map +1 -1
  49. package/build/did/artifactServices.d.ts +11 -0
  50. package/build/did/artifactServices.js +48 -0
  51. package/build/did/artifactServices.js.map +1 -0
  52. package/build/did/legacyDidWeb.d.ts +6 -4
  53. package/build/did/legacyDidWeb.js +17 -14
  54. package/build/did/legacyDidWeb.js.map +1 -1
  55. package/build/did/migrations/index.d.ts +22 -0
  56. package/build/did/migrations/index.js +103 -0
  57. package/build/did/migrations/index.js.map +1 -0
  58. package/build/did/migrations/migrateWebVhLog.js.map +1 -0
  59. package/build/did/migrations/migrateWebVhVersionTime.js.map +1 -0
  60. package/build/events/BaseMessageEvents.js +109 -0
  61. package/build/events/BaseMessageEvents.js.map +1 -1
  62. package/build/events/ConnectionEvents.js +110 -82
  63. package/build/events/ConnectionEvents.js.map +1 -1
  64. package/build/events/VsAgentEvents.d.ts +1 -8
  65. package/build/events/VsAgentEvents.js +0 -1
  66. package/build/events/VsAgentEvents.js.map +1 -1
  67. package/build/events/VtFlowEvents.d.ts +1 -1
  68. package/build/events/VtFlowEvents.js +2 -19
  69. package/build/events/VtFlowEvents.js.map +1 -1
  70. package/build/index.d.ts +2 -0
  71. package/build/index.js +5 -1
  72. package/build/index.js.map +1 -1
  73. package/build/plugins/setupBaseDidComm.js +4 -6
  74. package/build/plugins/setupBaseDidComm.js.map +1 -1
  75. package/build/transports/VsAgentWsInboundTransport.d.ts +1 -1
  76. package/build/transports/VsAgentWsInboundTransport.js +20 -14
  77. package/build/transports/VsAgentWsInboundTransport.js.map +1 -1
  78. package/build/utils/agent.d.ts +27 -3
  79. package/build/utils/agent.js +78 -19
  80. package/build/utils/agent.js.map +1 -1
  81. package/build/utils/didReadiness.d.ts +9 -0
  82. package/build/utils/didReadiness.js +42 -0
  83. package/build/utils/didReadiness.js.map +1 -0
  84. package/build/utils/ecsClaims.d.ts +47 -0
  85. package/build/utils/ecsClaims.js +120 -0
  86. package/build/utils/ecsClaims.js.map +1 -0
  87. package/build/utils/index.d.ts +2 -0
  88. package/build/utils/index.js +2 -0
  89. package/build/utils/index.js.map +1 -1
  90. package/build/utils/selfIssuedEcsCredential.d.ts +4 -0
  91. package/build/utils/selfIssuedEcsCredential.js +140 -0
  92. package/build/utils/selfIssuedEcsCredential.js.map +1 -0
  93. package/build/utils/setupSelfTr.d.ts +3 -56
  94. package/build/utils/setupSelfTr.js +41 -249
  95. package/build/utils/setupSelfTr.js.map +1 -1
  96. package/build/utils/trustCredentialStore.d.ts +32 -6
  97. package/build/utils/trustCredentialStore.js +183 -82
  98. package/build/utils/trustCredentialStore.js.map +1 -1
  99. package/build/utils/util.d.ts +10 -0
  100. package/build/utils/util.js +16 -0
  101. package/build/utils/util.js.map +1 -1
  102. package/build/utils/vtjscResolver.d.ts +18 -0
  103. package/build/utils/vtjscResolver.js +54 -0
  104. package/build/utils/vtjscResolver.js.map +1 -0
  105. package/build/vtFlow/VtFlowOrchestrator.d.ts +47 -9
  106. package/build/vtFlow/VtFlowOrchestrator.js +99 -58
  107. package/build/vtFlow/VtFlowOrchestrator.js.map +1 -1
  108. package/build/vtFlow/assertVerifiableService.d.ts +1 -0
  109. package/build/vtFlow/assertVerifiableService.js +45 -5
  110. package/build/vtFlow/assertVerifiableService.js.map +1 -1
  111. package/build/vtFlow/ecsIssuanceExemption.d.ts +12 -0
  112. package/build/vtFlow/ecsIssuanceExemption.js +84 -0
  113. package/build/vtFlow/ecsIssuanceExemption.js.map +1 -0
  114. package/build/vtFlow/index.d.ts +1 -0
  115. package/build/vtFlow/index.js +1 -0
  116. package/build/vtFlow/index.js.map +1 -1
  117. package/package.json +11 -11
  118. package/build/did/migrateWebVhLog.js.map +0 -1
  119. package/build/did/migrateWebVhVersionTime.js.map +0 -1
  120. /package/build/did/{migrateWebVhLog.d.ts → migrations/migrateWebVhLog.d.ts} +0 -0
  121. /package/build/did/{migrateWebVhLog.js → migrations/migrateWebVhLog.js} +0 -0
  122. /package/build/did/{migrateWebVhVersionTime.d.ts → migrations/migrateWebVhVersionTime.d.ts} +0 -0
  123. /package/build/did/{migrateWebVhVersionTime.js → migrations/migrateWebVhVersionTime.js} +0 -0
@@ -3,8 +3,11 @@ import { AskarModule, AskarModuleConfigStoreOptions } from '@credo-ts/askar';
3
3
  import { Agent, AgentDependencies, DidsModule, InitConfig, W3cCredentialsModule } from '@credo-ts/core';
4
4
  import { DidCommCredentialsModuleConfigOptions, DidCommCredentialV2Protocol, DidCommFeatureQueryOptions, DidCommJsonLdCredentialFormatService, DidCommModule, DidCommModuleConfigOptions, DidCommProofsModuleConfigOptions, DidCommProofV2Protocol } from '@credo-ts/didcomm';
5
5
  import { VtFlowModule } from '@verana-labs/credo-ts-didcomm-vt-flow';
6
+ import { AnonCredsTrustService } from '../blockchain/AnonCredsTrustService';
6
7
  import { AuthorizationService } from '../blockchain/AuthorizationService';
7
8
  import { VeranaChainService } from '../blockchain/VeranaChainService';
9
+ import { VeranaIndexerService } from '../blockchain/VeranaIndexerService';
10
+ import { EcsClaims } from '../utils/ecsClaims';
8
11
  type VsAgentDidCommModule = DidCommModule<DidCommModuleConfigOptions & {
9
12
  credentials: DidCommCredentialsModuleConfigOptions<[
10
13
  DidCommCredentialV2Protocol<[
@@ -38,8 +41,12 @@ export declare class VsAgent<TModules extends BaseAgentModules = BaseAgentModule
38
41
  displayPictureUrl?: string;
39
42
  label: string;
40
43
  veranaChain?: VeranaChainService;
44
+ indexer: VeranaIndexerService;
45
+ trustedEcosystemDids?: string[];
46
+ ecsClaims?: EcsClaims;
41
47
  authorizationService?: AuthorizationService;
42
48
  discoveryOptions?: DidCommFeatureQueryOptions[];
49
+ readonly anonCredsTrust: AnonCredsTrustService;
43
50
  constructor(options: AgentOptions<TModules> & {
44
51
  did?: string;
45
52
  autoDiscloseUserProfile?: boolean;
@@ -48,6 +55,9 @@ export declare class VsAgent<TModules extends BaseAgentModules = BaseAgentModule
48
55
  displayPictureUrl?: string;
49
56
  label: string;
50
57
  veranaChain?: VeranaChainService;
58
+ indexer: VeranaIndexerService;
59
+ trustedEcosystemDids?: string[];
60
+ ecsClaims?: EcsClaims;
51
61
  authorizationService?: AuthorizationService;
52
62
  discoveryOptions?: DidCommFeatureQueryOptions[];
53
63
  });
@@ -57,23 +67,8 @@ export declare class VsAgent<TModules extends BaseAgentModules = BaseAgentModule
57
67
  private findEd25519VerificationMethodId;
58
68
  private getDidCommServices;
59
69
  private persistDidDocumentKey;
60
- /**
61
- * Fix a webvh update-key mapping whose `didDocumentRelativeKeyId` was stored as the full multibase
62
- * (e.g. `#z6Mk...`) while the DID document verification method uses a short fragment (e.g. `#BVhGnL79`).
63
- * `getKmsKeyIdForVerifiacationMethod` matches by suffix (`vm.id.endsWith(relativeKeyId)`), so the
64
- * mismatch leaves the update key unresolvable and every webvh update fails with
65
- * "The key ID must be present before the log can be edited." The private key is present in the KMS;
66
- * only the mapping label is wrong. Idempotent: a mapping that already correlates to a VM is left alone.
67
- */
68
- private repairWebvhUpdateKeyMapping;
69
70
  private createAndAddDidCommKeysAndServices;
70
- private createAndAddLinkedVpServices;
71
- /**
72
- * Basic implicit webvh services, for the moment pointing to the service VP
73
- * and public base URL
74
- */
75
- private createAndAddWebVhImplicitServices;
76
- private createAndAddAnonCredsServices;
71
+ private addLinkedVpContext;
77
72
  private applyAdminApiService;
78
73
  }
79
74
  export interface VsAgentOptions {
@@ -3,9 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VsAgent = void 0;
4
4
  const core_1 = require("@credo-ts/core");
5
5
  const didwebvh_ts_1 = require("didwebvh-ts");
6
+ const AnonCredsTrustService_1 = require("../blockchain/AnonCredsTrustService");
6
7
  const adminApiService_1 = require("../did/adminApiService");
7
- const migrateWebVhLog_1 = require("../did/migrateWebVhLog");
8
- const migrateWebVhVersionTime_1 = require("../did/migrateWebVhVersionTime");
8
+ const artifactServices_1 = require("../did/artifactServices");
9
+ const legacyDidWeb_1 = require("../did/legacyDidWeb");
10
+ const migrations_1 = require("../did/migrations");
9
11
  const BaseMessageEvents_1 = require("../events/BaseMessageEvents");
10
12
  const ConnectionEvents_1 = require("../events/ConnectionEvents");
11
13
  const VtFlowEvents_1 = require("../events/VtFlowEvents");
@@ -20,14 +22,18 @@ class VsAgent extends core_1.Agent {
20
22
  this.displayPictureUrl = options.displayPictureUrl;
21
23
  this.label = options.label;
22
24
  this.veranaChain = options.veranaChain;
25
+ this.indexer = options.indexer;
26
+ this.trustedEcosystemDids = options.trustedEcosystemDids;
27
+ this.ecsClaims = options.ecsClaims;
23
28
  this.authorizationService = options.authorizationService;
24
29
  this.discoveryOptions = options.discoveryOptions;
30
+ this.anonCredsTrust = new AnonCredsTrustService_1.AnonCredsTrustService(this);
25
31
  }
26
32
  get hasUserProfile() {
27
33
  return 'userProfile' in this.modules;
28
34
  }
29
35
  async initialize() {
30
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
36
+ var _a, _b, _c, _d, _e, _f, _g, _h;
31
37
  await super.initialize();
32
38
  const logger = this.config.logger;
33
39
  await (0, ConnectionEvents_1.connectionEvents)(this, { discoveryOptions: this.discoveryOptions, logger });
@@ -45,62 +51,69 @@ class VsAgent extends core_1.Agent {
45
51
  }
46
52
  const parsedDid = this.did ? (0, core_1.parseDid)(this.did) : null;
47
53
  if (parsedDid) {
48
- // If a public did is specified, check if it's already stored in the wallet. If it's not the case,
49
- // create a new one and generate keys for DIDComm (if there are endpoints configured)
54
+ // The DID is derived from the public API base URL and is always SCID-less: its id is the
55
+ // location (domain[%3Aport][:path...]). Create it if the wallet holds no record yet.
50
56
  // TODO: Make DIDComm version, keys, etc. configurable. Keys can also be imported
51
- const domain = parsedDid.id.includes(':') ? parsedDid.id.split(':')[1] : parsedDid.id;
57
+ const location = parsedDid.id;
58
+ const [domain, ...pathSegments] = location.split(':');
59
+ const path = pathSegments.length ? pathSegments.join('/') : undefined;
52
60
  const existingRecord = await this.findCreatedDid(parsedDid);
61
+ if (!existingRecord) {
62
+ const otherMethod = parsedDid.method === 'webvh' ? 'web' : 'webvh';
63
+ const foreignRecord = await this.findCreatedDid(Object.assign(Object.assign({}, parsedDid), { method: otherMethod }));
64
+ if (foreignRecord) {
65
+ throw new core_1.CredoError(`Persisted public DID '${foreignRecord.did}' was created with method '${otherMethod}', but AGENT_PUBLIC_DID_METHOD is now '${parsedDid.method}'. Refusing to start: creating a second DID would discard the credentials, Participant entries and permissions bound to the persisted one.`);
66
+ }
67
+ }
68
+ if (existingRecord) {
69
+ const persistedLocation = parsedDid.method === 'webvh'
70
+ ? existingRecord.getTag('domain')
71
+ : (0, core_1.parseDid)(existingRecord.did).id;
72
+ if (persistedLocation !== location) {
73
+ throw new core_1.CredoError(`Persisted public DID '${existingRecord.did}' was created for location '${persistedLocation}', but PUBLIC_API_BASE_URL now derives location '${location}'. Refusing to start: restore the previous URL or deliberately reset the wallet.`);
74
+ }
75
+ }
53
76
  // DID has not been created yet. Let's do it
54
77
  if (!existingRecord) {
55
78
  if (parsedDid.method === 'web') {
56
79
  const didDocument = new core_1.DidDocument({ id: parsedDid.did });
57
80
  const didCommKey = await this.createAndAddDidCommKeysAndServices(didDocument);
58
- // Add Self TR
59
- await this.createAndAddLinkedVpServices(didDocument);
60
- // Add AnonCreds Services
61
- await this.createAndAddAnonCredsServices(didDocument);
81
+ this.addLinkedVpContext(didDocument);
82
+ (0, artifactServices_1.applyArtifactServices)(didDocument, { method: 'web', publicApiBaseUrl: this.publicApiBaseUrl });
62
83
  this.applyAdminApiService(didDocument);
63
- await this.dids.create({
84
+ const createResult = await this.dids.create({
64
85
  method: 'web',
65
- domain,
86
+ domain: location,
66
87
  didDocument,
67
88
  keys: [didCommKey],
68
89
  });
90
+ if (createResult.didState.state !== 'finished') {
91
+ throw new core_1.CredoError(`Failed to create did:web record: ${(_a = createResult.didState.reason) !== null && _a !== void 0 ? _a : 'unknown reason'}`);
92
+ }
69
93
  this.did = parsedDid.did;
70
94
  }
71
95
  else if (parsedDid.method === 'webvh') {
72
- // If there is an existing did:web with the same domain, this could be an
73
- // upgrade. There should be no problem on removing did:web record since we
74
- // can use newer keys for DIDComm bootstrapping, but we should at least warn
75
- // about that
76
- const didRepository = this.dependencyManager.resolve(core_1.DidRepository);
77
- const existingDidWebRecord = await didRepository.findCreatedDid(this.context, `did:web:${domain}`);
78
- if (existingDidWebRecord) {
79
- this.logger.warn('Existing record for legacy did:web found. Removing it');
80
- await didRepository.delete(this.context, existingDidWebRecord);
81
- }
82
- const { didState: { did: publicDid, didDocument }, } = await this.dids.create({ method: 'webvh', domain });
96
+ const createResult = await this.dids.create({ method: 'webvh', domain, path });
97
+ const { did: publicDid, didDocument } = createResult.didState;
83
98
  if (!publicDid || !didDocument) {
84
- this.logger.error('Failed to create did:webvh record');
85
- process.exit(1);
99
+ throw new core_1.CredoError(`Failed to create did:webvh record: ${(_b = createResult.didState.reason) !== null && _b !== void 0 ? _b : 'unknown reason'}`);
86
100
  }
87
101
  // Add DIDComm services and keys
88
102
  const didCommKey = await this.createAndAddDidCommKeysAndServices(didDocument);
89
- // Add Linked VP services
90
- await this.createAndAddLinkedVpServices(didDocument);
91
- // Add implicit services
92
- await this.createAndAddWebVhImplicitServices(didDocument);
93
- didDocument.alsoKnownAs = [`did:web:${domain}`];
103
+ this.addLinkedVpContext(didDocument);
104
+ (0, artifactServices_1.applyArtifactServices)(didDocument, { method: 'webvh', publicApiBaseUrl: this.publicApiBaseUrl });
105
+ const legacyDidWeb = (0, legacyDidWeb_1.getLegacyDidWeb)(publicDid);
106
+ if (legacyDidWeb)
107
+ didDocument.alsoKnownAs = [legacyDidWeb];
94
108
  // The webvh registrar doesn't merge new keys into the DidRecord on update,
95
109
  // so persist the DIDComm key mapping directly on the existing record.
96
110
  await this.persistDidDocumentKey(publicDid, didCommKey);
97
111
  this.applyAdminApiService(didDocument);
98
112
  const result = await this.dids.update({ did: publicDid, didDocument });
99
113
  if (result.didState.state !== 'finished') {
100
- this.logger.error(`Cannot update DID ${publicDid}`);
101
- process.exit(1);
114
+ throw new core_1.CredoError(`Cannot update DID ${publicDid}: ${(_c = result.didState.reason) !== null && _c !== void 0 ? _c : 'unknown reason'}`);
102
115
  }
103
- (_a = this.logger) === null || _a === void 0 ? void 0 : _a.debug('Public did:webvh record created');
116
+ (_d = this.logger) === null || _d === void 0 ? void 0 : _d.debug('Public did:webvh record created');
104
117
  this.did = publicDid;
105
118
  }
106
119
  else {
@@ -108,51 +121,32 @@ class VsAgent extends core_1.Agent {
108
121
  }
109
122
  return;
110
123
  }
111
- // Ensure the stored did:webvh log is resolvable under the current didwebvh-ts version:
112
- // <2.7.4 wrote broken entry hashes (SCID placeholder), and >=2.8.0 rejects the
113
- // same-second versionTimes the old create+update-at-init flow produced. Both migrations
114
- // rebuild the log in-place, preserving entry #1 (and therefore the SCID and public DID).
115
- if (parsedDid.method === 'webvh') {
116
- try {
117
- await (0, migrateWebVhVersionTime_1.migrateWebVhVersionTimeIfBroken)(this.agentContext, existingRecord, this.logger);
118
- await (0, migrateWebVhLog_1.migrateWebVhLogIfBroken)(this.agentContext, existingRecord, this.logger);
119
- }
120
- catch (error) {
121
- this.logger.error(`Failed to migrate webvh DID log for ${existingRecord.did}: ${error instanceof Error ? error.message : String(error)}`);
122
- throw error;
123
- }
124
- }
125
- // Make sure did:webvh record has the did:web form as an alternative, in order to support
126
- // implicit invitations
127
- if (parsedDid.method === 'webvh' &&
128
- !((_b = existingRecord === null || existingRecord === void 0 ? void 0 : existingRecord.getTag('alternativeDids')) === null || _b === void 0 ? void 0 : _b.includes(`did:web:${domain}`))) {
129
- (_c = this.logger) === null || _c === void 0 ? void 0 : _c.debug('Adding did:web form as an alternative DID');
130
- existingRecord.setTag('alternativeDids', [`did:web:${domain}`]);
131
- const didRepository = this.dependencyManager.resolve(core_1.DidRepository);
132
- await didRepository.update(this.agentContext, existingRecord);
133
- }
134
- // Fix a legacy webvh update-key mapping before the self-heal update below relies on it.
135
- if (parsedDid.method === 'webvh')
136
- await this.repairWebvhUpdateKeyMapping(existingRecord);
137
- // DID Already exists: update it in case that agent parameters have been changed. At the moment, we can only update
138
- // DIDComm endpoints, so we'll only replace the service (if different from previous)
124
+ await (0, migrations_1.migrateLegacyDidRecord)(this.agentContext, existingRecord, {
125
+ method: parsedDid.method,
126
+ logger: this.logger,
127
+ });
128
+ // DID already exists: reconcile the stored document with the current agent parameters,
129
+ // updating it only if one of the checks below finds a difference
139
130
  const didDocument = existingRecord.didDocument;
140
- const hasLegacyMethods = ((_d = didDocument.verificationMethod) !== null && _d !== void 0 ? _d : []).some(vm => ['Ed25519VerificationKey2018', 'X25519KeyAgreementKey2019'].includes(vm.type));
131
+ const hasLegacyMethods = (0, migrations_1.hasLegacyVerificationMethods)(didDocument);
141
132
  const ed25519VerificationMethodId = this.findEd25519VerificationMethodId(didDocument);
142
133
  const servicesChanged = !ed25519VerificationMethodId ||
143
134
  JSON.stringify(didDocument.didCommServices) !==
144
135
  JSON.stringify(this.getDidCommServices(didDocument.id, ed25519VerificationMethodId));
145
- // One-shot migration for did:webvh records published before authentication-replace
146
- // landed, which still carry the didwebvh-ts update key in authentication.
147
- const authHasUpdateKey = parsedDid.method === 'webvh' &&
148
- !!ed25519VerificationMethodId &&
149
- ((_e = didDocument.authentication) !== null && _e !== void 0 ? _e : []).some(a => {
150
- const id = typeof a === 'string' ? a : a.id;
151
- return id !== ed25519VerificationMethodId;
152
- });
153
- const currentAdminEntry = ((_f = didDocument.service) !== null && _f !== void 0 ? _f : []).find(s => s.type === 'VsAgentAdminAPI');
136
+ const authHasUpdateKey = (0, migrations_1.authenticationHasUpdateKey)(didDocument, parsedDid.method, ed25519VerificationMethodId);
137
+ const currentAdminEntry = ((_e = didDocument.service) !== null && _e !== void 0 ? _e : []).find(s => s.type === 'VsAgentAdminAPI');
154
138
  const adminEntryChanged = (currentAdminEntry === null || currentAdminEntry === void 0 ? void 0 : currentAdminEntry.serviceEndpoint) !== this.adminApiServiceEndpoint;
155
- if (hasLegacyMethods || servicesChanged || authHasUpdateKey || adminEntryChanged) {
139
+ // A record from an earlier version may still carry the service of the other method.
140
+ const artifactMethod = parsedDid.method === 'webvh' ? 'webvh' : 'web';
141
+ const artifactServicesChanged = !(0, artifactServices_1.artifactServicesMatch)(didDocument, {
142
+ method: artifactMethod,
143
+ publicApiBaseUrl: this.publicApiBaseUrl,
144
+ });
145
+ if (hasLegacyMethods ||
146
+ servicesChanged ||
147
+ authHasUpdateKey ||
148
+ adminEntryChanged ||
149
+ artifactServicesChanged) {
156
150
  if (servicesChanged && ed25519VerificationMethodId) {
157
151
  didDocument.service = [
158
152
  ...(didDocument.service
@@ -161,6 +155,10 @@ class VsAgent extends core_1.Agent {
161
155
  ...this.getDidCommServices(didDocument.id, ed25519VerificationMethodId),
162
156
  ];
163
157
  }
158
+ (0, artifactServices_1.applyArtifactServices)(didDocument, {
159
+ method: artifactMethod,
160
+ publicApiBaseUrl: this.publicApiBaseUrl,
161
+ });
164
162
  this.applyAdminApiService(didDocument);
165
163
  const newKeys = [];
166
164
  if (hasLegacyMethods) {
@@ -177,30 +175,30 @@ class VsAgent extends core_1.Agent {
177
175
  // silently no-ops. Check the result and surface the reason instead of assuming success.
178
176
  const updateResult = await this.dids.update(Object.assign({ did: didDocument.id, didDocument }, (newKeys.length && parsedDid.method === 'web' ? { keys: newKeys } : {})));
179
177
  if (updateResult.didState.state !== 'finished') {
180
- (_g = this.logger) === null || _g === void 0 ? void 0 : _g.error('Public did record update failed to persist', {
178
+ (_f = this.logger) === null || _f === void 0 ? void 0 : _f.error('Public did record update failed to persist', {
181
179
  did: didDocument.id,
182
180
  state: updateResult.didState.state,
183
181
  reason: updateResult.didState.reason,
184
182
  });
185
183
  }
186
184
  else {
187
- (_h = this.logger) === null || _h === void 0 ? void 0 : _h.debug('Public did record updated');
185
+ (_g = this.logger) === null || _g === void 0 ? void 0 : _g.debug('Public did record updated');
188
186
  }
189
187
  }
190
188
  else {
191
- (_j = this.logger) === null || _j === void 0 ? void 0 : _j.debug('Existing DID record found. No updates');
189
+ (_h = this.logger) === null || _h === void 0 ? void 0 : _h.debug('Existing DID record found. No updates');
192
190
  }
193
191
  this.did = existingRecord.did;
194
192
  }
195
193
  }
196
194
  async findCreatedDid(parsedDid) {
197
195
  const didRepository = this.dependencyManager.resolve(core_1.DidRepository);
198
- // Particular case of webvh: parsedDid might not include the SCID, so we'll need to find it by domain
199
- if (parsedDid.method === 'webvh') {
200
- const domain = parsedDid.id.includes(':') ? parsedDid.id.split(':')[1] : parsedDid.id;
201
- return await didRepository.findSingleByQuery(this.context, { method: 'webvh', domain });
202
- }
203
- return await didRepository.findCreatedDid(this.context, parsedDid.did);
196
+ // Method-scoped on purpose: a location change must surface as a mismatch error in
197
+ // initialize, never as a lookup miss that silently mints a second DID
198
+ return await didRepository.findSingleByQuery(this.context, {
199
+ method: parsedDid.method,
200
+ role: core_1.DidDocumentRole.Created,
201
+ });
204
202
  }
205
203
  // Prefer Ed25519VerificationKey2020 over Multikey: webvh's update Multikey is not ours to use.
206
204
  findEd25519VerificationMethodId(didDocument) {
@@ -255,43 +253,6 @@ class VsAgent extends core_1.Agent {
255
253
  record.keys = [...existing, key];
256
254
  await didRepository.update(this.agentContext, record);
257
255
  }
258
- /**
259
- * Fix a webvh update-key mapping whose `didDocumentRelativeKeyId` was stored as the full multibase
260
- * (e.g. `#z6Mk...`) while the DID document verification method uses a short fragment (e.g. `#BVhGnL79`).
261
- * `getKmsKeyIdForVerifiacationMethod` matches by suffix (`vm.id.endsWith(relativeKeyId)`), so the
262
- * mismatch leaves the update key unresolvable and every webvh update fails with
263
- * "The key ID must be present before the log can be edited." The private key is present in the KMS;
264
- * only the mapping label is wrong. Idempotent: a mapping that already correlates to a VM is left alone.
265
- */
266
- async repairWebvhUpdateKeyMapping(record) {
267
- var _a, _b, _c;
268
- if (!record.didDocument || !((_a = record.keys) === null || _a === void 0 ? void 0 : _a.length))
269
- return;
270
- const vms = (_b = record.didDocument.verificationMethod) !== null && _b !== void 0 ? _b : [];
271
- let repaired = false;
272
- for (const key of record.keys) {
273
- const rel = key.didDocumentRelativeKeyId;
274
- if (vms.some(vm => vm.id.endsWith(rel)))
275
- continue; // already correlates
276
- const vm = vms.find(v => `#${v.publicKeyMultibase}` === rel); // was stored as #<multibase>
277
- if (!vm)
278
- continue;
279
- const correct = `#${vm.id.split('#')[1]}`;
280
- if (correct !== rel) {
281
- (_c = this.logger) === null || _c === void 0 ? void 0 : _c.warn('Fixing webvh update-key mapping', {
282
- from: rel,
283
- to: correct,
284
- kmsKeyId: key.kmsKeyId,
285
- });
286
- key.didDocumentRelativeKeyId = correct;
287
- repaired = true;
288
- }
289
- }
290
- if (repaired) {
291
- const didRepository = this.dependencyManager.resolve(core_1.DidRepository);
292
- await didRepository.update(this.agentContext, record);
293
- }
294
- }
295
256
  async createAndAddDidCommKeysAndServices(didDocument) {
296
257
  var _a, _b, _c, _d, _e;
297
258
  const publicDid = didDocument.id;
@@ -361,64 +322,13 @@ class VsAgent extends core_1.Agent {
361
322
  ];
362
323
  return didDocumentKey;
363
324
  }
364
- async createAndAddLinkedVpServices(didDocument) {
365
- var _a, _b;
366
- const publicDid = didDocument.id;
367
- didDocument.service = [
368
- ...((_a = didDocument.service) !== null && _a !== void 0 ? _a : []),
369
- ...[
370
- new core_1.DidDocumentService({
371
- id: `${publicDid}#vpr-schemas-service-vtc-vp`,
372
- serviceEndpoint: `${this.publicApiBaseUrl}/vt/ecs-service-vtc-vp.json`,
373
- type: 'LinkedVerifiablePresentation',
374
- }),
375
- new core_1.DidDocumentService({
376
- id: `${publicDid}#vpr-schemas-org-vtc-vp`,
377
- serviceEndpoint: `${this.publicApiBaseUrl}/vt/ecs-org-vtc-vp.json`,
378
- type: 'LinkedVerifiablePresentation',
379
- }),
380
- ],
381
- ];
325
+ addLinkedVpContext(didDocument) {
326
+ var _a;
382
327
  didDocument.context = [
383
- ...((_b = didDocument.context) !== null && _b !== void 0 ? _b : []),
328
+ ...((_a = didDocument.context) !== null && _a !== void 0 ? _a : []),
384
329
  'https://identity.foundation/linked-vp/contexts/v1',
385
330
  ];
386
331
  }
387
- /**
388
- * Basic implicit webvh services, for the moment pointing to the service VP
389
- * and public base URL
390
- */
391
- async createAndAddWebVhImplicitServices(didDocument) {
392
- var _a;
393
- const publicDid = didDocument.id;
394
- didDocument.service = [
395
- ...((_a = didDocument.service) !== null && _a !== void 0 ? _a : []),
396
- ...[
397
- new core_1.DidDocumentService({
398
- id: `${publicDid}#whois`,
399
- serviceEndpoint: `${this.publicApiBaseUrl}/vt/ecs-service-vtc-vp.json`,
400
- type: 'LinkedVerifiablePresentation',
401
- }),
402
- new core_1.DidDocumentService({
403
- id: `${publicDid}#files`,
404
- serviceEndpoint: `${this.publicApiBaseUrl}`,
405
- type: 'relativeRef',
406
- }),
407
- ],
408
- ];
409
- }
410
- async createAndAddAnonCredsServices(didDocument) {
411
- var _a;
412
- const publicDid = didDocument.id;
413
- didDocument.service = [
414
- ...((_a = didDocument.service) !== null && _a !== void 0 ? _a : []),
415
- new core_1.DidDocumentService({
416
- id: `${publicDid}#anoncreds`,
417
- serviceEndpoint: `${this.publicApiBaseUrl}/anoncreds/v1`,
418
- type: 'AnonCredsRegistry',
419
- }),
420
- ];
421
- }
422
332
  applyAdminApiService(didDocument) {
423
333
  (0, adminApiService_1.applyAdminApiServiceEntry)(didDocument, this.adminApiServiceEndpoint);
424
334
  }
@@ -1 +1 @@
1
- {"version":3,"file":"VsAgent.js","sourceRoot":"","sources":["../../src/agent/VsAgent.ts"],"names":[],"mappings":";;;AAQA,yCAoBuB;AAYvB,6CAAgE;AAIhE,4DAAkE;AAClE,4DAAgE;AAChE,4EAAgF;AAChF,mEAA+D;AAC/D,iEAA6D;AAC7D,yDAAqD;AAErD,MAAM,6BAA6B,GAAsB,CAAC,uBAAgB,CAAC,IAAI,EAAE,0BAAmB,CAAC,IAAI,CAAC,CAAA;AAoC1G,MAAa,OAA8D,SAAQ,YAAe;IAWhG,YACE,OAUC;QAED,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAA;QACtB,IAAI,CAAC,uBAAuB,GAAG,OAAO,CAAC,uBAAuB,CAAA;QAC9D,IAAI,CAAC,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAA;QAChD,IAAI,CAAC,uBAAuB,GAAG,OAAO,CAAC,uBAAuB,CAAA;QAC9D,IAAI,CAAC,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAA;QAClD,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAA;QAC1B,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAA;QACtC,IAAI,CAAC,oBAAoB,GAAG,OAAO,CAAC,oBAAoB,CAAA;QACxD,IAAI,CAAC,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAA;IAClD,CAAC;IAED,IAAY,cAAc;QACxB,OAAO,aAAa,IAAI,IAAI,CAAC,OAAO,CAAA;IACtC,CAAC;IAEM,KAAK,CAAC,UAAU;;QACrB,MAAM,KAAK,CAAC,UAAU,EAAE,CAAA;QAExB,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,MAAoB,CAAA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AAwB;QACnD,IAAA,2CAAyB,EAAC,WAAW,EAAE,IAAI,CAAC,uBAAuB,CAAC,CAAA;IACtE,CAAC;CACF;AA/ZD,0BA+ZC"}
@@ -3,8 +3,10 @@ import { AskarModuleConfigStoreOptions } from '@credo-ts/askar';
3
3
  import { AgentDependencies, InitConfig, LogLevel } from '@credo-ts/core';
4
4
  import { AuthorizationService } from '../blockchain/AuthorizationService';
5
5
  import { VeranaChainService } from '../blockchain/VeranaChainService';
6
+ import { VeranaIndexerService } from '../blockchain/VeranaIndexerService';
6
7
  import { Plugin } from '../types';
7
8
  import { BaseAgentModules, VsAgent } from './VsAgent';
9
+ import { EcsClaims } from '../utils/ecsClaims';
8
10
  type MergePluginModules<T extends Plugin[]> = T extends [infer First, ...infer Rest] ? First extends {
9
11
  modules: infer M;
10
12
  } ? Rest extends Plugin[] ? M & MergePluginModules<Rest> : M : never : object;
@@ -25,6 +27,9 @@ export interface CreateVsAgentOptions<T extends Plugin[]> {
25
27
  dependencies: AgentDependencies;
26
28
  logLevel?: LogLevel;
27
29
  veranaChain?: VeranaChainService;
30
+ indexer: VeranaIndexerService;
31
+ trustedEcosystemDids?: string[];
32
+ ecsClaims?: EcsClaims;
28
33
  authorizationService?: AuthorizationService;
29
34
  discoveryOptions?: DidCommFeatureQueryOptions[];
30
35
  }
@@ -40,6 +40,9 @@ function createVsAgent(options) {
40
40
  displayPictureUrl: options.displayPictureUrl,
41
41
  label: options.label,
42
42
  veranaChain: options.veranaChain,
43
+ indexer: options.indexer,
44
+ trustedEcosystemDids: options.trustedEcosystemDids,
45
+ ecsClaims: options.ecsClaims,
43
46
  authorizationService: options.authorizationService,
44
47
  discoveryOptions: options.discoveryOptions,
45
48
  });
@@ -1 +1 @@
1
- {"version":3,"file":"createVsAgent.js","sourceRoot":"","sources":["../../src/agent/createVsAgent.ts"],"names":[],"mappings":";;AAkEA,sCAyBC;AAlFD,uCAAqD;AAgCrD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,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,GAC/D;QACD,OAAO,EAAE,aAAa;QACtB,YAAY,EAAE,OAAO,CAAC,YAAY;QAClC,GAAG,EAAE,OAAO,CAAC,GAAG;QAChB,uBAAuB,EAAE,OAAO,CAAC,uBAAuB;QACxD,gBAAgB,EAAE,OAAO,CAAC,gBAAgB;QAC1C,uBAAuB,EAAE,OAAO,CAAC,uBAAuB;QACxD,iBAAiB,EAAE,OAAO,CAAC,iBAAiB;QAC5C,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,oBAAoB,EAAE,OAAO,CAAC,oBAAoB;QAClD,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,oBAAoB,EAAE,OAAO,CAAC,oBAAoB;QAClD,gBAAgB,EAAE,OAAO,CAAC,gBAAgB;KAC3C,CAAC,CAAA;AACJ,CAAC"}
@@ -0,0 +1,53 @@
1
+ import type { BaseAgentModules, VsAgent } from '../agent/VsAgent';
2
+ import { ParticipantRole } from './types';
3
+ export declare const REQUESTED_CREDENTIAL_SCHEMAS_METADATA = "_2060/requestedCredentialSchemas";
4
+ export declare enum AnonCredsTrustProblemCode {
5
+ IssuerNotAuthorized = "e.p.issuer-not-authorized",
6
+ TrustResolutionUnavailable = "e.p.trust-resolution-unavailable"
7
+ }
8
+ export declare enum AnonCredsTrustErrorReason {
9
+ NotDerivable = "not-derivable",
10
+ NotAuthorized = "not-authorized",
11
+ Unavailable = "unavailable"
12
+ }
13
+ export declare class AnonCredsTrustError extends Error {
14
+ readonly reason: AnonCredsTrustErrorReason;
15
+ constructor(reason: AnonCredsTrustErrorReason, message: string);
16
+ }
17
+ export type AnonCredsObjectReference = {
18
+ credentialDefinitionId: string;
19
+ } | {
20
+ schemaId: string;
21
+ };
22
+ export interface DerivedCredentialSchema {
23
+ credentialSchemaId: number;
24
+ ecosystemDid: string;
25
+ jsonSchemaCredentialId: string;
26
+ anonCredsSchemaId: string;
27
+ issuerId?: string;
28
+ }
29
+ export interface UnaccreditedDidsResult {
30
+ unaccredited: string[];
31
+ unchecked: string[];
32
+ }
33
+ export declare class AnonCredsTrustService {
34
+ private readonly agent;
35
+ private readonly derivations;
36
+ private readonly credentialSchemaLinks;
37
+ constructor(agent: VsAgent<BaseAgentModules>);
38
+ deriveCredentialSchema(reference: AnonCredsObjectReference): Promise<DerivedCredentialSchema>;
39
+ assertAuthorized(options: {
40
+ did: string;
41
+ role: ParticipantRole;
42
+ credentialSchemaId: number;
43
+ }): Promise<void>;
44
+ assertOwnAuthorization(options: {
45
+ role: ParticipantRole;
46
+ credentialSchemaId: number;
47
+ }): Promise<void>;
48
+ findUnaccreditedDids(dids: string[], role: ParticipantRole, credentialSchemaId: number): Promise<UnaccreditedDidsResult>;
49
+ private resolveAnonCredsObject;
50
+ private resolveCredentialSchemaLink;
51
+ private requireFromIndexer;
52
+ private verifyVtjscProof;
53
+ }