@verana-labs/vs-agent-sdk 2.0.0-dev.37 → 2.0.0-dev.39
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.
- package/build/agent/VsAgent.d.ts +3 -0
- package/build/agent/VsAgent.js +3 -23
- package/build/agent/VsAgent.js.map +1 -1
- package/build/agent/createVsAgent.d.ts +2 -0
- package/build/agent/createVsAgent.js +1 -0
- package/build/agent/createVsAgent.js.map +1 -1
- package/build/blockchain/handlers/selfIssuanceHandlers.d.ts +2 -2
- package/build/blockchain/handlers/selfIssuanceHandlers.js +3 -3
- package/build/blockchain/handlers/selfIssuanceHandlers.js.map +1 -1
- package/build/blockchain/handlers/stateMutations.d.ts +3 -3
- package/build/blockchain/handlers/stateMutations.js +29 -13
- package/build/blockchain/handlers/stateMutations.js.map +1 -1
- package/build/bootstrap/EcsBootstrapService.d.ts +1 -0
- package/build/bootstrap/EcsBootstrapService.js +14 -3
- package/build/bootstrap/EcsBootstrapService.js.map +1 -1
- package/build/utils/ecsClaims.d.ts +47 -0
- package/build/utils/ecsClaims.js +120 -0
- package/build/utils/ecsClaims.js.map +1 -0
- package/build/utils/index.d.ts +1 -0
- package/build/utils/index.js +1 -0
- package/build/utils/index.js.map +1 -1
- package/build/utils/selfIssuedEcsCredential.d.ts +4 -0
- package/build/utils/selfIssuedEcsCredential.js +140 -0
- package/build/utils/selfIssuedEcsCredential.js.map +1 -0
- package/build/utils/setupSelfTr.d.ts +2 -57
- package/build/utils/setupSelfTr.js +8 -286
- package/build/utils/setupSelfTr.js.map +1 -1
- package/build/utils/trustCredentialStore.d.ts +9 -9
- package/build/utils/trustCredentialStore.js +28 -75
- package/build/utils/trustCredentialStore.js.map +1 -1
- package/build/vtFlow/VtFlowOrchestrator.js +1 -1
- package/build/vtFlow/VtFlowOrchestrator.js.map +1 -1
- package/package.json +3 -3
|
@@ -3,16 +3,14 @@ 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.
|
|
6
|
+
exports.sortKeysDeep = exports.linkedVpFragment = exports.createJsonSubjectRef = exports.createJsonSchema = void 0;
|
|
7
7
|
exports.createCredential = createCredential;
|
|
8
8
|
exports.signerW3c = signerW3c;
|
|
9
|
-
exports.generateVerifiablePresentation = generateVerifiablePresentation;
|
|
10
9
|
exports.createPresentation = createPresentation;
|
|
11
10
|
exports.getClaims = getClaims;
|
|
12
11
|
exports.validateSchema = validateSchema;
|
|
13
12
|
exports.addDigestSRI = addDigestSRI;
|
|
14
13
|
exports.generateDigestSRI = generateDigestSRI;
|
|
15
|
-
exports.urlDigestSri = urlDigestSri;
|
|
16
14
|
exports.getVerificationMethodId = getVerificationMethodId;
|
|
17
15
|
const core_1 = require("@credo-ts/core");
|
|
18
16
|
// No type definitions available for this library
|
|
@@ -22,36 +20,10 @@ const jsonld_signatures_1 = require("@digitalcredentials/jsonld-signatures");
|
|
|
22
20
|
const vs_agent_model_1 = require("@verana-labs/vs-agent-model");
|
|
23
21
|
const _2020_1 = __importDefault(require("ajv/dist/2020"));
|
|
24
22
|
const ajv_formats_1 = __importDefault(require("ajv-formats"));
|
|
25
|
-
const axios_1 = __importDefault(require("axios"));
|
|
26
23
|
const crypto_1 = require("crypto");
|
|
27
|
-
const
|
|
28
|
-
const ajv = new _2020_1.default({ strict: false });
|
|
24
|
+
const ecsClaims_1 = require("./ecsClaims");
|
|
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',
|
|
@@ -69,8 +41,6 @@ exports.createJsonSubjectRef = createJsonSubjectRef;
|
|
|
69
41
|
// fragment format per [VT-CRED-W3C-LINKED-VP]
|
|
70
42
|
const linkedVpFragment = (schemaKey) => `vpr-schemas-${schemaKey.replace(/^ecs-/, '')}-vtc-vp`;
|
|
71
43
|
exports.linkedVpFragment = linkedVpFragment;
|
|
72
|
-
const mapToSelfTr = (url, publicApiBaseUrl) => url.replace('ecosystem', `${publicApiBaseUrl}/vt`);
|
|
73
|
-
exports.mapToSelfTr = mapToSelfTr;
|
|
74
44
|
// A plain array replacer only allowlists property names, applied at every
|
|
75
45
|
// nesting level — nested objects like `claims` and `credentialSchema` would
|
|
76
46
|
// serialize to `{}` since none of their own keys appear in a top-level
|
|
@@ -90,101 +60,6 @@ const sortKeysDeep = (value) => {
|
|
|
90
60
|
return value;
|
|
91
61
|
};
|
|
92
62
|
exports.sortKeysDeep = sortKeysDeep;
|
|
93
|
-
const buildIntegrityData = (data) => {
|
|
94
|
-
return generateDigestSRI(JSON.stringify((0, exports.sortKeysDeep)(data)));
|
|
95
|
-
};
|
|
96
|
-
const setupSelfTr = async ({ agent, publicApiBaseUrl, defaults, }) => {
|
|
97
|
-
const ecsSchemas = (0, data_1.getEcsSchemas)(publicApiBaseUrl);
|
|
98
|
-
const logger = agent.config.logger;
|
|
99
|
-
for (const { name, schemaUrl } of exports.presentations) {
|
|
100
|
-
try {
|
|
101
|
-
await generateVerifiablePresentation(agent, `${publicApiBaseUrl}/vt/${name}-vtc-vp.json`, ecsSchemas, name, ['VerifiableCredential', 'VerifiableTrustCredential'], {
|
|
102
|
-
id: (0, exports.mapToSelfTr)(schemaUrl, publicApiBaseUrl),
|
|
103
|
-
type: 'JsonSchemaCredential',
|
|
104
|
-
}, defaults);
|
|
105
|
-
}
|
|
106
|
-
catch (error) {
|
|
107
|
-
logger.warn(`Skipping self-issued ${name}: ${error instanceof Error ? error.message : error}`);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
for (const { name, credUrl, schemaUrl } of exports.credentials) {
|
|
111
|
-
const id = (0, exports.mapToSelfTr)(schemaUrl, publicApiBaseUrl);
|
|
112
|
-
const ref = (0, exports.mapToSelfTr)(credUrl, publicApiBaseUrl);
|
|
113
|
-
try {
|
|
114
|
-
await generateVerifiableCredential(agent, id, ecsSchemas, name, ['VerifiableCredential', 'JsonSchemaCredential'], (0, exports.createJsonSubjectRef)(ref), exports.createJsonSchema, defaults);
|
|
115
|
-
}
|
|
116
|
-
catch (error) {
|
|
117
|
-
logger.warn(`Skipping self-issued ${name}: ${error instanceof Error ? error.message : error}`);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
};
|
|
121
|
-
exports.setupSelfTr = setupSelfTr;
|
|
122
|
-
/**
|
|
123
|
-
* Generates and signs a verifiable credential using the agent's DID.
|
|
124
|
-
* Stores the signed credential and its integrity metadata in the DID record.
|
|
125
|
-
*
|
|
126
|
-
* - If the claims for the subject are not provided, they are retrieved (default claims) and validated against the schema.
|
|
127
|
-
* - The integrity of the claims is tracked using a Subresource Integrity (SRI) digest.
|
|
128
|
-
* - If a credential with the same integrity already exists in the DID metadata, it is returned directly.
|
|
129
|
-
* - Otherwise, a new credential is created, signed, and stored in the DID metadata.
|
|
130
|
-
* - If a presentation is provided, the signed credential is embedded and a signed presentation is returned.
|
|
131
|
-
*
|
|
132
|
-
* @param agent - The VsAgent instance used for signing and DID management.
|
|
133
|
-
* @param logger - Logger instance for logging operations.
|
|
134
|
-
* @param ecsSchemas - Map of ECS schemas for validation.
|
|
135
|
-
* @param schemaKey - Unique identifier for the credential type and metadata key.
|
|
136
|
-
* @param type - Array of credential types (e.g., ['VerifiableCredential']).
|
|
137
|
-
* @param subject - Subject information, including ID and optional claims.
|
|
138
|
-
* @param credentialSchema - Schema definition for the credential.
|
|
139
|
-
* @param presentation - Optional presentation to include the credential.
|
|
140
|
-
* @returns The signed verifiable credential or presentation, with integrity metadata.
|
|
141
|
-
*/
|
|
142
|
-
async function generateVerifiableCredential(agent, id, ecsSchemas, schemaKey, type, subject, credentialSchema, defaults, presentation) {
|
|
143
|
-
var _a;
|
|
144
|
-
const logger = agent.config.logger;
|
|
145
|
-
const [didRecord] = await agent.dids.getCreatedDids({ did: agent.did });
|
|
146
|
-
const { id: subjectId } = subject;
|
|
147
|
-
let claims = subject.claims;
|
|
148
|
-
if (!claims) {
|
|
149
|
-
claims = await getClaims(logger, ecsSchemas, { id: subjectId }, schemaKey, defaults);
|
|
150
|
-
}
|
|
151
|
-
const integrityData = buildIntegrityData({ id, type, credentialSchema, claims });
|
|
152
|
-
const record = (_a = didRecord.metadata.get('_vt/jsc')) !== null && _a !== void 0 ? _a : {};
|
|
153
|
-
const metadata = record[subjectId];
|
|
154
|
-
if ((metadata === null || metadata === void 0 ? void 0 : metadata.integrityData) === integrityData)
|
|
155
|
-
return metadata.credential;
|
|
156
|
-
const unsignedCredential = createCredential({
|
|
157
|
-
id,
|
|
158
|
-
type,
|
|
159
|
-
issuer: agent.did,
|
|
160
|
-
credentialSubject: {
|
|
161
|
-
id: subjectId,
|
|
162
|
-
claims: presentation ? claims : await addDigestSRI(subjectId, claims, ecsSchemas),
|
|
163
|
-
},
|
|
164
|
-
});
|
|
165
|
-
unsignedCredential.credentialSchema = presentation
|
|
166
|
-
? credentialSchema
|
|
167
|
-
: await addDigestSRI(credentialSchema.id, credentialSchema, ecsSchemas);
|
|
168
|
-
// Note: this is dependant on DIDComm invitation keys. Not sure if it is fine or we should use a dedicated
|
|
169
|
-
// key for this feature
|
|
170
|
-
const verificationMethodId = getVerificationMethodId(logger, didRecord);
|
|
171
|
-
const signedCredential = await signerW3c(agent, unsignedCredential, verificationMethodId);
|
|
172
|
-
if (presentation) {
|
|
173
|
-
presentation.verifiableCredential = [signedCredential];
|
|
174
|
-
return await signerW3c(agent, presentation, verificationMethodId);
|
|
175
|
-
}
|
|
176
|
-
else {
|
|
177
|
-
record[subjectId] = {
|
|
178
|
-
credential: signedCredential.jsonCredential,
|
|
179
|
-
verifiablePresentation: {},
|
|
180
|
-
didDocumentServiceId: '',
|
|
181
|
-
integrityData,
|
|
182
|
-
};
|
|
183
|
-
didRecord.metadata.set('_vt/jsc', record);
|
|
184
|
-
await agent.context.dependencyManager.resolve(core_1.DidRepository).update(agent.context, didRecord);
|
|
185
|
-
return signedCredential.jsonCredential;
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
63
|
function createCredential(options) {
|
|
189
64
|
var _a, _b, _c;
|
|
190
65
|
(_a = options.context) !== null && _a !== void 0 ? _a : (options.context = [
|
|
@@ -216,124 +91,6 @@ async function signerW3c(agent, obj, verificationMethod) {
|
|
|
216
91
|
});
|
|
217
92
|
}
|
|
218
93
|
}
|
|
219
|
-
function storedCredentialIsCurrent(credential, credentialSchemaId, did, didRecord) {
|
|
220
|
-
var _a, _b, _c;
|
|
221
|
-
if (!credential)
|
|
222
|
-
return false;
|
|
223
|
-
const issuer = typeof credential.issuer === 'string' ? credential.issuer : (_a = credential.issuer) === null || _a === void 0 ? void 0 : _a.id;
|
|
224
|
-
if (issuer !== did)
|
|
225
|
-
return false;
|
|
226
|
-
const schema = Array.isArray(credential.credentialSchema)
|
|
227
|
-
? credential.credentialSchema[0]
|
|
228
|
-
: credential.credentialSchema;
|
|
229
|
-
if ((schema === null || schema === void 0 ? void 0 : schema.id) !== credentialSchemaId)
|
|
230
|
-
return false;
|
|
231
|
-
const proofs = !credential.proof
|
|
232
|
-
? []
|
|
233
|
-
: Array.isArray(credential.proof)
|
|
234
|
-
? credential.proof
|
|
235
|
-
: [credential.proof];
|
|
236
|
-
if (proofs.length === 0)
|
|
237
|
-
return false;
|
|
238
|
-
const assertionMethods = new Set(((_c = (_b = didRecord.didDocument) === null || _b === void 0 ? void 0 : _b.assertionMethod) !== null && _c !== void 0 ? _c : []).map(entry => typeof entry === 'string' ? entry : entry.id));
|
|
239
|
-
return proofs.every(proof => !!proof.verificationMethod && assertionMethods.has(proof.verificationMethod));
|
|
240
|
-
}
|
|
241
|
-
/**
|
|
242
|
-
* Generates and signs a verifiable presentation containing a verifiable credential.
|
|
243
|
-
* Stores the signed presentation and its integrity metadata in the DID record.
|
|
244
|
-
*
|
|
245
|
-
* - Retrieves and validates claims for the agent's DID.
|
|
246
|
-
* - Computes an integrity digest for the claims.
|
|
247
|
-
* - If a presentation with the same integrity already exists in the DID metadata, it is returned.
|
|
248
|
-
* - Otherwise, a new presentation is created, signed, and stored in the DID metadata.
|
|
249
|
-
*
|
|
250
|
-
* @param agent - The VsAgent instance used for signing and DID management.
|
|
251
|
-
* @param logger - Logger instance for logging operations.
|
|
252
|
-
* @param ecsSchemas - Map of ECS schemas for validation.
|
|
253
|
-
* @param schemaKey - Unique identifier for the presentation type and metadata key.
|
|
254
|
-
* @param type - Array of credential types to include.
|
|
255
|
-
* @param credentialSchema - Schema definition for the credential.
|
|
256
|
-
* @param beforePublish - Step that must succeed before a linked presentation counts as published.
|
|
257
|
-
* @returns The signed verifiable presentation, with integrity metadata.
|
|
258
|
-
*/
|
|
259
|
-
async function generateVerifiablePresentation(agent, id, ecsSchemas, schemaKey, type, credentialSchema, defaults, beforePublish) {
|
|
260
|
-
var _a, _b, _c, _d, _e;
|
|
261
|
-
if (!agent.did)
|
|
262
|
-
throw Error('The DID must be set up');
|
|
263
|
-
const [didRecord] = await agent.dids.getCreatedDids({ did: agent.did });
|
|
264
|
-
const didDocument = didRecord.didDocument;
|
|
265
|
-
if (!didDocument)
|
|
266
|
-
throw Error('The DID Document be set up');
|
|
267
|
-
const claims = await getClaims(agent.config.logger, ecsSchemas, { id: agent.did }, schemaKey, defaults);
|
|
268
|
-
// Use full input for integrityData to ensure update detection
|
|
269
|
-
const didDocumentServiceId = `${agent.did}#${(0, exports.linkedVpFragment)(schemaKey)}`;
|
|
270
|
-
const integrityData = buildIntegrityData({ id, type, credentialSchema, claims });
|
|
271
|
-
const record = (_a = didRecord.metadata.get('_vt/vtc')) !== null && _a !== void 0 ? _a : {};
|
|
272
|
-
const metadata = record[credentialSchema.id];
|
|
273
|
-
const superseded = Object.entries(record).some(([storedSchemaId, entry]) => {
|
|
274
|
-
var _a;
|
|
275
|
-
return storedSchemaId !== credentialSchema.id &&
|
|
276
|
-
((_a = entry === null || entry === void 0 ? void 0 : entry.verifiablePresentation) === null || _a === void 0 ? void 0 : _a.id) === id &&
|
|
277
|
-
(entry === null || entry === void 0 ? void 0 : entry.attached) !== false;
|
|
278
|
-
});
|
|
279
|
-
const attached = ((_b = metadata === null || metadata === void 0 ? void 0 : metadata.attached) !== null && _b !== void 0 ? _b : true) && !superseded;
|
|
280
|
-
if ((metadata === null || metadata === void 0 ? void 0 : metadata.integrityData) === integrityData &&
|
|
281
|
-
storedCredentialIsCurrent(metadata === null || metadata === void 0 ? void 0 : metadata.credential, credentialSchema.id, agent.did, didRecord)) {
|
|
282
|
-
// the presentation is already public, so a failed beforePublish step still needs a retry here
|
|
283
|
-
if (attached)
|
|
284
|
-
await (beforePublish === null || beforePublish === void 0 ? void 0 : beforePublish(metadata.verifiablePresentation));
|
|
285
|
-
return metadata.verifiablePresentation;
|
|
286
|
-
}
|
|
287
|
-
const presentation = createPresentation({
|
|
288
|
-
id,
|
|
289
|
-
holder: agent.did,
|
|
290
|
-
verifiableCredential: [],
|
|
291
|
-
});
|
|
292
|
-
const verifiablePresentation = await generateVerifiableCredential(agent, agent.did, ecsSchemas, schemaKey, type, { id: agent.did }, credentialSchema, defaults, presentation);
|
|
293
|
-
// nothing is persisted yet, so a failure here leaves no public presentation behind
|
|
294
|
-
if (attached)
|
|
295
|
-
await (beforePublish === null || beforePublish === void 0 ? void 0 : beforePublish(verifiablePresentation));
|
|
296
|
-
// Update linked VP when the presentation has changed
|
|
297
|
-
if (attached)
|
|
298
|
-
didDocument.service = (_c = didDocument.service) === null || _c === void 0 ? void 0 : _c.map(s => {
|
|
299
|
-
if (typeof s.serviceEndpoint !== 'string')
|
|
300
|
-
return s;
|
|
301
|
-
if (s.serviceEndpoint.includes(schemaKey) && s.id !== `${agent.did}#whois`) {
|
|
302
|
-
s.id = didDocumentServiceId;
|
|
303
|
-
s.serviceEndpoint = id;
|
|
304
|
-
}
|
|
305
|
-
return s;
|
|
306
|
-
});
|
|
307
|
-
// Resolvers only discover the credential through the [VT-CRED-W3C-LINKED-VP] fragment, and
|
|
308
|
-
// #whois does not match it. The rename above only covers documents that already carry the
|
|
309
|
-
// service, so publish it here when nothing declared it yet.
|
|
310
|
-
let didDocumentChanged = false;
|
|
311
|
-
if (attached && !((_d = didDocument.service) === null || _d === void 0 ? void 0 : _d.some(s => s.id === didDocumentServiceId))) {
|
|
312
|
-
didDocument.service = [
|
|
313
|
-
...((_e = didDocument.service) !== null && _e !== void 0 ? _e : []),
|
|
314
|
-
new core_1.DidDocumentService({
|
|
315
|
-
id: didDocumentServiceId,
|
|
316
|
-
serviceEndpoint: id,
|
|
317
|
-
type: 'LinkedVerifiablePresentation',
|
|
318
|
-
}),
|
|
319
|
-
];
|
|
320
|
-
didDocumentChanged = true;
|
|
321
|
-
}
|
|
322
|
-
const credential = verifiablePresentation.verifiableCredential[0];
|
|
323
|
-
record[credentialSchema.id] = {
|
|
324
|
-
credential,
|
|
325
|
-
verifiablePresentation,
|
|
326
|
-
didDocumentServiceId,
|
|
327
|
-
integrityData,
|
|
328
|
-
attached,
|
|
329
|
-
};
|
|
330
|
-
didRecord.metadata.set('_vt/vtc', record);
|
|
331
|
-
await agent.context.dependencyManager.resolve(core_1.DidRepository).update(agent.context, didRecord);
|
|
332
|
-
if (didDocumentChanged) {
|
|
333
|
-
await agent.dids.update({ did: didRecord.did, didDocument });
|
|
334
|
-
}
|
|
335
|
-
return verifiablePresentation;
|
|
336
|
-
}
|
|
337
94
|
function createPresentation(options) {
|
|
338
95
|
var _a, _b;
|
|
339
96
|
(_a = options.context) !== null && _a !== void 0 ? _a : (options.context = [
|
|
@@ -354,42 +111,15 @@ function createPresentation(options) {
|
|
|
354
111
|
* @returns The validated claims object.
|
|
355
112
|
* @throws If claims are invalid or schema is missing.
|
|
356
113
|
*/
|
|
357
|
-
async function getClaims(logger, ecsSchemas, { id
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
const termsAndConditionsUri = (_b = claims === null || claims === void 0 ? void 0 : claims.termsAndConditionsUri) !== null && _b !== void 0 ? _b : defaults.serviceTermsAndConditions;
|
|
362
|
-
const privacyPolicyUri = (_c = claims === null || claims === void 0 ? void 0 : claims.privacyPolicyUri) !== null && _c !== void 0 ? _c : defaults.servicePrivacyPolicy;
|
|
363
|
-
claims =
|
|
364
|
-
schemaKey === 'ecs-service'
|
|
365
|
-
? {
|
|
366
|
-
name: (_d = claims === null || claims === void 0 ? void 0 : claims.name) !== null && _d !== void 0 ? _d : defaults.agentLabel,
|
|
367
|
-
type: (_e = claims === null || claims === void 0 ? void 0 : claims.type) !== null && _e !== void 0 ? _e : defaults.serviceType,
|
|
368
|
-
description: (_f = claims === null || claims === void 0 ? void 0 : claims.description) !== null && _f !== void 0 ? _f : defaults.serviceDescription,
|
|
369
|
-
logoUri,
|
|
370
|
-
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)),
|
|
371
|
-
minimumAgeRequired: (_j = claims === null || claims === void 0 ? void 0 : claims.minimumAgeRequired) !== null && _j !== void 0 ? _j : defaults.serviceMinimumAgeRequired,
|
|
372
|
-
termsAndConditionsUri,
|
|
373
|
-
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)),
|
|
374
|
-
privacyPolicyUri,
|
|
375
|
-
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)),
|
|
376
|
-
}
|
|
377
|
-
: {
|
|
378
|
-
name: (_p = claims === null || claims === void 0 ? void 0 : claims.name) !== null && _p !== void 0 ? _p : defaults.agentLabel,
|
|
379
|
-
logoUri,
|
|
380
|
-
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)),
|
|
381
|
-
registryId: (_s = claims === null || claims === void 0 ? void 0 : claims.registryId) !== null && _s !== void 0 ? _s : defaults.orgRegistryId,
|
|
382
|
-
registryUri: (_t = claims === null || claims === void 0 ? void 0 : claims.registryUri) !== null && _t !== void 0 ? _t : defaults.orgRegistryUri,
|
|
383
|
-
address: (_u = claims === null || claims === void 0 ? void 0 : claims.address) !== null && _u !== void 0 ? _u : defaults.orgAddress,
|
|
384
|
-
organizationKind: (_v = claims === null || claims === void 0 ? void 0 : claims.organizationKind) !== null && _v !== void 0 ? _v : defaults.orgOrganizationKind,
|
|
385
|
-
countryCode: (_w = claims === null || claims === void 0 ? void 0 : claims.countryCode) !== null && _w !== void 0 ? _w : defaults.orgCountryCode,
|
|
386
|
-
};
|
|
114
|
+
async function getClaims(logger, ecsSchemas, { id }, schemaKey, ecsClaims) {
|
|
115
|
+
const claims = await (0, ecsClaims_1.composeEcsClaims)(ecsClaims, schemaKey, logger);
|
|
116
|
+
if (!claims)
|
|
117
|
+
throw new Error(`No ECS_CLAIMS_* variable is set for ${schemaKey}`);
|
|
387
118
|
const ecsSchema = ecsSchemas[schemaKey];
|
|
388
119
|
if (!ecsSchema) {
|
|
389
120
|
throw new Error(`Schema not defined in data schemas for schemaKey: ${schemaKey}`);
|
|
390
121
|
}
|
|
391
|
-
|
|
392
|
-
validateSchema(JSON.parse(ecsSchema), credentialSubject);
|
|
122
|
+
validateSchema(JSON.parse(ecsSchema), Object.assign({ id }, claims));
|
|
393
123
|
return claims;
|
|
394
124
|
}
|
|
395
125
|
/**
|
|
@@ -474,14 +204,6 @@ function generateDigestSRI(content, algorithm = 'sha384') {
|
|
|
474
204
|
const hash = (0, crypto_1.createHash)(algorithm).update(content).digest('base64');
|
|
475
205
|
return `${algorithm}-${hash}`;
|
|
476
206
|
}
|
|
477
|
-
/**
|
|
478
|
-
* Digest of the resource a credential references. Throws rather than attest content it could
|
|
479
|
-
* not read: a wrong digestSRI is a false integrity claim in a signed credential.
|
|
480
|
-
*/
|
|
481
|
-
async function urlDigestSri(url) {
|
|
482
|
-
const response = await axios_1.default.get(url, { responseType: 'arraybuffer', timeout: DIGEST_FETCH_TIMEOUT_MS });
|
|
483
|
-
return `sha384-${(0, crypto_1.createHash)('sha384').update(Buffer.from(response.data)).digest('base64')}`;
|
|
484
|
-
}
|
|
485
207
|
function getVerificationMethodId(logger, didRecord) {
|
|
486
208
|
var _a, _b;
|
|
487
209
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setupSelfTr.js","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CAAA;IAC/D,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,SAAgB,iBAAiB,CAAC,OAAe,EAAE,YAAoB,QAAQ;IAC7E,MAAM,IAAI,GAAG,IAAA,mBAAU,EAAC,SAAS,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;IACnE,OAAO,GAAG,SAAS,IAAI,IAAI,EAAE,CAAA;AAC/B,CAAC;AAED,SAAgB,uBAAuB,CAAC,MAAc,EAAE,SAAoB;;IAC1E,IAAI,CAAC;QACH,MAAM,kBAAkB,GAAG,MAAA,MAAA,SAAS,CAAC,WAAW,0CAAE,kBAAkB,0CAAE,IAAI,CACxE,MAAM,CAAC,EAAE;;YACP,OAAA,CAAC,MAAM,CAAC,IAAI,KAAK,4BAA4B,IAAI,MAAM,CAAC,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,iFAAiF,CAAC,CAAA;QACpG,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,9 +1,9 @@
|
|
|
1
1
|
import { DidRecord, W3cJsonLdVerifiableCredential, W3cJsonLdVerifiablePresentation } from '@credo-ts/core';
|
|
2
2
|
import { VsAgent } from '../agent/VsAgent';
|
|
3
|
-
import {
|
|
3
|
+
import { EcsClaims } from './ecsClaims';
|
|
4
4
|
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'
|
|
6
|
-
export declare function deleteMetadataEntry(agent: VsAgent, id: string, didRecord: DidRecord, key: '_vt/vtc' | '_vt/jsc'
|
|
5
|
+
export declare function saveMetadataEntry(agent: VsAgent, didRecord: DidRecord, credential: W3cJsonLdVerifiableCredential, verifiablePresentation: W3cJsonLdVerifiablePresentation, didDocumentServiceId: string, key: '_vt/vtc' | '_vt/jsc'): Promise<void>;
|
|
6
|
+
export declare function deleteMetadataEntry(agent: VsAgent, id: string, didRecord: DidRecord, key: '_vt/vtc' | '_vt/jsc'): Promise<{
|
|
7
7
|
schemaId: any;
|
|
8
8
|
} | null>;
|
|
9
9
|
export declare function createVtc(agent: VsAgent, publicApiBaseUrl: string, id: string, credential: W3cJsonLdVerifiableCredential): Promise<W3cJsonLdVerifiablePresentation>;
|
|
@@ -13,10 +13,10 @@ export interface CreateJscOptions {
|
|
|
13
13
|
precomputedDigestSRI?: string;
|
|
14
14
|
}
|
|
15
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,
|
|
16
|
+
export declare function removeTrustCredential(agent: VsAgent, schemaId: string, key: '_vt/jsc' | '_vt/vtc'): Promise<{
|
|
17
17
|
schemaId: any;
|
|
18
18
|
} | null>;
|
|
19
|
-
export declare function removeStoredTrustCredential(agent: VsAgent,
|
|
19
|
+
export declare function removeStoredTrustCredential(agent: VsAgent, credentialExchangeRecordId: string): Promise<string | undefined>;
|
|
20
20
|
export declare function migrateVtjscServiceIds(agent: VsAgent): Promise<void>;
|
|
21
21
|
/**
|
|
22
22
|
* Takes the linked VPs of the given `_vt/jsc` entries out of the DID Document, publishing it once.
|
|
@@ -40,9 +40,9 @@ export declare function getTrustMetadata(didRecord: DidRecord, key: '_vt/vtc' |
|
|
|
40
40
|
* @param issuerParticipantId this agent's ISSUER participant for the schema, which anchors the
|
|
41
41
|
* credential digest.
|
|
42
42
|
*/
|
|
43
|
-
export declare function rebindEcsCredentialSchema(agent: VsAgent, publicApiBaseUrl: string, schemaId: string, schemaKey: string,
|
|
43
|
+
export declare function rebindEcsCredentialSchema(agent: VsAgent, publicApiBaseUrl: string, schemaId: string, schemaKey: string, ecsClaims: EcsClaims, jsonSchemaCredentialId: string, issuerParticipantId: number, onChainJsonSchema?: string): Promise<void>;
|
|
44
44
|
/**
|
|
45
|
-
* Withdraws the ECS credentials anchored against `issuerParticipantId
|
|
46
|
-
*
|
|
45
|
+
* Withdraws the ECS credentials anchored against `issuerParticipantId`, and the #whois entry
|
|
46
|
+
* when the Service credential is among them.
|
|
47
47
|
*/
|
|
48
|
-
export declare function withdrawSelfIssuedEcsCredentials(agent: VsAgent,
|
|
48
|
+
export declare function withdrawSelfIssuedEcsCredentials(agent: VsAgent, issuerParticipantId: number): Promise<string[]>;
|
|
@@ -17,6 +17,7 @@ const core_1 = require("@credo-ts/core");
|
|
|
17
17
|
const verre_1 = require("@verana-labs/verre");
|
|
18
18
|
const adminApiService_1 = require("../did/adminApiService");
|
|
19
19
|
const setupSelfTr_1 = require("./setupSelfTr");
|
|
20
|
+
const selfIssuedEcsCredential_1 = require("./selfIssuedEcsCredential");
|
|
20
21
|
const data_1 = require("./data");
|
|
21
22
|
async function getDidRecord(agent) {
|
|
22
23
|
const [didRecord] = await agent.dids.getCreatedDids({ did: agent.did });
|
|
@@ -53,8 +54,8 @@ function findMetadataEntry(didRecord, key, id, jsonSchemaRef) {
|
|
|
53
54
|
const matched = entries.map(match).filter(entry => entry !== null);
|
|
54
55
|
return (_b = (_a = matched.find(entry => entry.attached !== false)) !== null && _a !== void 0 ? _a : matched[0]) !== null && _b !== void 0 ? _b : null;
|
|
55
56
|
}
|
|
56
|
-
async function saveMetadataEntry(agent, didRecord, credential, verifiablePresentation, didDocumentServiceId, key
|
|
57
|
-
var _a, _b, _c, _d, _e
|
|
57
|
+
async function saveMetadataEntry(agent, didRecord, credential, verifiablePresentation, didDocumentServiceId, key) {
|
|
58
|
+
var _a, _b, _c, _d, _e;
|
|
58
59
|
const schema = key === '_vt/vtc' ? credential.credentialSchema : credential.credentialSubject;
|
|
59
60
|
const ref = Array.isArray(schema) ? (_a = schema[0]) === null || _a === void 0 ? void 0 : _a.id : schema === null || schema === void 0 ? void 0 : schema.id;
|
|
60
61
|
if (!ref) {
|
|
@@ -80,17 +81,9 @@ async function saveMetadataEntry(agent, didRecord, credential, verifiablePresent
|
|
|
80
81
|
type: 'LinkedVerifiablePresentation',
|
|
81
82
|
}));
|
|
82
83
|
didRecord.metadata.set(key, record);
|
|
83
|
-
// Update #whois with new endpoint
|
|
84
|
-
const service = (_g = (_f = didRecord.didDocument) === null || _f === void 0 ? void 0 : _f.service) === null || _g === void 0 ? void 0 : _g.find(s => s.id === `${agent.did}#whois`);
|
|
85
|
-
if (service && ((_h = verifiablePresentation.id) === null || _h === void 0 ? void 0 : _h.includes('service')))
|
|
86
|
-
service.serviceEndpoint = verifiablePresentation.id;
|
|
87
|
-
// A JSON schema credential says nothing about this agent's own ECS identity, so only a real
|
|
88
|
-
// trust credential replaces the self-issued ones.
|
|
89
|
-
if (key === '_vt/vtc')
|
|
90
|
-
updateVtcEntries(didRecord, false, publicApiBaseUrl);
|
|
91
84
|
await updateDidRecord(agent, didRecord);
|
|
92
85
|
}
|
|
93
|
-
async function deleteMetadataEntry(agent, id, didRecord, key
|
|
86
|
+
async function deleteMetadataEntry(agent, id, didRecord, key) {
|
|
94
87
|
const found = findMetadataEntry(didRecord, key, id, id);
|
|
95
88
|
if (!found)
|
|
96
89
|
return null;
|
|
@@ -99,54 +92,9 @@ async function deleteMetadataEntry(agent, id, didRecord, key, publicApiBaseUrl)
|
|
|
99
92
|
return null;
|
|
100
93
|
delete metadata[found.schemaId];
|
|
101
94
|
didRecord.metadata.set(key, metadata);
|
|
102
|
-
// If the last entry is removed, restore defaults
|
|
103
|
-
restoreDefaultVtcEntries(didRecord, publicApiBaseUrl);
|
|
104
95
|
await updateDidRecord(agent, didRecord);
|
|
105
96
|
return { schemaId: found.schemaId };
|
|
106
97
|
}
|
|
107
|
-
function restoreDefaultVtcEntries(didRecord, publicApiBaseUrl) {
|
|
108
|
-
var _a, _b;
|
|
109
|
-
const vtc = (_a = didRecord.metadata.get('_vt/vtc')) !== null && _a !== void 0 ? _a : {};
|
|
110
|
-
const jsc = (_b = didRecord.metadata.get('_vt/jsc')) !== null && _b !== void 0 ? _b : {};
|
|
111
|
-
// By default we have 2 Self-trusted VTCs
|
|
112
|
-
if (Object.keys(vtc).length < 3 && Object.keys(jsc).length < 3) {
|
|
113
|
-
updateVtcEntries(didRecord, true, publicApiBaseUrl);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
function updateVtcEntries(didRecord, attach, publicApiBaseUrl) {
|
|
117
|
-
var _a;
|
|
118
|
-
const record = (_a = didRecord.metadata.get('_vt/vtc')) !== null && _a !== void 0 ? _a : {};
|
|
119
|
-
setupSelfTr_1.presentations.forEach(p => {
|
|
120
|
-
var _a, _b, _c, _d;
|
|
121
|
-
const schemaId = (0, setupSelfTr_1.mapToSelfTr)(p.schemaUrl, publicApiBaseUrl);
|
|
122
|
-
const current = record[schemaId];
|
|
123
|
-
if ((current === null || current === void 0 ? void 0 : current.attached) === attach)
|
|
124
|
-
return;
|
|
125
|
-
record[schemaId] = Object.assign(Object.assign({}, current), { attached: attach });
|
|
126
|
-
const serviceId = current === null || current === void 0 ? void 0 : current.didDocumentServiceId;
|
|
127
|
-
const serviceEndpoint = (_a = current === null || current === void 0 ? void 0 : current.verifiablePresentation) === null || _a === void 0 ? void 0 : _a.id;
|
|
128
|
-
if (!((_b = didRecord.didDocument) === null || _b === void 0 ? void 0 : _b.service))
|
|
129
|
-
return;
|
|
130
|
-
if (attach) {
|
|
131
|
-
const alreadyExists = didRecord.didDocument.service.some(s => s.id === serviceId);
|
|
132
|
-
if (!alreadyExists && serviceId && serviceEndpoint) {
|
|
133
|
-
didRecord.didDocument.service.push(new core_1.DidDocumentService({
|
|
134
|
-
id: serviceId,
|
|
135
|
-
serviceEndpoint,
|
|
136
|
-
type: 'LinkedVerifiablePresentation',
|
|
137
|
-
}));
|
|
138
|
-
}
|
|
139
|
-
// Return to self-trusted VTC in #whois endpoint
|
|
140
|
-
const service = (_d = (_c = didRecord.didDocument) === null || _c === void 0 ? void 0 : _c.service) === null || _d === void 0 ? void 0 : _d.find(s => s.id === `${didRecord.did}#whois`);
|
|
141
|
-
if (service && (serviceEndpoint === null || serviceEndpoint === void 0 ? void 0 : serviceEndpoint.includes('service')))
|
|
142
|
-
service.serviceEndpoint = serviceEndpoint;
|
|
143
|
-
}
|
|
144
|
-
else {
|
|
145
|
-
didRecord.didDocument.service = didRecord.didDocument.service.filter(s => s.id !== serviceId);
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
didRecord.metadata.set('_vt/vtc', record);
|
|
149
|
-
}
|
|
150
98
|
async function createVtc(agent, publicApiBaseUrl, id, credential) {
|
|
151
99
|
const didRecord = await getDidRecord(agent);
|
|
152
100
|
const schemaId = `schemas-${id}-vtc-vp.json`;
|
|
@@ -158,7 +106,7 @@ async function createVtc(agent, publicApiBaseUrl, id, credential) {
|
|
|
158
106
|
verifiableCredential: [credential],
|
|
159
107
|
});
|
|
160
108
|
const verifiablePresentation = await (0, setupSelfTr_1.signerW3c)(agent, unsignedPresentation, (0, setupSelfTr_1.getVerificationMethodId)(agent.config.logger, didRecord));
|
|
161
|
-
await saveMetadataEntry(agent, didRecord, credential, verifiablePresentation, didDocumentServiceId, '_vt/vtc'
|
|
109
|
+
await saveMetadataEntry(agent, didRecord, credential, verifiablePresentation, didDocumentServiceId, '_vt/vtc');
|
|
162
110
|
return verifiablePresentation;
|
|
163
111
|
}
|
|
164
112
|
async function createJsc(agent, publicApiBaseUrl, ecsSchemas, options) {
|
|
@@ -190,10 +138,10 @@ async function createJsc(agent, publicApiBaseUrl, ecsSchemas, options) {
|
|
|
190
138
|
verifiableCredential: [credential],
|
|
191
139
|
});
|
|
192
140
|
const verifiablePresentation = await (0, setupSelfTr_1.signerW3c)(agent, unsignedPresentation, verificationMethodId);
|
|
193
|
-
await saveMetadataEntry(agent, didRecord, credential, verifiablePresentation, didDocumentServiceId, '_vt/jsc'
|
|
141
|
+
await saveMetadataEntry(agent, didRecord, credential, verifiablePresentation, didDocumentServiceId, '_vt/jsc');
|
|
194
142
|
return credential.jsonCredential;
|
|
195
143
|
}
|
|
196
|
-
async function removeTrustCredential(agent,
|
|
144
|
+
async function removeTrustCredential(agent, schemaId, key) {
|
|
197
145
|
var _a;
|
|
198
146
|
const didRecord = await getDidRecord(agent);
|
|
199
147
|
// same lookup deleteMetadataEntry performs: a self-issued entry carries the agent DID as
|
|
@@ -205,15 +153,15 @@ async function removeTrustCredential(agent, publicApiBaseUrl, schemaId, key) {
|
|
|
205
153
|
if ((record === null || record === void 0 ? void 0 : record.didDocumentServiceId) && ((_a = didRecord.didDocument) === null || _a === void 0 ? void 0 : _a.service)) {
|
|
206
154
|
didRecord.didDocument.service = didRecord.didDocument.service.filter(s => s.id !== record.didDocumentServiceId);
|
|
207
155
|
}
|
|
208
|
-
return await deleteMetadataEntry(agent, schemaId, didRecord, key
|
|
156
|
+
return await deleteMetadataEntry(agent, schemaId, didRecord, key);
|
|
209
157
|
}
|
|
210
|
-
async function removeStoredTrustCredential(agent,
|
|
158
|
+
async function removeStoredTrustCredential(agent, credentialExchangeRecordId) {
|
|
211
159
|
var _a, _b;
|
|
212
160
|
const formatData = await agent.didcomm.credentials.getFormatData(credentialExchangeRecordId);
|
|
213
161
|
const credentialId = (_b = (_a = formatData.credential) === null || _a === void 0 ? void 0 : _a.jsonld) === null || _b === void 0 ? void 0 : _b.id;
|
|
214
162
|
if (!credentialId)
|
|
215
163
|
return undefined;
|
|
216
|
-
await removeTrustCredential(agent,
|
|
164
|
+
await removeTrustCredential(agent, credentialId, '_vt/vtc');
|
|
217
165
|
const stored = await agent.w3cCredentials.getAll();
|
|
218
166
|
for (const storedRecord of stored) {
|
|
219
167
|
if (storedRecord.getTags().givenId === credentialId) {
|
|
@@ -349,9 +297,9 @@ async function anchorCredentialDigest(agent, schemaId, credential, issuerPartici
|
|
|
349
297
|
* @param issuerParticipantId this agent's ISSUER participant for the schema, which anchors the
|
|
350
298
|
* credential digest.
|
|
351
299
|
*/
|
|
352
|
-
async function rebindEcsCredentialSchema(agent, publicApiBaseUrl, schemaId, schemaKey,
|
|
300
|
+
async function rebindEcsCredentialSchema(agent, publicApiBaseUrl, schemaId, schemaKey, ecsClaims, jsonSchemaCredentialId, issuerParticipantId, onChainJsonSchema) {
|
|
353
301
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
354
|
-
if (
|
|
302
|
+
if (schemaKey !== 'ecs-service' || !agent.did)
|
|
355
303
|
return;
|
|
356
304
|
const vpUrl = `${publicApiBaseUrl}/vt/${schemaKey}-vtc-vp.json`;
|
|
357
305
|
const jscUrl = jsonSchemaCredentialId;
|
|
@@ -376,7 +324,7 @@ async function rebindEcsCredentialSchema(agent, publicApiBaseUrl, schemaId, sche
|
|
|
376
324
|
didRecord.metadata.set('_vt/vtc', record);
|
|
377
325
|
await updateDidRecord(agent, didRecord);
|
|
378
326
|
}
|
|
379
|
-
await (0,
|
|
327
|
+
await (0, selfIssuedEcsCredential_1.publishSelfIssuedEcsPresentation)(agent, vpUrl, Object.assign(Object.assign({}, (0, data_1.getEcsSchemas)(publicApiBaseUrl)), (onChainJsonSchema ? { [schemaKey]: onChainJsonSchema } : {})), schemaKey, ['VerifiableCredential', 'VerifiableTrustCredential'], { id: jscUrl, type: 'JsonSchemaCredential' }, ecsClaims, async (verifiablePresentation) => {
|
|
380
328
|
var _a;
|
|
381
329
|
return await anchorCredentialDigest(agent, Number(schemaId), (_a = verifiablePresentation === null || verifiablePresentation === void 0 ? void 0 : verifiablePresentation.verifiableCredential) === null || _a === void 0 ? void 0 : _a[0], issuerParticipantId);
|
|
382
330
|
});
|
|
@@ -409,24 +357,29 @@ async function rebindEcsCredentialSchema(agent, publicApiBaseUrl, schemaId, sche
|
|
|
409
357
|
agent.config.logger.info(`[SelfTR] Rebound ${schemaKey} credential to VTJSC ${jscUrl}`);
|
|
410
358
|
}
|
|
411
359
|
/**
|
|
412
|
-
* Withdraws the ECS credentials anchored against `issuerParticipantId
|
|
413
|
-
*
|
|
360
|
+
* Withdraws the ECS credentials anchored against `issuerParticipantId`, and the #whois entry
|
|
361
|
+
* when the Service credential is among them.
|
|
414
362
|
*/
|
|
415
|
-
async function withdrawSelfIssuedEcsCredentials(agent,
|
|
416
|
-
var _a;
|
|
363
|
+
async function withdrawSelfIssuedEcsCredentials(agent, issuerParticipantId) {
|
|
364
|
+
var _a, _b;
|
|
417
365
|
const didRecord = await getDidRecord(agent);
|
|
418
366
|
const withdrawn = [];
|
|
367
|
+
let whoisWithdrawn = false;
|
|
419
368
|
for (const [jscUrl, value] of Object.entries((_a = didRecord.metadata.get('_vt/vtc')) !== null && _a !== void 0 ? _a : {})) {
|
|
420
369
|
const entry = value;
|
|
421
370
|
if (entry.issuerParticipantId !== issuerParticipantId)
|
|
422
371
|
continue;
|
|
423
|
-
await removeTrustCredential(agent,
|
|
372
|
+
await removeTrustCredential(agent, jscUrl, '_vt/vtc');
|
|
424
373
|
withdrawn.push(jscUrl);
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
374
|
+
if (entry.schemaKey === 'ecs-service')
|
|
375
|
+
whoisWithdrawn = true;
|
|
376
|
+
}
|
|
377
|
+
if (whoisWithdrawn) {
|
|
378
|
+
const record = await getDidRecord(agent);
|
|
379
|
+
if ((_b = record.didDocument) === null || _b === void 0 ? void 0 : _b.service) {
|
|
380
|
+
record.didDocument.service = record.didDocument.service.filter(s => s.id !== `${agent.did}#whois`);
|
|
381
|
+
await updateDidRecord(agent, record);
|
|
382
|
+
}
|
|
430
383
|
}
|
|
431
384
|
return withdrawn;
|
|
432
385
|
}
|