@verana-labs/vs-agent-sdk 2.0.0-dev.1 → 2.0.0-dev.100

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 (193) hide show
  1. package/README.md +0 -2
  2. package/build/adminApi/AdminApiError.d.ts +28 -0
  3. package/build/adminApi/AdminApiError.js +67 -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 +7 -0
  12. package/build/adminApi/moduleEndpoint.js +21 -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 +27 -34
  30. package/build/agent/VsAgent.js +102 -205
  31. package/build/agent/VsAgent.js.map +1 -1
  32. package/build/agent/createVsAgent.d.ts +9 -6
  33. package/build/agent/createVsAgent.js +5 -5
  34. package/build/agent/createVsAgent.js.map +1 -1
  35. package/build/blockchain/AnonCredsTrustService.d.ts +84 -0
  36. package/build/blockchain/AnonCredsTrustService.js +276 -0
  37. package/build/blockchain/AnonCredsTrustService.js.map +1 -0
  38. package/build/blockchain/AuthorizationService.d.ts +8 -6
  39. package/build/blockchain/AuthorizationService.js +30 -38
  40. package/build/blockchain/AuthorizationService.js.map +1 -1
  41. package/build/blockchain/IndexerWebSocketService.d.ts +7 -1
  42. package/build/blockchain/IndexerWebSocketService.js +67 -35
  43. package/build/blockchain/IndexerWebSocketService.js.map +1 -1
  44. package/build/blockchain/VeranaChainService.d.ts +38 -21
  45. package/build/blockchain/VeranaChainService.js +172 -140
  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/feePreflight.d.ts +32 -0
  51. package/build/blockchain/feePreflight.js +89 -0
  52. package/build/blockchain/feePreflight.js.map +1 -0
  53. package/build/blockchain/handlers/authorizationHandlers.js +2 -2
  54. package/build/blockchain/handlers/authorizationHandlers.js.map +1 -1
  55. package/build/blockchain/handlers/defaultHandlers.js +6 -1
  56. package/build/blockchain/handlers/defaultHandlers.js.map +1 -1
  57. package/build/blockchain/handlers/index.d.ts +1 -0
  58. package/build/blockchain/handlers/index.js +1 -0
  59. package/build/blockchain/handlers/index.js.map +1 -1
  60. package/build/blockchain/handlers/selfIssuanceHandlers.d.ts +13 -0
  61. package/build/blockchain/handlers/selfIssuanceHandlers.js +76 -0
  62. package/build/blockchain/handlers/selfIssuanceHandlers.js.map +1 -0
  63. package/build/blockchain/handlers/stateMutations.d.ts +26 -3
  64. package/build/blockchain/handlers/stateMutations.js +336 -42
  65. package/build/blockchain/handlers/stateMutations.js.map +1 -1
  66. package/build/blockchain/index.d.ts +4 -0
  67. package/build/blockchain/index.js +4 -0
  68. package/build/blockchain/index.js.map +1 -1
  69. package/build/blockchain/indexerMappers.d.ts +3 -0
  70. package/build/blockchain/indexerMappers.js +53 -0
  71. package/build/blockchain/indexerMappers.js.map +1 -0
  72. package/build/blockchain/triggerResolver.d.ts +26 -0
  73. package/build/blockchain/triggerResolver.js +110 -0
  74. package/build/blockchain/triggerResolver.js.map +1 -0
  75. package/build/blockchain/types.d.ts +14 -59
  76. package/build/blockchain/types.js.map +1 -1
  77. package/build/bootstrap/EcsBootstrapService.d.ts +16 -3
  78. package/build/bootstrap/EcsBootstrapService.js +214 -80
  79. package/build/bootstrap/EcsBootstrapService.js.map +1 -1
  80. package/build/connections/InvitationRecord.d.ts +50 -0
  81. package/build/connections/InvitationRecord.js +60 -0
  82. package/build/connections/InvitationRecord.js.map +1 -0
  83. package/build/connections/ParentConnectionModule.d.ts +22 -0
  84. package/build/connections/ParentConnectionModule.js +91 -0
  85. package/build/connections/ParentConnectionModule.js.map +1 -0
  86. package/build/credentials/FullTailsFileService.d.ts +0 -1
  87. package/build/credentials/FullTailsFileService.js +0 -49
  88. package/build/credentials/FullTailsFileService.js.map +1 -1
  89. package/build/did/CachedDocumentLoader.d.ts +3 -0
  90. package/build/did/CachedDocumentLoader.js +7 -1
  91. package/build/did/CachedDocumentLoader.js.map +1 -1
  92. package/build/did/CachedWebDidResolver.d.ts +0 -4
  93. package/build/did/CachedWebDidResolver.js +1 -5
  94. package/build/did/CachedWebDidResolver.js.map +1 -1
  95. package/build/did/artifactServices.d.ts +12 -0
  96. package/build/did/artifactServices.js +48 -0
  97. package/build/did/artifactServices.js.map +1 -0
  98. package/build/did/legacyDidWeb.d.ts +6 -4
  99. package/build/did/legacyDidWeb.js +17 -14
  100. package/build/did/legacyDidWeb.js.map +1 -1
  101. package/build/did/publicDid.d.ts +4 -0
  102. package/build/did/publicDid.js +19 -0
  103. package/build/did/publicDid.js.map +1 -0
  104. package/build/events/BaseMessageEvents.js +138 -14
  105. package/build/events/BaseMessageEvents.js.map +1 -1
  106. package/build/events/ConnectionEvents.js +149 -87
  107. package/build/events/ConnectionEvents.js.map +1 -1
  108. package/build/events/InvitationEvents.d.ts +6 -0
  109. package/build/events/InvitationEvents.js +57 -0
  110. package/build/events/InvitationEvents.js.map +1 -0
  111. package/build/events/VsAgentEvents.d.ts +18 -9
  112. package/build/events/VsAgentEvents.js +9 -1
  113. package/build/events/VsAgentEvents.js.map +1 -1
  114. package/build/events/VtFlowEvents.d.ts +1 -1
  115. package/build/events/VtFlowEvents.js +29 -17
  116. package/build/events/VtFlowEvents.js.map +1 -1
  117. package/build/events/index.d.ts +1 -0
  118. package/build/events/index.js +1 -0
  119. package/build/events/index.js.map +1 -1
  120. package/build/index.d.ts +9 -1
  121. package/build/index.js +20 -2
  122. package/build/index.js.map +1 -1
  123. package/build/plugins/setupBaseDidComm.js +20 -21
  124. package/build/plugins/setupBaseDidComm.js.map +1 -1
  125. package/build/transports/HttpInboundTransport.js +6 -1
  126. package/build/transports/HttpInboundTransport.js.map +1 -1
  127. package/build/transports/VsAgentWsInboundTransport.d.ts +1 -1
  128. package/build/transports/VsAgentWsInboundTransport.js +20 -14
  129. package/build/transports/VsAgentWsInboundTransport.js.map +1 -1
  130. package/build/types.d.ts +14 -13
  131. package/build/types.js +1 -2
  132. package/build/types.js.map +1 -1
  133. package/build/utils/agent.d.ts +42 -4
  134. package/build/utils/agent.js +126 -22
  135. package/build/utils/agent.js.map +1 -1
  136. package/build/utils/boundedFetch.d.ts +13 -0
  137. package/build/utils/boundedFetch.js +47 -0
  138. package/build/utils/boundedFetch.js.map +1 -0
  139. package/build/utils/didReadiness.d.ts +9 -0
  140. package/build/utils/didReadiness.js +42 -0
  141. package/build/utils/didReadiness.js.map +1 -0
  142. package/build/utils/ecsClaims.d.ts +46 -0
  143. package/build/utils/ecsClaims.js +115 -0
  144. package/build/utils/ecsClaims.js.map +1 -0
  145. package/build/utils/ecsService.d.ts +8 -0
  146. package/build/utils/ecsService.js +23 -0
  147. package/build/utils/ecsService.js.map +1 -0
  148. package/build/utils/index.d.ts +7 -0
  149. package/build/utils/index.js +7 -0
  150. package/build/utils/index.js.map +1 -1
  151. package/build/utils/publishedDidRecord.d.ts +15 -0
  152. package/build/utils/publishedDidRecord.js +83 -0
  153. package/build/utils/publishedDidRecord.js.map +1 -0
  154. package/build/utils/selfIssuedEcsCredential.d.ts +8 -0
  155. package/build/utils/selfIssuedEcsCredential.js +158 -0
  156. package/build/utils/selfIssuedEcsCredential.js.map +1 -0
  157. package/build/utils/setupSelfTr.d.ts +35 -70
  158. package/build/utils/setupSelfTr.js +92 -283
  159. package/build/utils/setupSelfTr.js.map +1 -1
  160. package/build/utils/trustCredentialStore.d.ts +87 -9
  161. package/build/utils/trustCredentialStore.js +352 -125
  162. package/build/utils/trustCredentialStore.js.map +1 -1
  163. package/build/utils/typeMetadata.d.ts +44 -0
  164. package/build/utils/typeMetadata.js +89 -0
  165. package/build/utils/typeMetadata.js.map +1 -0
  166. package/build/utils/util.d.ts +20 -0
  167. package/build/utils/util.js +29 -0
  168. package/build/utils/util.js.map +1 -1
  169. package/build/utils/vcdm2.d.ts +34 -0
  170. package/build/utils/vcdm2.js +60 -0
  171. package/build/utils/vcdm2.js.map +1 -0
  172. package/build/utils/vtjscResolver.d.ts +23 -0
  173. package/build/utils/vtjscResolver.js +53 -0
  174. package/build/utils/vtjscResolver.js.map +1 -0
  175. package/build/vtFlow/VtFlowOrchestrator.d.ts +108 -15
  176. package/build/vtFlow/VtFlowOrchestrator.js +695 -117
  177. package/build/vtFlow/VtFlowOrchestrator.js.map +1 -1
  178. package/build/vtFlow/assertVerifiableService.d.ts +31 -2
  179. package/build/vtFlow/assertVerifiableService.js +68 -10
  180. package/build/vtFlow/assertVerifiableService.js.map +1 -1
  181. package/build/vtFlow/ecsIssuanceExemption.d.ts +12 -0
  182. package/build/vtFlow/ecsIssuanceExemption.js +84 -0
  183. package/build/vtFlow/ecsIssuanceExemption.js.map +1 -0
  184. package/build/vtFlow/index.d.ts +1 -0
  185. package/build/vtFlow/index.js +1 -0
  186. package/build/vtFlow/index.js.map +1 -1
  187. package/package.json +26 -20
  188. package/build/did/migrateWebVhLog.d.ts +0 -34
  189. package/build/did/migrateWebVhLog.js +0 -230
  190. package/build/did/migrateWebVhLog.js.map +0 -1
  191. package/build/did/migrateWebVhVersionTime.d.ts +0 -9
  192. package/build/did/migrateWebVhVersionTime.js +0 -191
  193. package/build/did/migrateWebVhVersionTime.js.map +0 -1
@@ -3,55 +3,28 @@ 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
- const crypto_1 = require("crypto");
27
- const data_1 = require("./data");
28
- const ajv = new _2020_1.default({ strict: false });
22
+ const boundedFetch_1 = require("./boundedFetch");
23
+ const ecsClaims_1 = require("./ecsClaims");
24
+ const vcdm2_1 = require("./vcdm2");
25
+ const TEN_YEARS_MS = 10 * 365 * 24 * 60 * 60 * 1000;
26
+ const ajv = new _2020_1.default({ strict: false, allErrors: true });
29
27
  (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
28
  exports.createJsonSchema = {
56
29
  id: 'https://www.w3.org/ns/credentials/json-schema/v2.json',
57
30
  type: 'JsonSchema',
@@ -67,205 +40,72 @@ const createJsonSubjectRef = (id) => ({
67
40
  });
68
41
  exports.createJsonSubjectRef = createJsonSubjectRef;
69
42
  // fragment format per [VT-CRED-W3C-LINKED-VP]
70
- const linkedVpFragment = (schemaKey) => `vpr-schemas-${schemaKey.replace(/^ecs-/, '')}-vtc-vp`;
43
+ const linkedVpSchemaId = (schemaKey) => schemaKey.replace(/^ecs-/, '');
44
+ exports.linkedVpSchemaId = linkedVpSchemaId;
45
+ const linkedVpFragment = (schemaKey) => `vpr-schemas-${(0, exports.linkedVpSchemaId)(schemaKey)}-vtc-vp`;
71
46
  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()));
76
- };
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
- }
47
+ // A plain array replacer only allowlists property names, applied at every
48
+ // nesting level — nested objects like `claims` and `credentialSchema` would
49
+ // serialize to `{}` since none of their own keys appear in a top-level
50
+ // key list. Sort keys recursively instead, so the hash actually reflects
51
+ // nested content and changes to claims invalidate the cache correctly.
52
+ const sortKeysDeep = (value) => {
53
+ if (Array.isArray(value))
54
+ return value.map(exports.sortKeysDeep);
55
+ if (value !== null && typeof value === 'object') {
56
+ return Object.keys(value)
57
+ .sort()
58
+ .reduce((acc, key) => {
59
+ acc[key] = (0, exports.sortKeysDeep)(value[key]);
60
+ return acc;
61
+ }, {});
100
62
  }
63
+ return value;
101
64
  };
102
- exports.setupSelfTr = setupSelfTr;
65
+ exports.sortKeysDeep = sortKeysDeep;
103
66
  /**
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.
67
+ * Builds an unsigned credential: a VC Data Model 2.0 credential, as
68
+ * [VT-CRED-W3C] and [VT-JSON-SCHEMA-CRED-W3C] require the `https://www.w3.org/ns/credentials/v2`
69
+ * context, valid from now for ten years unless told otherwise.
122
70
  */
123
- async function generateVerifiableCredential(agent, id, ecsSchemas, schemaKey, type, subject, credentialSchema, defaults, presentation) {
71
+ function createCredential(options) {
124
72
  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
- }
73
+ return (0, vcdm2_1.createW3cV2Credential)(Object.assign(Object.assign({}, options), { validUntil: (_a = options.validUntil) !== null && _a !== void 0 ? _a : new Date(Date.now() + TEN_YEARS_MS).toISOString() }));
168
74
  }
169
- 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);
75
+ /**
76
+ * The Data Integrity cryptosuite this agent is configured with, read from the registered
77
+ * `VtFlowModuleConfig` so the self issued credentials are secured and linked VPs with the
78
+ * same suite `VtFlowApi.issueCredentialForSession` applies to the credentials it issues. Falls back
79
+ * to the module default when the vt-flow module is not registered on the agent.
80
+ */
81
+ function getDataIntegrityCryptosuite(agent) {
82
+ const { dependencyManager } = agent.context;
83
+ return dependencyManager.isRegistered(credo_ts_didcomm_vt_flow_1.VtFlowModuleConfig)
84
+ ? dependencyManager.resolve(credo_ts_didcomm_vt_flow_1.VtFlowModuleConfig).dataIntegrityCryptosuite
85
+ : credo_ts_didcomm_vt_flow_1.DEFAULT_DATA_INTEGRITY_CRYPTOSUITE;
178
86
  }
179
87
  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,
88
+ const cryptosuite = getDataIntegrityCryptosuite(agent);
89
+ if (obj instanceof core_1.W3cV2Credential) {
90
+ return await agent.w3cV2Credentials.signCredential({
91
+ format: core_1.ClaimFormat.DiVc,
184
92
  credential: obj,
185
- proofType: 'Ed25519Signature2020',
186
- verificationMethod,
187
- proofPurpose,
188
- });
189
- }
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',
93
+ cryptosuite,
195
94
  verificationMethod,
196
- proofPurpose,
197
95
  });
198
96
  }
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;
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
- if ((metadata === null || metadata === void 0 ? void 0 : metadata.integrityData) === integrityData && metadata.attached)
232
- return metadata.verifiablePresentation;
233
- const presentation = createPresentation({
234
- id,
235
- holder: agent.did,
236
- verifiableCredential: [],
97
+ // The options type requires a challenge for every presentation format, while a Data Integrity
98
+ // proof only carries one when it is given
99
+ return await agent.w3cV2Credentials.signPresentation({
100
+ format: core_1.ClaimFormat.DiVp,
101
+ presentation: obj,
102
+ cryptosuite,
103
+ verificationMethod,
237
104
  });
238
- const verifiablePresentation = await generateVerifiableCredential(agent, agent.did, ecsSchemas, schemaKey, type, { id: agent.did }, credentialSchema, defaults, presentation);
239
- // Update linked VP when the presentation has changed
240
- didDocument.service = (_b = didDocument.service) === null || _b === void 0 ? void 0 : _b.map(s => {
241
- if (typeof s.serviceEndpoint !== 'string')
242
- return s;
243
- if (s.serviceEndpoint.includes(schemaKey) && s.id !== `${agent.did}#whois`) {
244
- s.id = didDocumentServiceId;
245
- s.serviceEndpoint = id;
246
- }
247
- return s;
248
- });
249
- const credential = verifiablePresentation.verifiableCredential[0];
250
- record[credentialSchema.id] = {
251
- credential,
252
- verifiablePresentation,
253
- didDocumentServiceId,
254
- integrityData,
255
- attached: true,
256
- };
257
- didRecord.metadata.set('_vt/vtc', record);
258
- await agent.context.dependencyManager.resolve(core_1.DidRepository).update(agent.context, didRecord);
259
- return verifiablePresentation;
260
105
  }
106
+ /** Builds an unsigned VC Data Model 2.0 presentation; the class supplies the v2 context. */
261
107
  function createPresentation(options) {
262
- var _a, _b;
263
- (_a = options.context) !== null && _a !== void 0 ? _a : (options.context = [
264
- 'https://www.w3.org/2018/credentials/v1',
265
- 'https://www.w3.org/ns/credentials/examples/v2',
266
- ]);
267
- (_b = options.type) !== null && _b !== void 0 ? _b : (options.type = ['VerifiablePresentation']);
268
- return new core_1.W3cPresentation(options);
108
+ return new core_1.W3cV2Presentation(Object.assign({ type: ['VerifiablePresentation'] }, options));
269
109
  }
270
110
  /**
271
111
  * Retrieves and validates claims for a credential subject.
@@ -278,60 +118,43 @@ function createPresentation(options) {
278
118
  * @returns The validated claims object.
279
119
  * @throws If claims are invalid or schema is missing.
280
120
  */
281
- async function getClaims(logger, ecsSchemas, { id, claims }, schemaKey, defaults) {
282
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
283
- // Default claims fallback
284
- const logoUri = (_a = claims === null || claims === void 0 ? void 0 : claims.logoUri) !== null && _a !== void 0 ? _a : defaults.serviceLogoUri;
285
- const termsAndConditionsUri = (_b = claims === null || claims === void 0 ? void 0 : claims.termsAndConditionsUri) !== null && _b !== void 0 ? _b : defaults.serviceTermsAndConditions;
286
- const privacyPolicyUri = (_c = claims === null || claims === void 0 ? void 0 : claims.privacyPolicyUri) !== null && _c !== void 0 ? _c : defaults.servicePrivacyPolicy;
287
- claims =
288
- schemaKey === 'ecs-service'
289
- ? {
290
- name: (_d = claims === null || claims === void 0 ? void 0 : claims.name) !== null && _d !== void 0 ? _d : defaults.agentLabel,
291
- type: (_e = claims === null || claims === void 0 ? void 0 : claims.type) !== null && _e !== void 0 ? _e : defaults.serviceType,
292
- description: (_f = claims === null || claims === void 0 ? void 0 : claims.description) !== null && _f !== void 0 ? _f : defaults.serviceDescription,
293
- logoUri,
294
- logoDigestSri: (_g = claims === null || claims === void 0 ? void 0 : claims.logoDigestSri) !== null && _g !== void 0 ? _g : (await urlDigestSri(logoUri)),
295
- minimumAgeRequired: (_h = claims === null || claims === void 0 ? void 0 : claims.minimumAgeRequired) !== null && _h !== void 0 ? _h : defaults.serviceMinimumAgeRequired,
296
- termsAndConditionsUri,
297
- termsAndConditionsDigestSri: (_j = claims === null || claims === void 0 ? void 0 : claims.termsAndConditionsDigestSri) !== null && _j !== void 0 ? _j : (await urlDigestSri(termsAndConditionsUri)),
298
- privacyPolicyUri,
299
- privacyPolicyDigestSri: (_k = claims === null || claims === void 0 ? void 0 : claims.privacyPolicyDigestSri) !== null && _k !== void 0 ? _k : (await urlDigestSri(privacyPolicyUri)),
300
- }
301
- : {
302
- name: (_l = claims === null || claims === void 0 ? void 0 : claims.name) !== null && _l !== void 0 ? _l : defaults.agentLabel,
303
- logoUri,
304
- logoDigestSri: (_m = claims === null || claims === void 0 ? void 0 : claims.logoDigestSri) !== null && _m !== void 0 ? _m : (await urlDigestSri(logoUri)),
305
- registryId: (_o = claims === null || claims === void 0 ? void 0 : claims.registryId) !== null && _o !== void 0 ? _o : defaults.orgRegistryId,
306
- registryUri: (_p = claims === null || claims === void 0 ? void 0 : claims.registryUri) !== null && _p !== void 0 ? _p : defaults.orgRegistryUri,
307
- address: (_q = claims === null || claims === void 0 ? void 0 : claims.address) !== null && _q !== void 0 ? _q : defaults.orgAddress,
308
- organizationKind: (_r = claims === null || claims === void 0 ? void 0 : claims.organizationKind) !== null && _r !== void 0 ? _r : defaults.orgOrganizationKind,
309
- countryCode: (_s = claims === null || claims === void 0 ? void 0 : claims.countryCode) !== null && _s !== void 0 ? _s : defaults.orgCountryCode,
310
- };
121
+ async function getClaims(logger, ecsSchemas, { id }, schemaKey, ecsClaims) {
122
+ const claims = await (0, ecsClaims_1.composeEcsClaims)(ecsClaims, schemaKey, logger);
123
+ if (!claims)
124
+ throw new Error(`No ECS_CLAIMS_* variable is set for ${schemaKey}`);
311
125
  const ecsSchema = ecsSchemas[schemaKey];
312
126
  if (!ecsSchema) {
313
127
  throw new Error(`Schema not defined in data schemas for schemaKey: ${schemaKey}`);
314
128
  }
315
- const credentialSubject = Object.assign({ id }, claims);
316
- validateSchema(JSON.parse(ecsSchema), credentialSubject);
129
+ validateSchema(JSON.parse(ecsSchema), Object.assign({ id }, claims));
317
130
  return claims;
318
131
  }
132
+ function schemaViolations(ecsSchema, credentialSubject) {
133
+ var _a, _b;
134
+ const validate = ajv.compile((_a = ecsSchema.properties) === null || _a === void 0 ? void 0 : _a.credentialSubject);
135
+ if (validate(credentialSubject))
136
+ return [];
137
+ 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 }); });
138
+ }
319
139
  /**
320
140
  * Validate a validateSchema object against the corresponding AJV schema.
321
141
  * Throws an Error if the schema is missing or validation fails.
322
142
  */
323
143
  function validateSchema(ecsSchema, credentialSubject) {
324
- var _a, _b;
325
- const validate = ajv.compile((_a = ecsSchema.properties) === null || _a === void 0 ? void 0 : _a.credentialSubject);
326
- const isValid = validate(credentialSubject);
327
- if (!isValid) {
328
- const errorDetails = (_b = validate.errors) === null || _b === void 0 ? void 0 : _b.map(e => ({
329
- message: e.message,
330
- path: e.instancePath,
331
- keyword: e.keyword,
332
- params: e.params,
333
- }));
334
- throw new Error(`Invalid claims for ${ecsSchema.$id}: ${JSON.stringify(errorDetails, null, 2)}`);
144
+ const violations = schemaViolations(ecsSchema, credentialSubject);
145
+ if (violations.length > 0) {
146
+ throw new Error(`Invalid claims for ${ecsSchema.$id}: ${JSON.stringify(violations, null, 2)}`);
147
+ }
148
+ }
149
+ async function fetchSchemaContent(id) {
150
+ try {
151
+ const response = await fetch((0, vs_agent_model_1.mapToEcosystem)(id));
152
+ if (!response.ok)
153
+ return { error: `${response.status} ${response.statusText}` };
154
+ return { content: await response.text() };
155
+ }
156
+ catch (error) {
157
+ return { error: error instanceof Error ? error.message : String(error) };
335
158
  }
336
159
  }
337
160
  /**
@@ -346,15 +169,16 @@ function validateSchema(ecsSchema, credentialSubject) {
346
169
  * @throws Error if both the fetch and local fallback fail.
347
170
  */
348
171
  async function addDigestSRI(id, data, ecsSchemas) {
172
+ var _a;
349
173
  if (!id || !data) {
350
174
  throw new Error(`id and data has requiered`);
351
175
  }
352
- const response = await fetch((0, vs_agent_model_1.mapToEcosystem)(id));
176
+ const fetched = await fetchSchemaContent(id);
353
177
  const key = id.split('/').pop();
354
178
  const fallbackSchema = key && (ecsSchemas === null || ecsSchemas === void 0 ? void 0 : ecsSchemas[key]);
355
- const schemaContent = response.ok ? await response.text() : fallbackSchema;
179
+ const schemaContent = (_a = fetched.content) !== null && _a !== void 0 ? _a : fallbackSchema;
356
180
  if (!schemaContent) {
357
- throw new Error(`Failed to fetch schema from ${id}: ${response.status} ${response.statusText}, and no local fallback found.`);
181
+ throw new Error(`Failed to fetch schema from ${id}: ${fetched.error}, and no local fallback found.`);
358
182
  }
359
183
  assertValidSchema(schemaContent, id);
360
184
  return Object.assign(Object.assign({}, data), { digestSRI: generateDigestSRI(schemaContent) });
@@ -376,23 +200,8 @@ function assertValidSchema(schemaContent, id) {
376
200
  throw new Error(`Schema from ${id} is not valid: ${message}`);
377
201
  }
378
202
  }
379
- /**
380
- * Generates a SRI digest string for the given content using the specified algorithm.
381
- * @param content - The content to hash.
382
- * @param algorithm - The hash algorithm to use (default: sha256).
383
- * @returns The SRI digest string.
384
- */
385
- function generateDigestSRI(content, algorithm = 'sha384') {
386
- const hash = (0, crypto_1.createHash)(algorithm).update(content).digest('base64');
387
- return `${algorithm}-${hash}`;
388
- }
389
- /**
390
- * Digest of the resource a credential references. Throws rather than attest content it could
391
- * not read: a wrong digestSRI is a false integrity claim in a signed credential.
392
- */
393
- async function urlDigestSri(url) {
394
- const response = await axios_1.default.get(url, { responseType: 'arraybuffer', timeout: DIGEST_FETCH_TIMEOUT_MS });
395
- return `sha384-${(0, crypto_1.createHash)('sha384').update(Buffer.from(response.data)).digest('base64')}`;
203
+ function generateDigestSRI(content) {
204
+ return (0, boundedFetch_1.digestOfBytes)(content);
396
205
  }
397
206
  function getVerificationMethodId(logger, didRecord) {
398
207
  var _a, _b;
@@ -403,7 +212,7 @@ function getVerificationMethodId(logger, didRecord) {
403
212
  method.id === ((_b = (_a = didRecord.didDocument) === null || _a === void 0 ? void 0 : _a.assertionMethod) === null || _b === void 0 ? void 0 : _b[0]);
404
213
  });
405
214
  if (!verificationMethod) {
406
- throw new Error('Cannot find a suitable Ed25519Signature2020 verification method in DID Document');
215
+ throw new Error('Cannot find a suitable Ed25519 verification method in DID Document');
407
216
  }
408
217
  return verificationMethod.id;
409
218
  }
@@ -1 +1 @@
1
- {"version":3,"file":"setupSelfTr.js","sourceRoot":"","sources":["../../src/utils/setupSelfTr.ts"],"names":[],"mappings":";;;;;;AAuOA,4CAUC;AAyBD,8BA0BC;AAmBD,wEAyDC;AAED,gDAOC;AAaD,8BAgDC;AAMD,wCAcC;AAaD,oCAyBC;AA2BD,8CAGC;AAMD,oCAGC;AAED,0DAeC;AAxiBD,yCAauB;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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C;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,100 @@
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
+ * Reads the id of the credential from the RFC 0809 format data of an exchange.
44
+ * Returns `undefined` when the exchange is deleted. Returns `undefined` also when the exchange
45
+ * used a different format.
46
+ */
47
+ export declare function findExchangeCredentialId(agent: VsAgent, credentialExchangeRecordId: string): Promise<string | undefined>;
48
+ /**
49
+ * Removes the linked VP and the stored credential of the applicant, as
50
+ * [VSA-VTI-FLOW-OP-REVOKE] requires. The caller supplies the credential id from the flow record.
51
+ * An older record has no credential id. Then this function reads the id from the RFC 0809 format
52
+ * data of the exchange. Returns the credential id. Returns `undefined` when no id is available,
53
+ * and removes nothing.
54
+ */
55
+ export declare function removeStoredTrustCredential(agent: VsAgent, options: {
56
+ credentialId?: string;
57
+ credentialExchangeRecordId?: string;
58
+ }): Promise<string | undefined>;
20
59
  export declare function migrateVtjscServiceIds(agent: VsAgent): Promise<void>;
60
+ /**
61
+ * Takes the linked VPs of the given `_vt/jsc` entries out of the DID Document, publishing it once.
62
+ *
63
+ * The entries stay: `SelfTrController` serves them, and issued credentials name that URL in
64
+ * `credentialSchema.id`. Dropping one would 404 it and leave those credentials unverifiable.
65
+ */
66
+ export declare function detachVtjscPublications(agent: VsAgent, schemaRefs: readonly string[]): Promise<string[]>;
67
+ /**
68
+ * Puts a detached `_vt/jsc` entry back in the DID Document.
69
+ *
70
+ * The publication pass skips an entry whose digest still matches, so without this the agent would
71
+ * keep serving a VTJSC it never announces again.
72
+ */
73
+ export declare function reattachVtjscPublication(agent: VsAgent, schemaRef: string): Promise<boolean>;
21
74
  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>;
75
+ /**
76
+ * Stores the serialized SD-JWT VC Type Metadata of a VTJSC with its `_vt/jsc` entry, once. A
77
+ * stored document is never replaced: [VSA-PUB-VT-5] serves identical bytes while the schema exists.
78
+ * Returns false when the entry does not exist or already carries a document.
79
+ */
80
+ export declare function saveVtjscTypeMetadata(agent: VsAgent, schemaRef: string, typeMetadata: string): Promise<boolean>;
81
+ /**
82
+ * The stored Type Metadata of the `CredentialSchema` with the given on-chain id, as serialized.
83
+ * The `_vt/jsc` key of such a schema is `vpr:verana:{chainId}:cs:{id}`.
84
+ */
85
+ export declare function findVtjscTypeMetadata(didRecord: DidRecord, chainId: string, credentialSchemaId: string): string | undefined;
86
+ /**
87
+ * @param jsonSchemaCredentialId the VTJSC the Ecosystem published for this schema. Only the
88
+ * Ecosystem publishes it, so an agent that issues against another Corporation's Ecosystem must
89
+ * resolve it there — see resolveJsonSchemaCredentialId.
90
+ * @param issuerParticipantId this agent's ISSUER participant for the schema, which anchors the
91
+ * credential digest.
92
+ * @param schemaKey the ECS schema this agent issues against. Every ECS key is accepted; the caller
93
+ * reaches this function only for a schema the agent holds an active ISSUER entry on.
94
+ */
95
+ export declare function rebindEcsCredentialSchema(agent: VsAgent, publicApiBaseUrl: string, schemaId: string, schemaKey: string, ecsClaims: EcsClaims, jsonSchemaCredentialId: string, issuerParticipantId: number, onChainJsonSchema?: string, effectiveUntil?: string): Promise<void>;
96
+ /**
97
+ * Withdraws the ECS credentials anchored against `issuerParticipantId`, and the #whois entry
98
+ * when the Service credential is among them.
99
+ */
100
+ export declare function withdrawSelfIssuedEcsCredentials(agent: VsAgent, issuerParticipantId: number): Promise<string[]>;