@verana-labs/vs-agent-sdk 2.0.0-dev.7 → 2.0.0-dev.70

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 (166) hide show
  1. package/README.md +0 -2
  2. package/build/adminApi/AdminApiError.d.ts +27 -0
  3. package/build/adminApi/AdminApiError.js +59 -0
  4. package/build/adminApi/AdminApiError.js.map +1 -0
  5. package/build/adminApi/didcommModules.d.ts +2 -0
  6. package/build/adminApi/didcommModules.js +8 -0
  7. package/build/adminApi/didcommModules.js.map +1 -0
  8. package/build/adminApi/index.d.ts +4 -0
  9. package/build/adminApi/index.js +21 -0
  10. package/build/adminApi/index.js.map +1 -0
  11. package/build/adminApi/moduleEndpoint.d.ts +8 -0
  12. package/build/adminApi/moduleEndpoint.js +28 -0
  13. package/build/adminApi/moduleEndpoint.js.map +1 -0
  14. package/build/adminApi/pagination/PageDto.d.ts +7 -0
  15. package/build/adminApi/pagination/PageDto.js +50 -0
  16. package/build/adminApi/pagination/PageDto.js.map +1 -0
  17. package/build/adminApi/pagination/PaginationQueryDto.d.ts +11 -0
  18. package/build/adminApi/pagination/PaginationQueryDto.js +46 -0
  19. package/build/adminApi/pagination/PaginationQueryDto.js.map +1 -0
  20. package/build/adminApi/pagination/cursor.d.ts +28 -0
  21. package/build/adminApi/pagination/cursor.js +64 -0
  22. package/build/adminApi/pagination/cursor.js.map +1 -0
  23. package/build/adminApi/pagination/index.d.ts +4 -0
  24. package/build/adminApi/pagination/index.js +21 -0
  25. package/build/adminApi/pagination/index.js.map +1 -0
  26. package/build/adminApi/pagination/paginate.d.ts +27 -0
  27. package/build/adminApi/pagination/paginate.js +77 -0
  28. package/build/adminApi/pagination/paginate.js.map +1 -0
  29. package/build/agent/VsAgent.d.ts +17 -34
  30. package/build/agent/VsAgent.js +75 -205
  31. package/build/agent/VsAgent.js.map +1 -1
  32. package/build/agent/createVsAgent.d.ts +5 -6
  33. package/build/agent/createVsAgent.js +3 -5
  34. package/build/agent/createVsAgent.js.map +1 -1
  35. package/build/blockchain/AnonCredsTrustService.d.ts +62 -0
  36. package/build/blockchain/AnonCredsTrustService.js +256 -0
  37. package/build/blockchain/AnonCredsTrustService.js.map +1 -0
  38. package/build/blockchain/AuthorizationService.d.ts +5 -3
  39. package/build/blockchain/AuthorizationService.js +17 -29
  40. package/build/blockchain/AuthorizationService.js.map +1 -1
  41. package/build/blockchain/IndexerWebSocketService.d.ts +7 -1
  42. package/build/blockchain/IndexerWebSocketService.js +68 -36
  43. package/build/blockchain/IndexerWebSocketService.js.map +1 -1
  44. package/build/blockchain/VeranaChainService.d.ts +25 -14
  45. package/build/blockchain/VeranaChainService.js +123 -113
  46. package/build/blockchain/VeranaChainService.js.map +1 -1
  47. package/build/blockchain/VeranaIndexerService.d.ts +14 -1
  48. package/build/blockchain/VeranaIndexerService.js +122 -8
  49. package/build/blockchain/VeranaIndexerService.js.map +1 -1
  50. package/build/blockchain/handlers/authorizationHandlers.js +2 -2
  51. package/build/blockchain/handlers/authorizationHandlers.js.map +1 -1
  52. package/build/blockchain/handlers/defaultHandlers.js +2 -0
  53. package/build/blockchain/handlers/defaultHandlers.js.map +1 -1
  54. package/build/blockchain/handlers/index.d.ts +1 -0
  55. package/build/blockchain/handlers/index.js +1 -0
  56. package/build/blockchain/handlers/index.js.map +1 -1
  57. package/build/blockchain/handlers/selfIssuanceHandlers.d.ts +13 -0
  58. package/build/blockchain/handlers/selfIssuanceHandlers.js +71 -0
  59. package/build/blockchain/handlers/selfIssuanceHandlers.js.map +1 -0
  60. package/build/blockchain/handlers/stateMutations.d.ts +21 -2
  61. package/build/blockchain/handlers/stateMutations.js +285 -37
  62. package/build/blockchain/handlers/stateMutations.js.map +1 -1
  63. package/build/blockchain/index.d.ts +2 -0
  64. package/build/blockchain/index.js +2 -0
  65. package/build/blockchain/index.js.map +1 -1
  66. package/build/blockchain/indexerMappers.d.ts +3 -0
  67. package/build/blockchain/indexerMappers.js +53 -0
  68. package/build/blockchain/indexerMappers.js.map +1 -0
  69. package/build/blockchain/types.d.ts +13 -58
  70. package/build/blockchain/types.js.map +1 -1
  71. package/build/bootstrap/EcsBootstrapService.d.ts +14 -3
  72. package/build/bootstrap/EcsBootstrapService.js +166 -76
  73. package/build/bootstrap/EcsBootstrapService.js.map +1 -1
  74. package/build/connections/ParentConnectionModule.d.ts +20 -0
  75. package/build/connections/ParentConnectionModule.js +56 -0
  76. package/build/connections/ParentConnectionModule.js.map +1 -0
  77. package/build/credentials/FullTailsFileService.d.ts +0 -1
  78. package/build/credentials/FullTailsFileService.js +0 -49
  79. package/build/credentials/FullTailsFileService.js.map +1 -1
  80. package/build/did/CachedDocumentLoader.d.ts +3 -0
  81. package/build/did/CachedDocumentLoader.js +7 -1
  82. package/build/did/CachedDocumentLoader.js.map +1 -1
  83. package/build/did/CachedWebDidResolver.d.ts +0 -4
  84. package/build/did/CachedWebDidResolver.js +1 -5
  85. package/build/did/CachedWebDidResolver.js.map +1 -1
  86. package/build/did/artifactServices.d.ts +12 -0
  87. package/build/did/artifactServices.js +48 -0
  88. package/build/did/artifactServices.js.map +1 -0
  89. package/build/did/legacyDidWeb.d.ts +6 -4
  90. package/build/did/legacyDidWeb.js +17 -14
  91. package/build/did/legacyDidWeb.js.map +1 -1
  92. package/build/did/publicDid.d.ts +4 -0
  93. package/build/did/publicDid.js +19 -0
  94. package/build/did/publicDid.js.map +1 -0
  95. package/build/events/BaseMessageEvents.js +139 -5
  96. package/build/events/BaseMessageEvents.js.map +1 -1
  97. package/build/events/ConnectionEvents.js +129 -82
  98. package/build/events/ConnectionEvents.js.map +1 -1
  99. package/build/events/VsAgentEvents.d.ts +11 -9
  100. package/build/events/VsAgentEvents.js +8 -1
  101. package/build/events/VsAgentEvents.js.map +1 -1
  102. package/build/events/VtFlowEvents.d.ts +1 -1
  103. package/build/events/VtFlowEvents.js +27 -18
  104. package/build/events/VtFlowEvents.js.map +1 -1
  105. package/build/index.d.ts +7 -1
  106. package/build/index.js +15 -2
  107. package/build/index.js.map +1 -1
  108. package/build/plugins/setupBaseDidComm.js +9 -12
  109. package/build/plugins/setupBaseDidComm.js.map +1 -1
  110. package/build/transports/VsAgentWsInboundTransport.d.ts +1 -1
  111. package/build/transports/VsAgentWsInboundTransport.js +20 -14
  112. package/build/transports/VsAgentWsInboundTransport.js.map +1 -1
  113. package/build/types.d.ts +7 -0
  114. package/build/types.js.map +1 -1
  115. package/build/utils/agent.d.ts +29 -4
  116. package/build/utils/agent.js +91 -22
  117. package/build/utils/agent.js.map +1 -1
  118. package/build/utils/didReadiness.d.ts +9 -0
  119. package/build/utils/didReadiness.js +42 -0
  120. package/build/utils/didReadiness.js.map +1 -0
  121. package/build/utils/ecsClaims.d.ts +47 -0
  122. package/build/utils/ecsClaims.js +120 -0
  123. package/build/utils/ecsClaims.js.map +1 -0
  124. package/build/utils/ecsService.d.ts +8 -0
  125. package/build/utils/ecsService.js +23 -0
  126. package/build/utils/ecsService.js.map +1 -0
  127. package/build/utils/index.d.ts +4 -0
  128. package/build/utils/index.js +4 -0
  129. package/build/utils/index.js.map +1 -1
  130. package/build/utils/selfIssuedEcsCredential.d.ts +8 -0
  131. package/build/utils/selfIssuedEcsCredential.js +151 -0
  132. package/build/utils/selfIssuedEcsCredential.js.map +1 -0
  133. package/build/utils/setupSelfTr.d.ts +34 -66
  134. package/build/utils/setupSelfTr.js +89 -295
  135. package/build/utils/setupSelfTr.js.map +1 -1
  136. package/build/utils/trustCredentialStore.d.ts +67 -9
  137. package/build/utils/trustCredentialStore.js +296 -111
  138. package/build/utils/trustCredentialStore.js.map +1 -1
  139. package/build/utils/util.d.ts +10 -0
  140. package/build/utils/util.js +16 -0
  141. package/build/utils/util.js.map +1 -1
  142. package/build/utils/vcdm2.d.ts +34 -0
  143. package/build/utils/vcdm2.js +62 -0
  144. package/build/utils/vcdm2.js.map +1 -0
  145. package/build/utils/vtjscResolver.d.ts +18 -0
  146. package/build/utils/vtjscResolver.js +54 -0
  147. package/build/utils/vtjscResolver.js.map +1 -0
  148. package/build/vtFlow/VtFlowOrchestrator.d.ts +84 -13
  149. package/build/vtFlow/VtFlowOrchestrator.js +505 -107
  150. package/build/vtFlow/VtFlowOrchestrator.js.map +1 -1
  151. package/build/vtFlow/assertVerifiableService.d.ts +1 -0
  152. package/build/vtFlow/assertVerifiableService.js +45 -5
  153. package/build/vtFlow/assertVerifiableService.js.map +1 -1
  154. package/build/vtFlow/ecsIssuanceExemption.d.ts +12 -0
  155. package/build/vtFlow/ecsIssuanceExemption.js +84 -0
  156. package/build/vtFlow/ecsIssuanceExemption.js.map +1 -0
  157. package/build/vtFlow/index.d.ts +1 -0
  158. package/build/vtFlow/index.js +1 -0
  159. package/build/vtFlow/index.js.map +1 -1
  160. package/package.json +17 -12
  161. package/build/did/migrateWebVhLog.d.ts +0 -34
  162. package/build/did/migrateWebVhLog.js +0 -230
  163. package/build/did/migrateWebVhLog.js.map +0 -1
  164. package/build/did/migrateWebVhVersionTime.d.ts +0 -9
  165. package/build/did/migrateWebVhVersionTime.js +0 -191
  166. package/build/did/migrateWebVhVersionTime.js.map +0 -1
@@ -3,55 +3,27 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.setupSelfTr = exports.mapToSelfTr = exports.linkedVpFragment = exports.createJsonSubjectRef = exports.createJsonSchema = exports.credentials = exports.presentations = void 0;
6
+ exports.sortKeysDeep = exports.linkedVpFragment = exports.linkedVpSchemaId = exports.createJsonSubjectRef = exports.createJsonSchema = void 0;
7
7
  exports.createCredential = createCredential;
8
+ exports.getDataIntegrityCryptosuite = getDataIntegrityCryptosuite;
8
9
  exports.signerW3c = signerW3c;
9
- exports.generateVerifiablePresentation = generateVerifiablePresentation;
10
10
  exports.createPresentation = createPresentation;
11
11
  exports.getClaims = getClaims;
12
+ exports.schemaViolations = schemaViolations;
12
13
  exports.validateSchema = validateSchema;
13
14
  exports.addDigestSRI = addDigestSRI;
14
15
  exports.generateDigestSRI = generateDigestSRI;
15
- exports.urlDigestSri = urlDigestSri;
16
16
  exports.getVerificationMethodId = getVerificationMethodId;
17
17
  const core_1 = require("@credo-ts/core");
18
- // No type definitions available for this library
19
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
20
- //@ts-expect-error
21
- const jsonld_signatures_1 = require("@digitalcredentials/jsonld-signatures");
18
+ const credo_ts_didcomm_vt_flow_1 = require("@verana-labs/credo-ts-didcomm-vt-flow");
22
19
  const vs_agent_model_1 = require("@verana-labs/vs-agent-model");
23
20
  const _2020_1 = __importDefault(require("ajv/dist/2020"));
24
21
  const ajv_formats_1 = __importDefault(require("ajv-formats"));
25
- const axios_1 = __importDefault(require("axios"));
26
22
  const crypto_1 = require("crypto");
27
- const data_1 = require("./data");
28
- const ajv = new _2020_1.default({ strict: false });
23
+ const ecsClaims_1 = require("./ecsClaims");
24
+ const vcdm2_1 = require("./vcdm2");
25
+ const ajv = new _2020_1.default({ strict: false, allErrors: true });
29
26
  (0, ajv_formats_1.default)(ajv);
30
- const DIGEST_FETCH_TIMEOUT_MS = 5000;
31
- // Helpers
32
- exports.presentations = [
33
- {
34
- name: 'ecs-service',
35
- schemaUrl: `ecosystem/schemas-example-service-jsc.json`,
36
- },
37
- {
38
- name: 'ecs-org',
39
- schemaUrl: `ecosystem/schemas-example-org-jsc.json`,
40
- },
41
- ];
42
- exports.credentials = [
43
- {
44
- name: 'example-service',
45
- credUrl: `ecosystem/cs/v1/js/ecs-service`,
46
- schemaUrl: `ecosystem/schemas-example-service-jsc.json`,
47
- },
48
- {
49
- name: 'example-org',
50
- credUrl: `ecosystem/cs/v1/js/ecs-org`,
51
- schemaUrl: `ecosystem/schemas-example-org-jsc.json`,
52
- },
53
- ];
54
- // Default JSON Schema objects
55
27
  exports.createJsonSchema = {
56
28
  id: 'https://www.w3.org/ns/credentials/json-schema/v2.json',
57
29
  type: 'JsonSchema',
@@ -67,225 +39,71 @@ const createJsonSubjectRef = (id) => ({
67
39
  });
68
40
  exports.createJsonSubjectRef = createJsonSubjectRef;
69
41
  // fragment format per [VT-CRED-W3C-LINKED-VP]
70
- const linkedVpFragment = (schemaKey) => `vpr-schemas-${schemaKey.replace(/^ecs-/, '')}-vtc-vp`;
42
+ const linkedVpSchemaId = (schemaKey) => schemaKey.replace(/^ecs-/, '');
43
+ exports.linkedVpSchemaId = linkedVpSchemaId;
44
+ const linkedVpFragment = (schemaKey) => `vpr-schemas-${(0, exports.linkedVpSchemaId)(schemaKey)}-vtc-vp`;
71
45
  exports.linkedVpFragment = linkedVpFragment;
72
- const mapToSelfTr = (url, publicApiBaseUrl) => url.replace('ecosystem', `${publicApiBaseUrl}/vt`);
73
- exports.mapToSelfTr = mapToSelfTr;
74
- const buildIntegrityData = (data) => {
75
- return generateDigestSRI(JSON.stringify(data, Object.keys(data).sort()));
46
+ // A plain array replacer only allowlists property names, applied at every
47
+ // nesting level — nested objects like `claims` and `credentialSchema` would
48
+ // serialize to `{}` since none of their own keys appear in a top-level
49
+ // key list. Sort keys recursively instead, so the hash actually reflects
50
+ // nested content and changes to claims invalidate the cache correctly.
51
+ const sortKeysDeep = (value) => {
52
+ if (Array.isArray(value))
53
+ return value.map(exports.sortKeysDeep);
54
+ if (value !== null && typeof value === 'object') {
55
+ return Object.keys(value)
56
+ .sort()
57
+ .reduce((acc, key) => {
58
+ acc[key] = (0, exports.sortKeysDeep)(value[key]);
59
+ return acc;
60
+ }, {});
61
+ }
62
+ return value;
76
63
  };
77
- const setupSelfTr = async ({ agent, publicApiBaseUrl, defaults, }) => {
78
- const ecsSchemas = (0, data_1.getEcsSchemas)(publicApiBaseUrl);
79
- const logger = agent.config.logger;
80
- for (const { name, schemaUrl } of exports.presentations) {
81
- try {
82
- await generateVerifiablePresentation(agent, `${publicApiBaseUrl}/vt/${name}-vtc-vp.json`, ecsSchemas, name, ['VerifiableCredential', 'VerifiableTrustCredential'], {
83
- id: (0, exports.mapToSelfTr)(schemaUrl, publicApiBaseUrl),
84
- type: 'JsonSchemaCredential',
85
- }, defaults);
86
- }
87
- catch (error) {
88
- logger.warn(`Skipping self-issued ${name}: ${error instanceof Error ? error.message : error}`);
89
- }
90
- }
91
- for (const { name, credUrl, schemaUrl } of exports.credentials) {
92
- const id = (0, exports.mapToSelfTr)(schemaUrl, publicApiBaseUrl);
93
- const ref = (0, exports.mapToSelfTr)(credUrl, publicApiBaseUrl);
94
- try {
95
- await generateVerifiableCredential(agent, id, ecsSchemas, name, ['VerifiableCredential', 'JsonSchemaCredential'], (0, exports.createJsonSubjectRef)(ref), exports.createJsonSchema, defaults);
96
- }
97
- catch (error) {
98
- logger.warn(`Skipping self-issued ${name}: ${error instanceof Error ? error.message : error}`);
99
- }
100
- }
101
- };
102
- exports.setupSelfTr = setupSelfTr;
64
+ exports.sortKeysDeep = sortKeysDeep;
103
65
  /**
104
- * Generates and signs a verifiable credential using the agent's DID.
105
- * Stores the signed credential and its integrity metadata in the DID record.
106
- *
107
- * - If the claims for the subject are not provided, they are retrieved (default claims) and validated against the schema.
108
- * - The integrity of the claims is tracked using a Subresource Integrity (SRI) digest.
109
- * - If a credential with the same integrity already exists in the DID metadata, it is returned directly.
110
- * - Otherwise, a new credential is created, signed, and stored in the DID metadata.
111
- * - If a presentation is provided, the signed credential is embedded and a signed presentation is returned.
112
- *
113
- * @param agent - The VsAgent instance used for signing and DID management.
114
- * @param logger - Logger instance for logging operations.
115
- * @param ecsSchemas - Map of ECS schemas for validation.
116
- * @param schemaKey - Unique identifier for the credential type and metadata key.
117
- * @param type - Array of credential types (e.g., ['VerifiableCredential']).
118
- * @param subject - Subject information, including ID and optional claims.
119
- * @param credentialSchema - Schema definition for the credential.
120
- * @param presentation - Optional presentation to include the credential.
121
- * @returns The signed verifiable credential or presentation, with integrity metadata.
66
+ * Builds an unsigned credential: a VC Data Model 2.0 credential, as
67
+ * [VT-CRED-W3C] and [VT-JSON-SCHEMA-CRED-W3C] require the `https://www.w3.org/ns/credentials/v2`
68
+ * context, valid from now for ten years unless told otherwise.
122
69
  */
123
- async function generateVerifiableCredential(agent, id, ecsSchemas, schemaKey, type, subject, credentialSchema, defaults, presentation) {
124
- var _a;
125
- const logger = agent.config.logger;
126
- const [didRecord] = await agent.dids.getCreatedDids({ did: agent.did });
127
- const { id: subjectId } = subject;
128
- let claims = subject.claims;
129
- if (!claims) {
130
- claims = await getClaims(logger, ecsSchemas, { id: subjectId }, schemaKey, defaults);
131
- }
132
- const integrityData = buildIntegrityData({ id, type, credentialSchema, claims });
133
- const record = (_a = didRecord.metadata.get('_vt/jsc')) !== null && _a !== void 0 ? _a : {};
134
- const metadata = record[subjectId];
135
- if ((metadata === null || metadata === void 0 ? void 0 : metadata.integrityData) === integrityData)
136
- return metadata.credential;
137
- const unsignedCredential = createCredential({
138
- id,
139
- type,
140
- issuer: agent.did,
141
- credentialSubject: {
142
- id: subjectId,
143
- claims: presentation ? claims : await addDigestSRI(subjectId, claims, ecsSchemas),
144
- },
145
- });
146
- unsignedCredential.credentialSchema = presentation
147
- ? credentialSchema
148
- : await addDigestSRI(credentialSchema.id, credentialSchema, ecsSchemas);
149
- // Note: this is dependant on DIDComm invitation keys. Not sure if it is fine or we should use a dedicated
150
- // key for this feature
151
- const verificationMethodId = getVerificationMethodId(logger, didRecord);
152
- const signedCredential = await signerW3c(agent, unsignedCredential, verificationMethodId);
153
- if (presentation) {
154
- presentation.verifiableCredential = [signedCredential];
155
- return await signerW3c(agent, presentation, verificationMethodId);
156
- }
157
- else {
158
- record[subjectId] = {
159
- credential: signedCredential.jsonCredential,
160
- verifiablePresentation: {},
161
- didDocumentServiceId: '',
162
- integrityData,
163
- };
164
- didRecord.metadata.set('_vt/jsc', record);
165
- await agent.context.dependencyManager.resolve(core_1.DidRepository).update(agent.context, didRecord);
166
- return signedCredential.jsonCredential;
167
- }
168
- }
169
70
  function createCredential(options) {
170
- var _a, _b, _c;
171
- (_a = options.context) !== null && _a !== void 0 ? _a : (options.context = [
172
- 'https://www.w3.org/2018/credentials/v1',
173
- 'https://www.w3.org/ns/credentials/examples/v2',
174
- ]);
175
- (_b = options.issuanceDate) !== null && _b !== void 0 ? _b : (options.issuanceDate = new Date().toISOString());
176
- (_c = options.expirationDate) !== null && _c !== void 0 ? _c : (options.expirationDate = new Date(Date.now() + 10 * 365 * 24 * 60 * 60 * 1000).toISOString());
177
- return new core_1.W3cCredential(options);
71
+ return (0, vcdm2_1.createW3cV2Credential)(options);
72
+ }
73
+ /**
74
+ * The Data Integrity cryptosuite this agent is configured with, read from the registered
75
+ * `VtFlowModuleConfig` so the self issued credentials are secured and linked VPs with the
76
+ * same suite `VtFlowApi.issueCredentialForSession` applies to the credentials it issues. Falls back
77
+ * to the module default when the vt-flow module is not registered on the agent.
78
+ */
79
+ function getDataIntegrityCryptosuite(agent) {
80
+ const { dependencyManager } = agent.context;
81
+ return dependencyManager.isRegistered(credo_ts_didcomm_vt_flow_1.VtFlowModuleConfig)
82
+ ? dependencyManager.resolve(credo_ts_didcomm_vt_flow_1.VtFlowModuleConfig).dataIntegrityCryptosuite
83
+ : credo_ts_didcomm_vt_flow_1.DEFAULT_DATA_INTEGRITY_CRYPTOSUITE;
178
84
  }
179
85
  async function signerW3c(agent, obj, verificationMethod) {
180
- const proofPurpose = new jsonld_signatures_1.purposes.AssertionProofPurpose();
181
- if (obj instanceof core_1.W3cCredential) {
182
- return await agent.w3cCredentials.signCredential({
183
- format: core_1.ClaimFormat.LdpVc,
86
+ const cryptosuite = getDataIntegrityCryptosuite(agent);
87
+ if (obj instanceof core_1.W3cV2Credential) {
88
+ return await agent.w3cV2Credentials.signCredential({
89
+ format: core_1.ClaimFormat.DiVc,
184
90
  credential: obj,
185
- proofType: 'Ed25519Signature2020',
91
+ cryptosuite,
186
92
  verificationMethod,
187
- proofPurpose,
188
93
  });
189
94
  }
190
- if (obj instanceof core_1.W3cPresentation) {
191
- return await agent.w3cCredentials.signPresentation({
192
- format: core_1.ClaimFormat.LdpVp,
193
- presentation: obj,
194
- proofType: 'Ed25519Signature2020',
195
- verificationMethod,
196
- proofPurpose,
197
- });
198
- }
199
- }
200
- /**
201
- * Generates and signs a verifiable presentation containing a verifiable credential.
202
- * Stores the signed presentation and its integrity metadata in the DID record.
203
- *
204
- * - Retrieves and validates claims for the agent's DID.
205
- * - Computes an integrity digest for the claims.
206
- * - If a presentation with the same integrity already exists in the DID metadata, it is returned.
207
- * - Otherwise, a new presentation is created, signed, and stored in the DID metadata.
208
- *
209
- * @param agent - The VsAgent instance used for signing and DID management.
210
- * @param logger - Logger instance for logging operations.
211
- * @param ecsSchemas - Map of ECS schemas for validation.
212
- * @param schemaKey - Unique identifier for the presentation type and metadata key.
213
- * @param type - Array of credential types to include.
214
- * @param credentialSchema - Schema definition for the credential.
215
- * @returns The signed verifiable presentation, with integrity metadata.
216
- */
217
- async function generateVerifiablePresentation(agent, id, ecsSchemas, schemaKey, type, credentialSchema, defaults) {
218
- var _a, _b, _c, _d, _e;
219
- if (!agent.did)
220
- throw Error('The DID must be set up');
221
- const [didRecord] = await agent.dids.getCreatedDids({ did: agent.did });
222
- const didDocument = didRecord.didDocument;
223
- if (!didDocument)
224
- throw Error('The DID Document be set up');
225
- const claims = await getClaims(agent.config.logger, ecsSchemas, { id: agent.did }, schemaKey, defaults);
226
- // Use full input for integrityData to ensure update detection
227
- const didDocumentServiceId = `${agent.did}#${(0, exports.linkedVpFragment)(schemaKey)}`;
228
- const integrityData = buildIntegrityData({ id, type, credentialSchema, claims });
229
- const record = (_a = didRecord.metadata.get('_vt/vtc')) !== null && _a !== void 0 ? _a : {};
230
- const metadata = record[credentialSchema.id];
231
- const attached = (_b = metadata === null || metadata === void 0 ? void 0 : metadata.attached) !== null && _b !== void 0 ? _b : true;
232
- if ((metadata === null || metadata === void 0 ? void 0 : metadata.integrityData) === integrityData)
233
- return metadata.verifiablePresentation;
234
- const presentation = createPresentation({
235
- id,
236
- holder: agent.did,
237
- verifiableCredential: [],
95
+ // The options type requires a challenge for every presentation format, while a Data Integrity
96
+ // proof only carries one when it is given
97
+ return await agent.w3cV2Credentials.signPresentation({
98
+ format: core_1.ClaimFormat.DiVp,
99
+ presentation: obj,
100
+ cryptosuite,
101
+ verificationMethod,
238
102
  });
239
- const verifiablePresentation = await generateVerifiableCredential(agent, agent.did, ecsSchemas, schemaKey, type, { id: agent.did }, credentialSchema, defaults, presentation);
240
- // Update linked VP when the presentation has changed
241
- if (attached)
242
- didDocument.service = (_c = didDocument.service) === null || _c === void 0 ? void 0 : _c.map(s => {
243
- if (typeof s.serviceEndpoint !== 'string')
244
- return s;
245
- if (s.serviceEndpoint.includes(schemaKey) && s.id !== `${agent.did}#whois`) {
246
- s.id = didDocumentServiceId;
247
- s.serviceEndpoint = id;
248
- }
249
- return s;
250
- });
251
- // Resolvers only discover the credential through the [VT-CRED-W3C-LINKED-VP] fragment, and
252
- // #whois does not match it. The rename above only covers documents that already carry the
253
- // service, so publish it here when nothing declared it yet.
254
- let didDocumentChanged = false;
255
- if (attached && !((_d = didDocument.service) === null || _d === void 0 ? void 0 : _d.some(s => s.id === didDocumentServiceId))) {
256
- didDocument.service = [
257
- ...((_e = didDocument.service) !== null && _e !== void 0 ? _e : []),
258
- new core_1.DidDocumentService({
259
- id: didDocumentServiceId,
260
- serviceEndpoint: id,
261
- type: 'LinkedVerifiablePresentation',
262
- }),
263
- ];
264
- didDocumentChanged = true;
265
- }
266
- const credential = verifiablePresentation.verifiableCredential[0];
267
- record[credentialSchema.id] = {
268
- credential,
269
- verifiablePresentation,
270
- didDocumentServiceId,
271
- integrityData,
272
- attached,
273
- };
274
- didRecord.metadata.set('_vt/vtc', record);
275
- await agent.context.dependencyManager.resolve(core_1.DidRepository).update(agent.context, didRecord);
276
- if (didDocumentChanged) {
277
- await agent.dids.update({ did: didRecord.did, didDocument });
278
- }
279
- return verifiablePresentation;
280
103
  }
104
+ /** Builds an unsigned VC Data Model 2.0 presentation; the class supplies the v2 context. */
281
105
  function createPresentation(options) {
282
- var _a, _b;
283
- (_a = options.context) !== null && _a !== void 0 ? _a : (options.context = [
284
- 'https://www.w3.org/2018/credentials/v1',
285
- 'https://www.w3.org/ns/credentials/examples/v2',
286
- ]);
287
- (_b = options.type) !== null && _b !== void 0 ? _b : (options.type = ['VerifiablePresentation']);
288
- return new core_1.W3cPresentation(options);
106
+ return new core_1.W3cV2Presentation(Object.assign({ type: ['VerifiablePresentation'] }, options));
289
107
  }
290
108
  /**
291
109
  * Retrieves and validates claims for a credential subject.
@@ -298,60 +116,43 @@ function createPresentation(options) {
298
116
  * @returns The validated claims object.
299
117
  * @throws If claims are invalid or schema is missing.
300
118
  */
301
- async function getClaims(logger, ecsSchemas, { id, claims }, schemaKey, defaults) {
302
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
303
- // Default claims fallback
304
- const logoUri = (_a = claims === null || claims === void 0 ? void 0 : claims.logoUri) !== null && _a !== void 0 ? _a : defaults.serviceLogoUri;
305
- const termsAndConditionsUri = (_b = claims === null || claims === void 0 ? void 0 : claims.termsAndConditionsUri) !== null && _b !== void 0 ? _b : defaults.serviceTermsAndConditions;
306
- const privacyPolicyUri = (_c = claims === null || claims === void 0 ? void 0 : claims.privacyPolicyUri) !== null && _c !== void 0 ? _c : defaults.servicePrivacyPolicy;
307
- claims =
308
- schemaKey === 'ecs-service'
309
- ? {
310
- name: (_d = claims === null || claims === void 0 ? void 0 : claims.name) !== null && _d !== void 0 ? _d : defaults.agentLabel,
311
- type: (_e = claims === null || claims === void 0 ? void 0 : claims.type) !== null && _e !== void 0 ? _e : defaults.serviceType,
312
- description: (_f = claims === null || claims === void 0 ? void 0 : claims.description) !== null && _f !== void 0 ? _f : defaults.serviceDescription,
313
- logoUri,
314
- logoDigestSri: (_h = (_g = claims === null || claims === void 0 ? void 0 : claims.logoDigestSri) !== null && _g !== void 0 ? _g : defaults.serviceLogoDigestSri) !== null && _h !== void 0 ? _h : (await urlDigestSri(logoUri)),
315
- minimumAgeRequired: (_j = claims === null || claims === void 0 ? void 0 : claims.minimumAgeRequired) !== null && _j !== void 0 ? _j : defaults.serviceMinimumAgeRequired,
316
- termsAndConditionsUri,
317
- termsAndConditionsDigestSri: (_l = (_k = claims === null || claims === void 0 ? void 0 : claims.termsAndConditionsDigestSri) !== null && _k !== void 0 ? _k : defaults.serviceTermsAndConditionsDigestSri) !== null && _l !== void 0 ? _l : (await urlDigestSri(termsAndConditionsUri)),
318
- privacyPolicyUri,
319
- privacyPolicyDigestSri: (_o = (_m = claims === null || claims === void 0 ? void 0 : claims.privacyPolicyDigestSri) !== null && _m !== void 0 ? _m : defaults.servicePrivacyPolicyDigestSri) !== null && _o !== void 0 ? _o : (await urlDigestSri(privacyPolicyUri)),
320
- }
321
- : {
322
- name: (_p = claims === null || claims === void 0 ? void 0 : claims.name) !== null && _p !== void 0 ? _p : defaults.agentLabel,
323
- logoUri,
324
- logoDigestSri: (_r = (_q = claims === null || claims === void 0 ? void 0 : claims.logoDigestSri) !== null && _q !== void 0 ? _q : defaults.serviceLogoDigestSri) !== null && _r !== void 0 ? _r : (await urlDigestSri(logoUri)),
325
- registryId: (_s = claims === null || claims === void 0 ? void 0 : claims.registryId) !== null && _s !== void 0 ? _s : defaults.orgRegistryId,
326
- registryUri: (_t = claims === null || claims === void 0 ? void 0 : claims.registryUri) !== null && _t !== void 0 ? _t : defaults.orgRegistryUri,
327
- address: (_u = claims === null || claims === void 0 ? void 0 : claims.address) !== null && _u !== void 0 ? _u : defaults.orgAddress,
328
- organizationKind: (_v = claims === null || claims === void 0 ? void 0 : claims.organizationKind) !== null && _v !== void 0 ? _v : defaults.orgOrganizationKind,
329
- countryCode: (_w = claims === null || claims === void 0 ? void 0 : claims.countryCode) !== null && _w !== void 0 ? _w : defaults.orgCountryCode,
330
- };
119
+ async function getClaims(logger, ecsSchemas, { id }, schemaKey, ecsClaims) {
120
+ const claims = await (0, ecsClaims_1.composeEcsClaims)(ecsClaims, schemaKey, logger);
121
+ if (!claims)
122
+ throw new Error(`No ECS_CLAIMS_* variable is set for ${schemaKey}`);
331
123
  const ecsSchema = ecsSchemas[schemaKey];
332
124
  if (!ecsSchema) {
333
125
  throw new Error(`Schema not defined in data schemas for schemaKey: ${schemaKey}`);
334
126
  }
335
- const credentialSubject = Object.assign({ id }, claims);
336
- validateSchema(JSON.parse(ecsSchema), credentialSubject);
127
+ validateSchema(JSON.parse(ecsSchema), Object.assign({ id }, claims));
337
128
  return claims;
338
129
  }
130
+ function schemaViolations(ecsSchema, credentialSubject) {
131
+ var _a, _b;
132
+ const validate = ajv.compile((_a = ecsSchema.properties) === null || _a === void 0 ? void 0 : _a.credentialSubject);
133
+ if (validate(credentialSubject))
134
+ return [];
135
+ return ((_b = validate.errors) !== null && _b !== void 0 ? _b : []).map(e => { var _a; return ({ path: e.instancePath, message: (_a = e.message) !== null && _a !== void 0 ? _a : e.keyword }); });
136
+ }
339
137
  /**
340
138
  * Validate a validateSchema object against the corresponding AJV schema.
341
139
  * Throws an Error if the schema is missing or validation fails.
342
140
  */
343
141
  function validateSchema(ecsSchema, credentialSubject) {
344
- var _a, _b;
345
- const validate = ajv.compile((_a = ecsSchema.properties) === null || _a === void 0 ? void 0 : _a.credentialSubject);
346
- const isValid = validate(credentialSubject);
347
- if (!isValid) {
348
- const errorDetails = (_b = validate.errors) === null || _b === void 0 ? void 0 : _b.map(e => ({
349
- message: e.message,
350
- path: e.instancePath,
351
- keyword: e.keyword,
352
- params: e.params,
353
- }));
354
- throw new Error(`Invalid claims for ${ecsSchema.$id}: ${JSON.stringify(errorDetails, null, 2)}`);
142
+ const violations = schemaViolations(ecsSchema, credentialSubject);
143
+ if (violations.length > 0) {
144
+ throw new Error(`Invalid claims for ${ecsSchema.$id}: ${JSON.stringify(violations, null, 2)}`);
145
+ }
146
+ }
147
+ async function fetchSchemaContent(id) {
148
+ try {
149
+ const response = await fetch((0, vs_agent_model_1.mapToEcosystem)(id));
150
+ if (!response.ok)
151
+ return { error: `${response.status} ${response.statusText}` };
152
+ return { content: await response.text() };
153
+ }
154
+ catch (error) {
155
+ return { error: error instanceof Error ? error.message : String(error) };
355
156
  }
356
157
  }
357
158
  /**
@@ -366,15 +167,16 @@ function validateSchema(ecsSchema, credentialSubject) {
366
167
  * @throws Error if both the fetch and local fallback fail.
367
168
  */
368
169
  async function addDigestSRI(id, data, ecsSchemas) {
170
+ var _a;
369
171
  if (!id || !data) {
370
172
  throw new Error(`id and data has requiered`);
371
173
  }
372
- const response = await fetch((0, vs_agent_model_1.mapToEcosystem)(id));
174
+ const fetched = await fetchSchemaContent(id);
373
175
  const key = id.split('/').pop();
374
176
  const fallbackSchema = key && (ecsSchemas === null || ecsSchemas === void 0 ? void 0 : ecsSchemas[key]);
375
- const schemaContent = response.ok ? await response.text() : fallbackSchema;
177
+ const schemaContent = (_a = fetched.content) !== null && _a !== void 0 ? _a : fallbackSchema;
376
178
  if (!schemaContent) {
377
- throw new Error(`Failed to fetch schema from ${id}: ${response.status} ${response.statusText}, and no local fallback found.`);
179
+ throw new Error(`Failed to fetch schema from ${id}: ${fetched.error}, and no local fallback found.`);
378
180
  }
379
181
  assertValidSchema(schemaContent, id);
380
182
  return Object.assign(Object.assign({}, data), { digestSRI: generateDigestSRI(schemaContent) });
@@ -406,14 +208,6 @@ function generateDigestSRI(content, algorithm = 'sha384') {
406
208
  const hash = (0, crypto_1.createHash)(algorithm).update(content).digest('base64');
407
209
  return `${algorithm}-${hash}`;
408
210
  }
409
- /**
410
- * Digest of the resource a credential references. Throws rather than attest content it could
411
- * not read: a wrong digestSRI is a false integrity claim in a signed credential.
412
- */
413
- async function urlDigestSri(url) {
414
- const response = await axios_1.default.get(url, { responseType: 'arraybuffer', timeout: DIGEST_FETCH_TIMEOUT_MS });
415
- return `sha384-${(0, crypto_1.createHash)('sha384').update(Buffer.from(response.data)).digest('base64')}`;
416
- }
417
211
  function getVerificationMethodId(logger, didRecord) {
418
212
  var _a, _b;
419
213
  try {
@@ -423,7 +217,7 @@ function getVerificationMethodId(logger, didRecord) {
423
217
  method.id === ((_b = (_a = didRecord.didDocument) === null || _a === void 0 ? void 0 : _a.assertionMethod) === null || _b === void 0 ? void 0 : _b[0]);
424
218
  });
425
219
  if (!verificationMethod) {
426
- throw new Error('Cannot find a suitable Ed25519Signature2020 verification method in DID Document');
220
+ throw new Error('Cannot find a suitable Ed25519 verification method in DID Document');
427
221
  }
428
222
  return verificationMethod.id;
429
223
  }
@@ -1 +1 @@
1
- {"version":3,"file":"setupSelfTr.js","sourceRoot":"","sources":["../../src/utils/setupSelfTr.ts"],"names":[],"mappings":";;;;;;AA2OA,4CAUC;AAyBD,8BA0BC;AAmBD,wEA6EC;AAED,gDAOC;AAaD,8BA0DC;AAMD,wCAcC;AAaD,oCAyBC;AA2BD,8CAGC;AAMD,oCAGC;AAED,0DAeC;AA1kBD,yCAcuB;AACvB,iDAAiD;AACjD,6DAA6D;AAC7D,kBAAkB;AAClB,6EAAgE;AAChE,gEAA4D;AAC5D,0DAAoD;AACpD,8DAAoC;AACpC,kDAAyB;AACzB,mCAAmC;AAInC,iCAAsC;AAEtC,MAAM,GAAG,GAAG,IAAI,eAAG,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAA;AACtC,IAAA,qBAAU,EAAC,GAAG,CAAC,CAAA;AAEf,MAAM,uBAAuB,GAAG,IAAI,CAAA;AAoBpC,UAAU;AACG,QAAA,aAAa,GAAG;IAC3B;QACE,IAAI,EAAE,aAAa;QACnB,SAAS,EAAE,4CAA4C;KACxD;IACD;QACE,IAAI,EAAE,SAAS;QACf,SAAS,EAAE,wCAAwC;KACpD;CACF,CAAA;AAEY,QAAA,WAAW,GAAG;IACzB;QACE,IAAI,EAAE,iBAAiB;QACvB,OAAO,EAAE,gCAAgC;QACzC,SAAS,EAAE,4CAA4C;KACxD;IACD;QACE,IAAI,EAAE,aAAa;QACnB,OAAO,EAAE,4BAA4B;QACrC,SAAS,EAAE,wCAAwC;KACpD;CACF,CAAA;AAED,8BAA8B;AACj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C,IAAI,KAAK,4BAA4B,CAAC;gBAC9F,MAAM,CAAC,EAAE,MAAK,MAAA,MAAA,SAAS,CAAC,WAAW,0CAAE,eAAe,0CAAG,CAAC,CAAC,CAAA,CAAA;SAAA,CAC5D,CAAA;QACD,IAAI,CAAC,kBAAkB,EAAE,CAAC;YACxB,MAAM,IAAI,KAAK,CAAC,oEAAoE,CAAC,CAAA;QACvF,CAAC;QACD,OAAO,kBAAkB,CAAC,EAAE,CAAA;IAC9B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,CAAC,KAAK,CAAC,uCAAuC,EAAE,KAAK,CAAC,CAAA;QAC5D,MAAM,KAAK,CAAA;IACb,CAAC;AACH,CAAC"}
@@ -1,22 +1,80 @@
1
- import { DidRecord, W3cJsonLdVerifiableCredential, W3cJsonLdVerifiablePresentation } from '@credo-ts/core';
1
+ import { DidRecord, W3cJsonLdVerifiableCredential, W3cJsonLdVerifiablePresentation, type W3cV2DataIntegritySecuredCredential, W3cV2DataIntegrityVerifiableCredential, W3cV2DataIntegrityVerifiablePresentation } from '@credo-ts/core';
2
2
  import { VsAgent } from '../agent/VsAgent';
3
- import { SelfTrDefaults } from './setupSelfTr';
3
+ import { EcsClaims } from './ecsClaims';
4
+ /**
5
+ * A trust credential the agent publishes from its DID Document: a VC Data Model 2.0 credential
6
+ * secured with a DataIntegrityProof, which is what the agent issues itself and receives over the
7
+ * RFC 0809 credential format, or a data model 1.1 credential carrying a linked data proof that an
8
+ * older issuer handed over.
9
+ */
10
+ export type TrustCredential = W3cJsonLdVerifiableCredential | W3cV2DataIntegrityVerifiableCredential;
11
+ export type TrustPresentation = W3cJsonLdVerifiablePresentation | W3cV2DataIntegrityVerifiablePresentation;
12
+ /**
13
+ * Wraps a VC Data Model 2.0 credential in a data model 2.0 presentation secured with a
14
+ * DataIntegrityProof under the cryptosuite the agent is configured with, the counterpart of the
15
+ * linked data proof a data model 1.1 linked VP carries. The presentation is published from the DID
16
+ * Document rather than presented to a verifier, so there is no challenge to bind; its proof purpose
17
+ * is `authentication`, as Data Integrity defines for presentations.
18
+ */
19
+ export declare function signLinkedDataIntegrityPresentation(agent: Pick<VsAgent, 'w3cV2Credentials' | 'context'>, options: {
20
+ id: string;
21
+ holder: string;
22
+ credential: W3cV2DataIntegrityVerifiableCredential;
23
+ verificationMethodId: string;
24
+ }): Promise<W3cV2DataIntegrityVerifiablePresentation>;
4
25
  export declare function findMetadataEntry(didRecord: DidRecord, key: '_vt/vtc' | '_vt/jsc', id?: string, jsonSchemaRef?: string): any;
5
- export declare function saveMetadataEntry(agent: VsAgent, didRecord: DidRecord, credential: W3cJsonLdVerifiableCredential, verifiablePresentation: W3cJsonLdVerifiablePresentation, didDocumentServiceId: string, key: '_vt/vtc' | '_vt/jsc', publicApiBaseUrl: string): Promise<void>;
6
- export declare function deleteMetadataEntry(agent: VsAgent, id: string, didRecord: DidRecord, key: '_vt/vtc' | '_vt/jsc', publicApiBaseUrl: string): Promise<{
26
+ export declare function saveMetadataEntry(agent: VsAgent, didRecord: DidRecord, credential: TrustCredential, verifiablePresentation: TrustPresentation, didDocumentServiceId: string, key: '_vt/vtc' | '_vt/jsc'): Promise<void>;
27
+ export declare function deleteMetadataEntry(agent: VsAgent, id: string, didRecord: DidRecord, key: '_vt/vtc' | '_vt/jsc'): Promise<{
7
28
  schemaId: any;
8
29
  } | null>;
9
- export declare function createVtc(agent: VsAgent, publicApiBaseUrl: string, id: string, credential: W3cJsonLdVerifiableCredential): Promise<W3cJsonLdVerifiablePresentation>;
30
+ export declare function createVtc(agent: VsAgent, publicApiBaseUrl: string, id: string, credential: TrustCredential): Promise<TrustPresentation>;
10
31
  export interface CreateJscOptions {
11
32
  schemaBaseId: string;
12
33
  jsonSchemaRef: string;
13
34
  precomputedDigestSRI?: string;
14
35
  }
15
- export declare function createJsc(agent: VsAgent, publicApiBaseUrl: string, ecsSchemas: Record<string, string>, options: CreateJscOptions): Promise<import("@credo-ts/core").W3cJsonCredential>;
16
- export declare function removeTrustCredential(agent: VsAgent, publicApiBaseUrl: string, schemaId: string, key: '_vt/jsc' | '_vt/vtc'): Promise<{
36
+ export declare function createJsc(agent: VsAgent, publicApiBaseUrl: string, ecsSchemas: Record<string, string>, options: CreateJscOptions): Promise<W3cV2DataIntegritySecuredCredential & {
37
+ id: string;
38
+ }>;
39
+ export declare function removeTrustCredential(agent: VsAgent, schemaId: string, key: '_vt/jsc' | '_vt/vtc'): Promise<{
17
40
  schemaId: any;
18
41
  } | null>;
19
- export declare function removeStoredTrustCredential(agent: VsAgent, publicApiBaseUrl: string, credentialExchangeRecordId: string): Promise<string | undefined>;
42
+ /**
43
+ * Removes the linked VP and the stored credential an exchange delivered, as
44
+ * [VSA-VTI-FLOW-OP-REVOKE] requires of the applicant. The credential is read from the RFC 0809
45
+ * format data of the exchange; exchanges earlier versions completed over other formats are not
46
+ * migrated. Returns the credential id, or `undefined` when none is found, in which case nothing is
47
+ * removed.
48
+ */
49
+ export declare function removeStoredTrustCredential(agent: VsAgent, credentialExchangeRecordId: string): Promise<string | undefined>;
20
50
  export declare function migrateVtjscServiceIds(agent: VsAgent): Promise<void>;
51
+ /**
52
+ * Takes the linked VPs of the given `_vt/jsc` entries out of the DID Document, publishing it once.
53
+ *
54
+ * The entries stay: `SelfTrController` serves them, and issued credentials name that URL in
55
+ * `credentialSchema.id`. Dropping one would 404 it and leave those credentials unverifiable.
56
+ */
57
+ export declare function detachVtjscPublications(agent: VsAgent, schemaRefs: readonly string[]): Promise<string[]>;
58
+ /**
59
+ * Puts a detached `_vt/jsc` entry back in the DID Document.
60
+ *
61
+ * The publication pass skips an entry whose digest still matches, so without this the agent would
62
+ * keep serving a VTJSC it never announces again.
63
+ */
64
+ export declare function reattachVtjscPublication(agent: VsAgent, schemaRef: string): Promise<boolean>;
21
65
  export declare function getTrustMetadata(didRecord: DidRecord, key: '_vt/vtc' | '_vt/jsc', schemaId?: string): any;
22
- export declare function rebindEcsCredentialSchema(agent: VsAgent, publicApiBaseUrl: string, schemaId: string, schemaKey: string, defaults: SelfTrDefaults): Promise<void>;
66
+ /**
67
+ * @param jsonSchemaCredentialId the VTJSC the Ecosystem published for this schema. Only the
68
+ * Ecosystem publishes it, so an agent that issues against another Corporation's Ecosystem must
69
+ * resolve it there — see resolveJsonSchemaCredentialId.
70
+ * @param issuerParticipantId this agent's ISSUER participant for the schema, which anchors the
71
+ * credential digest.
72
+ * @param schemaKey the ECS schema this agent issues against. Every ECS key is accepted; the caller
73
+ * reaches this function only for a schema the agent holds an active ISSUER entry on.
74
+ */
75
+ export declare function rebindEcsCredentialSchema(agent: VsAgent, publicApiBaseUrl: string, schemaId: string, schemaKey: string, ecsClaims: EcsClaims, jsonSchemaCredentialId: string, issuerParticipantId: number, onChainJsonSchema?: string): Promise<void>;
76
+ /**
77
+ * Withdraws the ECS credentials anchored against `issuerParticipantId`, and the #whois entry
78
+ * when the Service credential is among them.
79
+ */
80
+ export declare function withdrawSelfIssuedEcsCredentials(agent: VsAgent, issuerParticipantId: number): Promise<string[]>;