@sphereon/ssi-sdk.vc-status-list-issuer 0.34.1-next.7 → 0.34.1-next.85

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/dist/index.cjs CHANGED
@@ -1,8 +1,15 @@
1
1
  "use strict";
2
+ var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
5
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
9
+ var __export = (target, all) => {
10
+ for (var name in all)
11
+ __defProp(target, name, { get: all[name], enumerable: true });
12
+ };
6
13
  var __copyProps = (to, from, except, desc) => {
7
14
  if (from && typeof from === "object" || typeof from === "function") {
8
15
  for (let key of __getOwnPropNames(from))
@@ -11,9 +18,541 @@ var __copyProps = (to, from, except, desc) => {
11
18
  }
12
19
  return to;
13
20
  };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
14
29
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
30
 
16
31
  // src/index.ts
17
32
  var index_exports = {};
33
+ __export(index_exports, {
34
+ StatusListPlugin: () => StatusListPlugin
35
+ });
18
36
  module.exports = __toCommonJS(index_exports);
37
+
38
+ // src/agent/StatusListPlugin.ts
39
+ var import_ssi_sdk2 = require("@sphereon/ssi-sdk.agent-config");
40
+ var import_ssi_sdk3 = require("@sphereon/ssi-sdk.vc-status-list");
41
+ var import_ssi_sdk4 = require("@sphereon/ssi-sdk.vc-status-list-issuer-drivers");
42
+ var import_ssi_types2 = require("@sphereon/ssi-types");
43
+
44
+ // src/functions.ts
45
+ var import_ssi_sdk = require("@sphereon/ssi-sdk.vc-status-list-issuer-drivers");
46
+ var import_debug = __toESM(require("debug"), 1);
47
+ var import_ssi_types = require("@sphereon/ssi-types");
48
+ var logger = import_ssi_types.Loggers.DEFAULT.get("sphereon:ssi-sdk:vc-status-list-issuer");
49
+ async function getDriverAndStatusList(statusListId, opts) {
50
+ const slDriver = opts?.driver ?? await (0, import_ssi_sdk.getDriver)({
51
+ id: statusListId,
52
+ dataSource: opts?.dataSource
53
+ });
54
+ const statusList = await slDriver.statusListStore.getStatusList({
55
+ id: statusListId
56
+ });
57
+ return {
58
+ slDriver,
59
+ statusList
60
+ };
61
+ }
62
+ __name(getDriverAndStatusList, "getDriverAndStatusList");
63
+ function getCredentialStatusListOpts(credential, opts) {
64
+ const statusListOpts = [
65
+ ...opts?.statusLists ?? []
66
+ ];
67
+ if (statusListOpts.length === 0 && credential.credentialStatus) {
68
+ if (Array.isArray(credential.credentialStatus)) {
69
+ for (const credStatus of credential.credentialStatus) {
70
+ if (credStatus.statusListCredential) {
71
+ statusListOpts.push({
72
+ statusListId: credStatus.statusListCredential,
73
+ statusListIndex: credStatus.statusListIndex,
74
+ statusListCorrelationId: credStatus.statusListCorrelationId,
75
+ statusEntryCorrelationId: credStatus.statusEntryCorrelationId
76
+ });
77
+ }
78
+ }
79
+ } else if (credential.credentialStatus.statusListCredential) {
80
+ statusListOpts.push({
81
+ statusListId: credential.credentialStatus.statusListCredential,
82
+ statusListIndex: credential.credentialStatus.statusListIndex,
83
+ statusListCorrelationId: credential.credentialStatus.statusListCorrelationId,
84
+ statusEntryCorrelationId: credential.credentialStatus.statusEntryCorrelationId
85
+ });
86
+ }
87
+ }
88
+ return statusListOpts;
89
+ }
90
+ __name(getCredentialStatusListOpts, "getCredentialStatusListOpts");
91
+ function getSdJwtStatusListOpts(credential, opts) {
92
+ const statusListOpts = [
93
+ ...opts?.statusLists ?? []
94
+ ];
95
+ if (statusListOpts.length === 0 && credential.status?.status_list) {
96
+ statusListOpts.push({
97
+ statusListId: credential.status.status_list.uri,
98
+ statusListIndex: credential.status.status_list.idx
99
+ });
100
+ }
101
+ return statusListOpts;
102
+ }
103
+ __name(getSdJwtStatusListOpts, "getSdJwtStatusListOpts");
104
+ async function processStatusListEntry(params) {
105
+ let existingEntry = void 0;
106
+ if (params.credentialId) {
107
+ existingEntry = await params.slDriver.getStatusListEntryByCredentialId({
108
+ statusListId: params.statusList.id,
109
+ credentialId: params.credentialId,
110
+ errorOnNotFound: false
111
+ });
112
+ if (existingEntry) {
113
+ (0, import_debug.default)(`Existing statusList entry and index ${existingEntry.statusListIndex} found for ${params.debugCredentialInfo}. Will reuse the index`);
114
+ }
115
+ }
116
+ let statusListIndex = existingEntry?.statusListIndex ?? params.currentIndex;
117
+ if (params.useIndexCondition(statusListIndex)) {
118
+ existingEntry = await params.slDriver.getStatusListEntryByIndex({
119
+ statusListId: params.statusList.id,
120
+ statusListIndex,
121
+ errorOnNotFound: false
122
+ });
123
+ logger.debug(`${!existingEntry && "no"} existing statusList entry and index ${existingEntry?.statusListIndex} for ${params.debugCredentialInfo}. Will reuse the index`);
124
+ if (existingEntry && params.credentialId && existingEntry.credentialId && existingEntry.credentialId !== params.credentialId && params.checkCredentialIdMismatch) {
125
+ params.checkCredentialIdMismatch(existingEntry, params.credentialId, statusListIndex);
126
+ }
127
+ } else {
128
+ (0, import_debug.default)(`Will generate a new random statusListIndex since the credential did not contain a statusListIndex for ${params.debugCredentialInfo}...`);
129
+ statusListIndex = await params.slDriver.getRandomNewStatusListIndex({
130
+ correlationId: params.statusList.correlationId
131
+ });
132
+ (0, import_debug.default)(`Random statusListIndex ${statusListIndex} assigned for ${params.debugCredentialInfo}`);
133
+ }
134
+ const updateArgs = {
135
+ statusListId: params.statusListId,
136
+ statusListIndex,
137
+ correlationId: params.statusEntryCorrelationId,
138
+ value: params.opts?.value ?? "0",
139
+ ...params.statusList.type === "BitstringStatusList" && {
140
+ bitsPerStatus: params.statusList.bitstringStatusList?.bitsPerStatus ?? 1
141
+ }
142
+ };
143
+ if (params.credentialId) {
144
+ updateArgs.credentialId = params.credentialId;
145
+ }
146
+ const updateResult = await params.slDriver.updateStatusListEntry(updateArgs);
147
+ return {
148
+ statusListIndex,
149
+ updateResult
150
+ };
151
+ }
152
+ __name(processStatusListEntry, "processStatusListEntry");
153
+ var createStatusList = /* @__PURE__ */ __name(async (args, dataSource, context) => {
154
+ let statusList;
155
+ try {
156
+ statusList = await context.agent.slGetStatusList({
157
+ ...args.id && {
158
+ id: args.id
159
+ },
160
+ ...args.correlationId && {
161
+ correlationId: args.correlationId
162
+ },
163
+ ...args.dbName && {
164
+ dbName: args.dbName
165
+ },
166
+ dataSource: await dataSource
167
+ });
168
+ } catch (e) {
169
+ const id = args.id;
170
+ const correlationId = args.correlationId;
171
+ if (!id || !correlationId) {
172
+ return Promise.reject(Error(`No correlation id and id provided for status list`));
173
+ }
174
+ statusList = await context.agent.slCreateStatusList(args);
175
+ }
176
+ return statusList;
177
+ }, "createStatusList");
178
+ var handleCredentialStatus = /* @__PURE__ */ __name(async (credential, credentialStatusOpts) => {
179
+ logger.debug(`Starting status update for credential ${credential.id ?? "without ID"}`);
180
+ const statusListOpts = getCredentialStatusListOpts(credential, credentialStatusOpts);
181
+ if (statusListOpts.length === 0) {
182
+ logger.debug("No status list options found, skipping update");
183
+ return;
184
+ }
185
+ const credentialId = credential.id ?? credentialStatusOpts?.credentialId;
186
+ for (const statusListOpt of statusListOpts) {
187
+ const statusListId = statusListOpt.statusListId;
188
+ if (!statusListId) {
189
+ logger.debug("Skipping status list option without ID");
190
+ continue;
191
+ }
192
+ logger.debug(`Processing status list ${statusListId} for credential ${credentialId ?? "without ID"}`);
193
+ const { slDriver, statusList } = await getDriverAndStatusList(statusListId, credentialStatusOpts);
194
+ const currentIndex = statusListOpt.statusListIndex ?? 0;
195
+ const { updateResult } = await processStatusListEntry({
196
+ statusListId,
197
+ statusList,
198
+ credentialId,
199
+ currentIndex,
200
+ statusEntryCorrelationId: statusListOpt.statusEntryCorrelationId,
201
+ opts: credentialStatusOpts,
202
+ slDriver,
203
+ debugCredentialInfo: `credential with id ${credentialId} and statusListId ${statusListId}`,
204
+ useIndexCondition: /* @__PURE__ */ __name((index) => Boolean(index), "useIndexCondition"),
205
+ checkCredentialIdMismatch: /* @__PURE__ */ __name((existingEntry, credentialId2, index) => {
206
+ throw Error(`A credential with new id (${credentialId2}) is issued, but its id does not match a registered statusListEntry id ${existingEntry.credentialId} for index ${index}`);
207
+ }, "checkCredentialIdMismatch")
208
+ });
209
+ if (!credential.credentialStatus || Array.isArray(credential.credentialStatus)) {
210
+ credential.credentialStatus = {
211
+ id: `${statusListId}`,
212
+ statusListCredential: statusListId,
213
+ ...updateResult.credentialStatus
214
+ };
215
+ }
216
+ }
217
+ logger.debug(`Completed status updates for credential ${credentialId ?? "without ID"}`);
218
+ }, "handleCredentialStatus");
219
+ var handleSdJwtCredentialStatus = /* @__PURE__ */ __name(async (credential, credentialStatusOpts) => {
220
+ logger.debug("Starting status update for SD\u2011JWT credential");
221
+ const statusListOpts = getSdJwtStatusListOpts(credential, credentialStatusOpts);
222
+ if (statusListOpts.length === 0) {
223
+ throw Error("No status list options available from credential or options");
224
+ }
225
+ for (const statusListOpt of statusListOpts) {
226
+ const statusListId = statusListOpt.statusListId;
227
+ if (!statusListId) {
228
+ logger.debug("Skipping status list option without ID");
229
+ continue;
230
+ }
231
+ logger.info(`Processing status list ${statusListId}`);
232
+ const { slDriver, statusList } = await getDriverAndStatusList(statusListId, credentialStatusOpts);
233
+ const currentIndex = statusListOpt.statusListIndex ?? 0;
234
+ const { statusListIndex } = await processStatusListEntry({
235
+ statusListId,
236
+ statusList,
237
+ currentIndex,
238
+ statusEntryCorrelationId: statusListOpt.statusEntryCorrelationId,
239
+ opts: credentialStatusOpts,
240
+ slDriver,
241
+ debugCredentialInfo: `credential with statusListId ${statusListId}`,
242
+ useIndexCondition: /* @__PURE__ */ __name((index) => index > 0, "useIndexCondition")
243
+ });
244
+ if (!credential.status) {
245
+ credential.status = {
246
+ status_list: {
247
+ uri: statusListId,
248
+ idx: statusListIndex
249
+ }
250
+ };
251
+ } else if (!credential.status.status_list) {
252
+ credential.status.status_list = {
253
+ uri: statusListId,
254
+ idx: statusListIndex
255
+ };
256
+ } else {
257
+ credential.status.status_list = {
258
+ uri: credential.status.status_list.uri || statusListId,
259
+ idx: statusListIndex
260
+ };
261
+ }
262
+ }
263
+ logger.debug("Completed SD\u2011JWT credential status update");
264
+ }, "handleSdJwtCredentialStatus");
265
+
266
+ // src/agent/StatusListPlugin.ts
267
+ var logger2 = import_ssi_types2.Loggers.DEFAULT.get("sphereon:ssi-sdk:vc-status-list");
268
+ var StatusListPlugin = class {
269
+ static {
270
+ __name(this, "StatusListPlugin");
271
+ }
272
+ instances = new Array();
273
+ defaultStatusListId;
274
+ allDataSources;
275
+ initialized = false;
276
+ methods = {
277
+ slAddStatusToCredential: this.slAddStatusToCredential.bind(this),
278
+ slAddStatusToSdJwtCredential: this.slAddStatusToSdJwtCredential.bind(this),
279
+ slCreateStatusList: this.slCreateStatusList.bind(this),
280
+ slGetStatusList: this.slGetStatusList.bind(this),
281
+ slImportStatusLists: this.slImportStatusLists.bind(this)
282
+ };
283
+ constructor(opts) {
284
+ this.instances = opts.instances ?? [];
285
+ const instanceId = opts.defaultStatusListId ?? opts.instances?.[0]?.id;
286
+ if (!instanceId) {
287
+ logger2.warning(`Could not deduce the default instance id from the status lists, so no default status list will be used. Please configure the default instance id in the agent configuration.`);
288
+ }
289
+ this.defaultStatusListId = instanceId;
290
+ this.allDataSources = opts.allDataSources ?? import_ssi_sdk2.DataSources.singleInstance();
291
+ }
292
+ async init() {
293
+ if (!this.initialized) {
294
+ for (const dbName of this.allDataSources.getDbNames()) {
295
+ const driver = await (0, import_ssi_sdk4.getDriver)({
296
+ dbName,
297
+ dataSources: this.allDataSources
298
+ });
299
+ const statusLists = await driver.getStatusLists();
300
+ const instances = await Promise.all(statusLists.map((statusList) => {
301
+ const dataSource = this.allDataSources.getDbConnection(dbName);
302
+ return this.createStatusListInstance(statusList, dataSource, driver);
303
+ }));
304
+ this.instances.push(...instances);
305
+ }
306
+ this.initialized = true;
307
+ }
308
+ }
309
+ async slImportStatusLists(imports, context) {
310
+ await this.init();
311
+ for (const instanceImport of imports) {
312
+ const dataSource = this.allDataSources.getDbConnection(instanceImport.dbName ?? "default");
313
+ await createStatusList(instanceImport, dataSource, context);
314
+ }
315
+ return true;
316
+ }
317
+ createStatusListInstance(statusList, dataSource, driver) {
318
+ return {
319
+ id: statusList.id,
320
+ correlationId: statusList.correlationId,
321
+ issuer: typeof statusList.issuer === "string" ? statusList.issuer : statusList.issuer.id,
322
+ dataSource,
323
+ driverOptions: driver.getOptions(),
324
+ driverType: driver.getType()
325
+ };
326
+ }
327
+ async getDriverForStatusListOption(effectiveStatusListId, correlationId) {
328
+ let instance;
329
+ if (correlationId && correlationId.trim() !== "") {
330
+ instance = this.instances.find((inst) => inst.correlationId === correlationId);
331
+ } else {
332
+ instance = this.instances.find((inst) => inst.id === effectiveStatusListId);
333
+ }
334
+ if (!instance) {
335
+ throw Error(`Status list with identifier ${correlationId ?? effectiveStatusListId} is not managed by the status list plugin`);
336
+ }
337
+ if (!instance.dataSource && !instance.driverOptions?.dbName) {
338
+ throw Error(`Either a datasource or dbName needs to be supplied`);
339
+ }
340
+ const dataSource = instance.dataSource ? await instance.dataSource : await this.allDataSources.getDbConnection(instance.driverOptions.dbName);
341
+ const driver = correlationId && correlationId.trim() !== "" ? await (0, import_ssi_sdk4.getDriver)({
342
+ dataSource,
343
+ correlationId
344
+ }) : await (0, import_ssi_sdk4.getDriver)({
345
+ dataSource,
346
+ id: effectiveStatusListId
347
+ });
348
+ return driver;
349
+ }
350
+ async slGetStatusList(args) {
351
+ await this.init();
352
+ const sl = this.instances.find((instance) => instance.id === args.id || instance.correlationId === args.correlationId);
353
+ const dataSource = await this.selectDatasource({
354
+ dbName: args.dbName,
355
+ dataSource: args.dataSource ?? sl?.dataSource,
356
+ instance: sl
357
+ });
358
+ const driver = await (0, import_ssi_sdk4.getDriver)({
359
+ id: args.id ?? sl?.id,
360
+ correlationId: args.correlationId ?? sl?.correlationId,
361
+ dataSource
362
+ });
363
+ return await driver.getStatusList();
364
+ }
365
+ async selectDatasource(args) {
366
+ const dbName = args.dbName ?? this.allDataSources.getDbNames()[0];
367
+ if (args?.dataSource) {
368
+ return args.dataSource;
369
+ } else if (args.instance?.dataSource) {
370
+ return args.instance.dataSource;
371
+ } else if (args.dbName) {
372
+ return await this.allDataSources.getDbConnection(dbName);
373
+ } else {
374
+ return await this.allDataSources.getDbConnection(dbName);
375
+ }
376
+ }
377
+ async slCreateStatusList(args, context) {
378
+ await this.init();
379
+ const sl = await (0, import_ssi_sdk3.createNewStatusList)(args, context);
380
+ const dataSource = await this.selectDatasource({
381
+ dbName: args.dbName,
382
+ dataSource: args.dataSource
383
+ });
384
+ const driver = await (0, import_ssi_sdk4.getDriver)({
385
+ id: sl.id,
386
+ correlationId: sl.correlationId,
387
+ dataSource
388
+ });
389
+ let statusListDetails = void 0;
390
+ try {
391
+ statusListDetails = await this.slGetStatusList(args);
392
+ } catch (e) {
393
+ }
394
+ if (statusListDetails && this.instances.find((instance) => instance.id === args.id || instance.correlationId === args.correlationId)) {
395
+ return Promise.reject(Error(`Status list with id ${args.id} or correlation id ${args.correlationId} already exists`));
396
+ } else {
397
+ statusListDetails = await driver.createStatusList({
398
+ statusListType: sl.type,
399
+ statusListCredential: sl.statusListCredential,
400
+ correlationId: sl.correlationId,
401
+ bitsPerStatus: this.selectBitsPerStatus(sl)
402
+ });
403
+ this.instances.push(this.createStatusListInstance(statusListDetails, dataSource, driver));
404
+ }
405
+ return statusListDetails;
406
+ }
407
+ /**
408
+ * Selects bitsPerStatus from the used status list type when applicable
409
+ * @param sl
410
+ * @private
411
+ */
412
+ selectBitsPerStatus(sl) {
413
+ if (sl.bitstringStatusList) {
414
+ return sl.bitstringStatusList.bitsPerStatus;
415
+ }
416
+ if (sl.oauthStatusList) {
417
+ return sl.oauthStatusList.bitsPerStatus;
418
+ }
419
+ return 1;
420
+ }
421
+ /**
422
+ * Adds status information to a credential by either:
423
+ * 1. Using existing status ID from the credential if present
424
+ * 2. Using provided status list options
425
+ * 3. Falling back to the default status list ID
426
+ *
427
+ * @param args Contains credential and status options
428
+ * @param context Required agent context
429
+ * @returns Credential with added status information
430
+ */
431
+ async slAddStatusToCredential(args, context) {
432
+ const { credential, ...rest } = args;
433
+ logger2.debug(`Adding status to credential ${credential.id ?? "without ID"}`);
434
+ await this.init();
435
+ const credentialStatus = credential.credentialStatus;
436
+ if (credentialStatus && (!rest.statusLists || rest.statusLists.length == 0)) {
437
+ let existingStatusId;
438
+ if (Array.isArray(credentialStatus)) {
439
+ for (const stat of credentialStatus) {
440
+ if (stat.id && stat.id.trim() !== "") {
441
+ existingStatusId = stat.id.split("#")[0];
442
+ break;
443
+ }
444
+ }
445
+ } else if (credentialStatus.id && credentialStatus.id.trim() !== "") {
446
+ existingStatusId = credentialStatus.id.split("#")[0];
447
+ }
448
+ if (existingStatusId) {
449
+ logger2.debug(`Using existing status ID ${existingStatusId} for credential ${credential.id ?? "without ID"}`);
450
+ const instance = this.instances.find((inst) => inst.id === existingStatusId);
451
+ if (!instance) {
452
+ throw Error(`Status list with id ${existingStatusId} is not managed by the status list plugin`);
453
+ }
454
+ if (!instance.dataSource && !instance.driverOptions?.dbName) {
455
+ throw Error(`Either a datasource or dbName needs to be supplied`);
456
+ }
457
+ const credentialId2 = credential.id ?? rest.credentialId;
458
+ const dataSource = instance.dataSource ? await instance.dataSource : await this.allDataSources.getDbConnection(instance.driverOptions.dbName);
459
+ const driver = await (0, import_ssi_sdk4.getDriver)({
460
+ dataSource,
461
+ id: existingStatusId
462
+ });
463
+ await handleCredentialStatus(credential, {
464
+ ...rest,
465
+ credentialId: credentialId2,
466
+ statusLists: [
467
+ {
468
+ statusListId: existingStatusId
469
+ }
470
+ ],
471
+ driver
472
+ });
473
+ return credential;
474
+ }
475
+ }
476
+ const statusListOpts = rest.statusLists?.length ? rest.statusLists : [];
477
+ logger2.debug(`Adding new status using ${statusListOpts.length} status list option(s)`);
478
+ const credentialId = credential.id ?? rest.credentialId;
479
+ for (const opt of statusListOpts) {
480
+ const effectiveStatusListId = opt.statusListId ?? this.defaultStatusListId;
481
+ if (!effectiveStatusListId) {
482
+ return Promise.reject(Error(`No status list ID provided and no default status list ID configured. Please provide a status list ID or configure a default status list ID in the agent configuration.`));
483
+ }
484
+ const driver = await this.getDriverForStatusListOption(effectiveStatusListId, opt.statusListCorrelationId);
485
+ await handleCredentialStatus(credential, {
486
+ ...rest,
487
+ credentialId,
488
+ statusLists: [
489
+ {
490
+ ...opt,
491
+ statusListId: effectiveStatusListId
492
+ }
493
+ ],
494
+ driver
495
+ });
496
+ }
497
+ logger2.debug(`Successfully added status information to credential ${credential.id ?? "without ID"}`);
498
+ return credential;
499
+ }
500
+ /**
501
+ * Adds status information to an SD-JWT credential by either:
502
+ * 1. Using existing status URI from the credential if present
503
+ * 2. Using provided status list options
504
+ * 3. Falling back to the default status list ID
505
+ *
506
+ * @param args Contains SD-JWT credential and status options
507
+ * @param context Required agent context
508
+ * @returns SD-JWT credential with added status information
509
+ */
510
+ async slAddStatusToSdJwtCredential(args, context) {
511
+ const { credential, ...rest } = args;
512
+ logger2.debug(`Adding status to SD-JWT credential`);
513
+ await this.init();
514
+ const credentialStatus = credential.status;
515
+ if (credentialStatus && (!rest.statusLists || rest.statusLists.length == 0)) {
516
+ let existingStatusUri;
517
+ if (credentialStatus.status_list && credentialStatus.status_list.uri && credentialStatus.status_list.uri.trim() !== "") {
518
+ existingStatusUri = credentialStatus.status_list.uri;
519
+ }
520
+ if (existingStatusUri) {
521
+ logger2.debug(`Using existing status URI ${existingStatusUri} for SD-JWT credential`);
522
+ const driver2 = await this.getDriverForStatusListOption(existingStatusUri);
523
+ await handleSdJwtCredentialStatus(credential, {
524
+ ...rest,
525
+ statusLists: [
526
+ {
527
+ ...rest.statusLists,
528
+ statusListId: existingStatusUri
529
+ }
530
+ ],
531
+ driver: driver2
532
+ });
533
+ return credential;
534
+ }
535
+ }
536
+ const statusListOpts = rest.statusLists?.length ? rest.statusLists : [];
537
+ logger2.info(`Adding new status using status list options with ID ${statusListOpts[0].statusListId ?? this.defaultStatusListId}`);
538
+ const firstOpt = statusListOpts[0];
539
+ const effectiveStatusListId = firstOpt.statusListId ?? this.defaultStatusListId;
540
+ if (!effectiveStatusListId) {
541
+ return Promise.reject(Error(`No status list ID provided and no default status list ID configured. Please provide a status list ID or configure a default status list ID in the agent configuration.`));
542
+ }
543
+ const driver = await this.getDriverForStatusListOption(effectiveStatusListId, firstOpt.statusListCorrelationId);
544
+ await handleSdJwtCredentialStatus(credential, {
545
+ ...rest,
546
+ statusLists: [
547
+ {
548
+ ...firstOpt,
549
+ statusListId: effectiveStatusListId
550
+ }
551
+ ],
552
+ driver
553
+ });
554
+ logger2.debug(`Successfully added status information to SD-JWT credential`);
555
+ return credential;
556
+ }
557
+ };
19
558
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * @public\n */\nexport * from './types'\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts","../src/agent/StatusListPlugin.ts","../src/functions.ts"],"sourcesContent":["/**\n * @public\n */\nexport * from './types'\nexport * from './agent/StatusListPlugin'\n","import { DataSources } from '@sphereon/ssi-sdk.agent-config'\nimport {\n createNewStatusList,\n CreateNewStatusListArgs,\n CredentialWithStatusSupport,\n GetStatusListArgs,\n IAddStatusToCredentialArgs,\n IAddStatusToSdJwtCredentialArgs,\n IRequiredContext,\n IRequiredPlugins,\n IStatusListPlugin,\n StatusListResult,\n} from '@sphereon/ssi-sdk.vc-status-list'\nimport { getDriver, IStatusListDriver } from '@sphereon/ssi-sdk.vc-status-list-issuer-drivers'\nimport { Loggers, OrPromise } from '@sphereon/ssi-types'\nimport { IAgentContext, IAgentPlugin, IKeyManager } from '@veramo/core'\nimport { createStatusList, handleCredentialStatus, handleSdJwtCredentialStatus } from '../functions'\nimport { StatusListInstance } from '../types'\nimport { SdJwtVcPayload } from '@sd-jwt/sd-jwt-vc'\nimport { DataSource } from 'typeorm'\n\nconst logger = Loggers.DEFAULT.get('sphereon:ssi-sdk:vc-status-list')\n\nexport class StatusListPlugin implements IAgentPlugin {\n private readonly instances: Array<StatusListInstance> = new Array<StatusListInstance>()\n private readonly defaultStatusListId?: string\n private readonly allDataSources: DataSources\n\n private initialized: Boolean = false\n\n readonly methods: IStatusListPlugin = {\n slAddStatusToCredential: this.slAddStatusToCredential.bind(this),\n slAddStatusToSdJwtCredential: this.slAddStatusToSdJwtCredential.bind(this),\n slCreateStatusList: this.slCreateStatusList.bind(this),\n slGetStatusList: this.slGetStatusList.bind(this),\n slImportStatusLists: this.slImportStatusLists.bind(this),\n }\n\n constructor(opts: {\n instances?: Array<StatusListInstance>\n defaultStatusListId?: string\n allDataSources?: DataSources\n autoCreateInstances?: boolean\n }) {\n this.instances = opts.instances ?? []\n // TODO: Do we only want the instances configured, or do we also want to look them up from the DB\n const instanceId = opts.defaultStatusListId ?? opts.instances?.[0]?.id\n if (!instanceId) {\n logger.warning(\n `Could not deduce the default instance id from the status lists, so no default status list will be used. Please configure the default instance id in the agent configuration.`,\n )\n }\n this.defaultStatusListId = instanceId\n this.allDataSources = opts.allDataSources ?? DataSources.singleInstance()\n }\n\n private async init() {\n if (!this.initialized) {\n for (const dbName of this.allDataSources.getDbNames()) {\n const driver = await getDriver({ dbName, dataSources: this.allDataSources })\n const statusLists = await driver.getStatusLists()\n\n const instances = await Promise.all(\n statusLists.map((statusList) => {\n const dataSource = this.allDataSources.getDbConnection(dbName)\n return this.createStatusListInstance(statusList, dataSource, driver)\n }),\n )\n\n this.instances.push(...instances)\n }\n this.initialized = true\n }\n }\n\n private async slImportStatusLists(\n imports: Array<CreateNewStatusListArgs>,\n context: IAgentContext<IRequiredPlugins & IStatusListPlugin & IKeyManager>,\n ): Promise<boolean> {\n await this.init()\n\n for (const instanceImport of imports) {\n const dataSource = this.allDataSources.getDbConnection(instanceImport.dbName ?? 'default')\n await createStatusList(instanceImport, dataSource, context)\n }\n\n return true\n }\n\n private createStatusListInstance(statusList: StatusListResult, dataSource: OrPromise<DataSource>, driver: IStatusListDriver) {\n return {\n id: statusList.id,\n correlationId: statusList.correlationId,\n issuer: typeof statusList.issuer === 'string' ? statusList.issuer : statusList.issuer.id,\n dataSource: dataSource,\n driverOptions: driver.getOptions(),\n driverType: driver.getType(),\n } satisfies StatusListInstance\n }\n\n private async getDriverForStatusListOption(effectiveStatusListId: string, correlationId?: string) {\n let instance\n if (correlationId && correlationId.trim() !== '') {\n instance = this.instances.find((inst) => inst.correlationId === correlationId)\n } else {\n instance = this.instances.find((inst) => inst.id === effectiveStatusListId)\n }\n if (!instance) {\n throw Error(`Status list with identifier ${correlationId ?? effectiveStatusListId} is not managed by the status list plugin`)\n }\n if (!instance.dataSource && !instance.driverOptions?.dbName) {\n throw Error(`Either a datasource or dbName needs to be supplied`)\n }\n const dataSource = instance.dataSource ? await instance.dataSource : await this.allDataSources.getDbConnection(instance.driverOptions!.dbName!)\n const driver =\n correlationId && correlationId.trim() !== ''\n ? await getDriver({ dataSource, correlationId })\n : await getDriver({ dataSource, id: effectiveStatusListId })\n return driver\n }\n\n private async slGetStatusList(args: GetStatusListArgs): Promise<StatusListResult> {\n await this.init()\n\n const sl = this.instances.find((instance) => instance.id === args.id || instance.correlationId === args.correlationId)\n const dataSource = await this.selectDatasource({ dbName: args.dbName, dataSource: args.dataSource ?? sl?.dataSource, instance: sl })\n const driver = await getDriver({\n id: args.id ?? sl?.id,\n correlationId: args.correlationId ?? sl?.correlationId,\n dataSource,\n })\n return await driver.getStatusList()\n }\n\n private async selectDatasource(args: { dbName?: string; dataSource?: OrPromise<DataSource>; instance?: StatusListInstance }) {\n const dbName = args.dbName ?? this.allDataSources.getDbNames()[0]\n if (args?.dataSource) {\n return args.dataSource\n } else if (args.instance?.dataSource) {\n return args.instance.dataSource\n } else if (args.dbName) {\n return await this.allDataSources.getDbConnection(dbName)\n } else {\n return await this.allDataSources.getDbConnection(dbName)\n }\n }\n\n private async slCreateStatusList(\n args: CreateNewStatusListArgs,\n context: IAgentContext<IRequiredPlugins & IStatusListPlugin & IKeyManager>,\n ): Promise<StatusListResult> {\n await this.init()\n\n const sl = await createNewStatusList(args, context)\n const dataSource = await this.selectDatasource({ dbName: args.dbName, dataSource: args.dataSource })\n const driver = await getDriver({\n id: sl.id,\n correlationId: sl.correlationId,\n dataSource,\n })\n let statusListDetails: StatusListResult | undefined = undefined\n try {\n statusListDetails = await this.slGetStatusList(args)\n } catch (e) {\n // That is fine if there is no status list yet\n }\n if (statusListDetails && this.instances.find((instance) => instance.id === args.id || instance.correlationId === args.correlationId)) {\n return Promise.reject(Error(`Status list with id ${args.id} or correlation id ${args.correlationId} already exists`))\n } else {\n statusListDetails = await driver.createStatusList({\n statusListType: sl.type,\n statusListCredential: sl.statusListCredential,\n correlationId: sl.correlationId,\n bitsPerStatus: this.selectBitsPerStatus(sl),\n })\n this.instances.push(this.createStatusListInstance(statusListDetails, dataSource, driver))\n }\n\n return statusListDetails\n }\n\n /**\n * Selects bitsPerStatus from the used status list type when applicable\n * @param sl\n * @private\n */\n private selectBitsPerStatus(sl: StatusListResult) {\n if (sl.bitstringStatusList) {\n return sl.bitstringStatusList.bitsPerStatus\n }\n if (sl.oauthStatusList) {\n return sl.oauthStatusList.bitsPerStatus\n }\n return 1\n }\n\n /**\n * Adds status information to a credential by either:\n * 1. Using existing status ID from the credential if present\n * 2. Using provided status list options\n * 3. Falling back to the default status list ID\n *\n * @param args Contains credential and status options\n * @param context Required agent context\n * @returns Credential with added status information\n */\n private async slAddStatusToCredential(args: IAddStatusToCredentialArgs, context: IRequiredContext): Promise<CredentialWithStatusSupport> {\n const { credential, ...rest } = args\n logger.debug(`Adding status to credential ${credential.id ?? 'without ID'}`)\n\n await this.init()\n\n const credentialStatus = credential.credentialStatus\n if (credentialStatus && (!rest.statusLists || rest.statusLists.length == 0)) {\n let existingStatusId: string | undefined\n if (Array.isArray(credentialStatus)) {\n // This was implemented with VCDM v2.0 support, but the rest of the SDK is not ready for that, so ICredential.credentialStatus's array union is disabled for now\n for (const stat of credentialStatus) {\n if (stat.id && stat.id.trim() !== '') {\n existingStatusId = stat.id.split('#')[0]\n break\n }\n }\n } else if (credentialStatus.id && credentialStatus.id.trim() !== '') {\n existingStatusId = credentialStatus.id.split('#')[0]\n }\n\n if (existingStatusId) {\n logger.debug(`Using existing status ID ${existingStatusId} for credential ${credential.id ?? 'without ID'}`)\n const instance = this.instances.find((inst) => inst.id === existingStatusId)\n if (!instance) {\n throw Error(`Status list with id ${existingStatusId} is not managed by the status list plugin`)\n }\n if (!instance.dataSource && !instance.driverOptions?.dbName) {\n throw Error(`Either a datasource or dbName needs to be supplied`)\n }\n const credentialId = credential.id ?? rest.credentialId\n const dataSource = instance.dataSource\n ? await instance.dataSource\n : await this.allDataSources.getDbConnection(instance.driverOptions!.dbName!)\n const driver = await getDriver({ dataSource, id: existingStatusId })\n await handleCredentialStatus(credential, {\n ...rest,\n credentialId,\n statusLists: [{ statusListId: existingStatusId }],\n driver,\n })\n return credential\n }\n }\n\n const statusListOpts = rest.statusLists?.length ? rest.statusLists : []\n logger.debug(`Adding new status using ${statusListOpts.length} status list option(s)`)\n const credentialId = credential.id ?? rest.credentialId\n for (const opt of statusListOpts) {\n const effectiveStatusListId = opt.statusListId ?? this.defaultStatusListId\n if (!effectiveStatusListId) {\n return Promise.reject(\n Error(\n `No status list ID provided and no default status list ID configured. Please provide a status list ID or configure a default status list ID in the agent configuration.`,\n ),\n )\n }\n const driver = await this.getDriverForStatusListOption(effectiveStatusListId, opt.statusListCorrelationId)\n await handleCredentialStatus(credential, {\n ...rest,\n credentialId,\n statusLists: [\n {\n ...opt,\n statusListId: effectiveStatusListId,\n },\n ],\n driver,\n })\n }\n logger.debug(`Successfully added status information to credential ${credential.id ?? 'without ID'}`)\n return credential\n }\n\n /**\n * Adds status information to an SD-JWT credential by either:\n * 1. Using existing status URI from the credential if present\n * 2. Using provided status list options\n * 3. Falling back to the default status list ID\n *\n * @param args Contains SD-JWT credential and status options\n * @param context Required agent context\n * @returns SD-JWT credential with added status information\n */\n private async slAddStatusToSdJwtCredential(args: IAddStatusToSdJwtCredentialArgs, context: IRequiredContext): Promise<SdJwtVcPayload> {\n const { credential, ...rest } = args\n logger.debug(`Adding status to SD-JWT credential`)\n\n await this.init()\n\n const credentialStatus = credential.status\n if (credentialStatus && (!rest.statusLists || rest.statusLists.length == 0)) {\n let existingStatusUri: string | undefined\n if (credentialStatus.status_list && credentialStatus.status_list.uri && credentialStatus.status_list.uri.trim() !== '') {\n existingStatusUri = credentialStatus.status_list.uri\n }\n if (existingStatusUri) {\n logger.debug(`Using existing status URI ${existingStatusUri} for SD-JWT credential`)\n const driver = await this.getDriverForStatusListOption(existingStatusUri)\n await handleSdJwtCredentialStatus(credential, {\n ...rest,\n statusLists: [{ ...rest.statusLists, statusListId: existingStatusUri }],\n driver,\n })\n return credential\n }\n }\n\n const statusListOpts = rest.statusLists?.length ? rest.statusLists : []\n logger.info(`Adding new status using status list options with ID ${statusListOpts[0].statusListId ?? this.defaultStatusListId}`)\n const firstOpt = statusListOpts[0]\n const effectiveStatusListId = firstOpt.statusListId ?? this.defaultStatusListId\n if (!effectiveStatusListId) {\n return Promise.reject(\n Error(\n `No status list ID provided and no default status list ID configured. Please provide a status list ID or configure a default status list ID in the agent configuration.`,\n ),\n )\n }\n const driver = await this.getDriverForStatusListOption(effectiveStatusListId, firstOpt.statusListCorrelationId)\n await handleSdJwtCredentialStatus(credential, {\n ...rest,\n statusLists: [\n {\n ...firstOpt,\n statusListId: effectiveStatusListId,\n },\n ],\n driver,\n })\n logger.debug(`Successfully added status information to SD-JWT credential`)\n return credential\n }\n}\n","import { IAddStatusListEntryArgs, IStatusListEntryEntity } from '@sphereon/ssi-sdk.data-store'\nimport {\n CreateNewStatusListArgs,\n CredentialWithStatusSupport,\n IIssueCredentialStatusOpts,\n IRequiredPlugins,\n IStatusListPlugin,\n StatusListResult,\n} from '@sphereon/ssi-sdk.vc-status-list'\nimport { getDriver, IStatusListDriver } from '@sphereon/ssi-sdk.vc-status-list-issuer-drivers'\nimport debug from 'debug'\nimport { SdJwtVcPayload } from '@sd-jwt/sd-jwt-vc'\nimport { Loggers, OrPromise } from '@sphereon/ssi-types'\nimport { IAgentContext } from '@veramo/core'\nimport { StatusListOpts } from '@sphereon/oid4vci-common'\nimport { DataSource } from 'typeorm'\nimport { IDriverAndStatusListResult, StatusListRef } from './types'\n\nconst logger = Loggers.DEFAULT.get('sphereon:ssi-sdk:vc-status-list-issuer')\n\n/**\n * Retrieves a status list driver and its associated status list in one call.\n */\nasync function getDriverAndStatusList(\n statusListId: string,\n opts?: IIssueCredentialStatusOpts & { driver?: IStatusListDriver },\n): Promise<IDriverAndStatusListResult> {\n const slDriver = opts?.driver ?? (await getDriver({ id: statusListId, dataSource: opts?.dataSource }))\n const statusList = await slDriver.statusListStore.getStatusList({ id: statusListId })\n return { slDriver, statusList }\n}\n\n/**\n * Extracts status list options from a regular credential.\n */\nfunction getCredentialStatusListOpts(credential: CredentialWithStatusSupport, opts?: IIssueCredentialStatusOpts): Array<StatusListOpts> {\n // Start with any options provided via the opts parameter\n const statusListOpts: StatusListOpts[] = [...(opts?.statusLists ?? [])]\n // If none were provided, try to derive them from the credential's credentialStatus\n if (statusListOpts.length === 0 && credential.credentialStatus) {\n if (Array.isArray(credential.credentialStatus)) {\n for (const credStatus of credential.credentialStatus) {\n if (credStatus.statusListCredential) {\n statusListOpts.push({\n statusListId: credStatus.statusListCredential,\n statusListIndex: credStatus.statusListIndex,\n statusListCorrelationId: credStatus.statusListCorrelationId,\n statusEntryCorrelationId: credStatus.statusEntryCorrelationId,\n })\n }\n }\n } else if (credential.credentialStatus.statusListCredential) {\n statusListOpts.push({\n statusListId: credential.credentialStatus.statusListCredential,\n statusListIndex: credential.credentialStatus.statusListIndex,\n statusListCorrelationId: credential.credentialStatus.statusListCorrelationId,\n statusEntryCorrelationId: credential.credentialStatus.statusEntryCorrelationId,\n })\n }\n }\n return statusListOpts\n}\n\n/**\n * Extracts status list options from an SD‑JWT credential.\n */\nfunction getSdJwtStatusListOpts(credential: SdJwtVcPayload, opts?: IIssueCredentialStatusOpts): StatusListOpts[] {\n const statusListOpts: StatusListOpts[] = [...(opts?.statusLists ?? [])]\n if (statusListOpts.length === 0 && credential.status?.status_list) {\n statusListOpts.push({\n statusListId: credential.status.status_list.uri,\n statusListIndex: credential.status.status_list.idx,\n })\n }\n return statusListOpts\n}\n\n/**\n * Processes a status list entry for a given credential.\n */\nasync function processStatusListEntry(params: {\n statusListId: string\n statusList: StatusListRef\n credentialId?: string\n currentIndex: number\n opts?: IIssueCredentialStatusOpts\n slDriver: IStatusListDriver\n debugCredentialInfo: string\n useIndexCondition: (index: number) => boolean\n checkCredentialIdMismatch?: (existingEntry: IStatusListEntryEntity, credentialId: string, index: number) => void\n statusEntryCorrelationId?: string\n}): Promise<{ statusListIndex: number; updateResult: any }> {\n let existingEntry: IStatusListEntryEntity | undefined = undefined\n // Search whether there is an existing status list entry for this credential first\n if (params.credentialId) {\n existingEntry = await params.slDriver.getStatusListEntryByCredentialId({\n statusListId: params.statusList.id,\n credentialId: params.credentialId,\n errorOnNotFound: false,\n })\n if (existingEntry) {\n debug(`Existing statusList entry and index ${existingEntry.statusListIndex} found for ${params.debugCredentialInfo}. Will reuse the index`)\n }\n }\n let statusListIndex = existingEntry?.statusListIndex ?? params.currentIndex\n if (params.useIndexCondition(statusListIndex)) {\n existingEntry = await params.slDriver.getStatusListEntryByIndex({\n statusListId: params.statusList.id,\n statusListIndex,\n errorOnNotFound: false,\n })\n logger.debug(\n `${!existingEntry && 'no'} existing statusList entry and index ${existingEntry?.statusListIndex} for ${params.debugCredentialInfo}. Will reuse the index`,\n )\n if (\n existingEntry &&\n params.credentialId &&\n existingEntry.credentialId &&\n existingEntry.credentialId !== params.credentialId &&\n params.checkCredentialIdMismatch\n ) {\n params.checkCredentialIdMismatch(existingEntry, params.credentialId, statusListIndex)\n }\n } else {\n debug(`Will generate a new random statusListIndex since the credential did not contain a statusListIndex for ${params.debugCredentialInfo}...`)\n statusListIndex = await params.slDriver.getRandomNewStatusListIndex({\n correlationId: params.statusList.correlationId,\n })\n debug(`Random statusListIndex ${statusListIndex} assigned for ${params.debugCredentialInfo}`)\n }\n const updateArgs: IAddStatusListEntryArgs = {\n statusListId: params.statusListId,\n statusListIndex,\n correlationId: params.statusEntryCorrelationId,\n value: params.opts?.value ?? '0',\n ...(params.statusList.type === 'BitstringStatusList' && { bitsPerStatus: params.statusList.bitstringStatusList?.bitsPerStatus ?? 1 }),\n }\n if (params.credentialId) {\n updateArgs.credentialId = params.credentialId\n }\n const updateResult = await params.slDriver.updateStatusListEntry(updateArgs)\n return { statusListIndex, updateResult }\n}\n\nexport const createStatusList = async (\n args: CreateNewStatusListArgs,\n dataSource: OrPromise<DataSource>,\n context: IAgentContext<IRequiredPlugins & IStatusListPlugin>,\n): Promise<StatusListResult> => {\n let statusList: StatusListResult\n try {\n statusList = await context.agent.slGetStatusList({\n ...(args.id && { id: args.id }),\n ...(args.correlationId && { correlationId: args.correlationId }),\n ...(args.dbName && { dbName: args.dbName }),\n dataSource: await dataSource,\n })\n } catch (e) {\n const id = args.id\n const correlationId = args.correlationId\n if (!id || !correlationId) {\n return Promise.reject(Error(`No correlation id and id provided for status list`))\n }\n statusList = await context.agent.slCreateStatusList(args)\n }\n return statusList\n}\n\n/**\n * Adds status information to a credential using status list options from either:\n * - The provided options\n * - Existing credential status information\n *\n * The function updates each status list entry and modifies the credential's status.\n *\n * @param credential The credential to update with status information\n * @param credentialStatusOpts Options for status handling and driver configuration\n */\nexport const handleCredentialStatus = async (\n credential: CredentialWithStatusSupport,\n credentialStatusOpts?: IIssueCredentialStatusOpts & { driver?: IStatusListDriver },\n): Promise<void> => {\n logger.debug(`Starting status update for credential ${credential.id ?? 'without ID'}`)\n const statusListOpts = getCredentialStatusListOpts(credential, credentialStatusOpts)\n if (statusListOpts.length === 0) {\n logger.debug('No status list options found, skipping update')\n return\n }\n const credentialId = credential.id ?? credentialStatusOpts?.credentialId\n for (const statusListOpt of statusListOpts) {\n const statusListId = statusListOpt.statusListId\n if (!statusListId) {\n logger.debug('Skipping status list option without ID')\n continue\n }\n\n logger.debug(`Processing status list ${statusListId} for credential ${credentialId ?? 'without ID'}`)\n const { slDriver, statusList } = await getDriverAndStatusList(statusListId, credentialStatusOpts)\n const currentIndex = statusListOpt.statusListIndex ?? 0\n const { updateResult } = await processStatusListEntry({\n statusListId,\n statusList,\n credentialId,\n currentIndex,\n statusEntryCorrelationId: statusListOpt.statusEntryCorrelationId,\n opts: credentialStatusOpts,\n slDriver,\n debugCredentialInfo: `credential with id ${credentialId} and statusListId ${statusListId}`,\n useIndexCondition: (index) => Boolean(index),\n checkCredentialIdMismatch: (existingEntry, credentialId, index) => {\n throw Error(\n `A credential with new id (${credentialId}) is issued, but its id does not match a registered statusListEntry id ${existingEntry.credentialId} for index ${index}`,\n )\n },\n })\n\n if (!credential.credentialStatus || Array.isArray(credential.credentialStatus)) {\n credential.credentialStatus = {\n id: `${statusListId}`,\n statusListCredential: statusListId,\n ...updateResult.credentialStatus,\n }\n }\n }\n logger.debug(`Completed status updates for credential ${credentialId ?? 'without ID'}`)\n}\n\n/**\n * Adds status information to an SD‑JWT credential using status list options from either:\n * - The provided options\n * - Existing credential status information\n *\n * Updates the credential's status field with status list URI and index.\n *\n * @param credential The SD‑JWT credential to update\n * @param credentialStatusOpts Options for status handling and driver configuration\n * @throws Error if no status list options are available\n */\nexport const handleSdJwtCredentialStatus = async (\n credential: SdJwtVcPayload,\n credentialStatusOpts?: IIssueCredentialStatusOpts & { driver?: IStatusListDriver },\n): Promise<void> => {\n logger.debug('Starting status update for SD‑JWT credential')\n const statusListOpts = getSdJwtStatusListOpts(credential, credentialStatusOpts)\n if (statusListOpts.length === 0) {\n throw Error('No status list options available from credential or options')\n }\n\n for (const statusListOpt of statusListOpts) {\n const statusListId = statusListOpt.statusListId\n if (!statusListId) {\n logger.debug('Skipping status list option without ID')\n continue\n }\n\n logger.info(`Processing status list ${statusListId}`)\n const { slDriver, statusList } = await getDriverAndStatusList(statusListId, credentialStatusOpts)\n const currentIndex = statusListOpt.statusListIndex ?? 0\n const { statusListIndex } = await processStatusListEntry({\n statusListId,\n statusList,\n currentIndex,\n statusEntryCorrelationId: statusListOpt.statusEntryCorrelationId,\n opts: credentialStatusOpts,\n slDriver,\n debugCredentialInfo: `credential with statusListId ${statusListId}`,\n useIndexCondition: (index) => index > 0,\n })\n if (!credential.status) {\n credential.status = {\n status_list: {\n uri: statusListId,\n idx: statusListIndex,\n },\n }\n } else if (!credential.status.status_list) {\n credential.status.status_list = {\n uri: statusListId,\n idx: statusListIndex,\n }\n } else {\n credential.status.status_list = {\n uri: credential.status.status_list.uri || statusListId,\n idx: statusListIndex,\n }\n }\n }\n logger.debug('Completed SD‑JWT credential status update')\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;ACAA,IAAAA,kBAA4B;AAC5B,IAAAA,kBAWO;AACP,IAAAA,kBAA6C;AAC7C,IAAAC,oBAAmC;;;ACLnC,qBAA6C;AAC7C,mBAAkB;AAElB,uBAAmC;AAMnC,IAAMC,SAASC,yBAAQC,QAAQC,IAAI,wCAAA;AAKnC,eAAeC,uBACbC,cACAC,MAAkE;AAElE,QAAMC,WAAWD,MAAME,UAAW,UAAMC,0BAAU;IAAEC,IAAIL;IAAcM,YAAYL,MAAMK;EAAW,CAAA;AACnG,QAAMC,aAAa,MAAML,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D,cAAcK;YAAkB;;UACrE9D,QAAAA;QACF,CAAA;AACA,eAAO8C;MACT;IACF;AAEA,UAAMY,iBAAiBX,KAAK5C,aAAa+C,SAASH,KAAK5C,cAAc,CAAA;AACrE7B,IAAAA,QAAO4F,KAAK,uDAAuDR,eAAe,CAAA,EAAGD,gBAAgB,KAAK5E,mBAAmB,EAAE;AAC/H,UAAMsF,WAAWT,eAAe,CAAA;AAChC,UAAMlC,wBAAwB2C,SAASV,gBAAgB,KAAK5E;AAC5D,QAAI,CAAC2C,uBAAuB;AAC1B,aAAOnB,QAAQiC,OACbT,MACE,wKAAwK,CAAA;IAG9K;AACA,UAAM7B,SAAS,MAAM,KAAKuB,6BAA6BC,uBAAuB2C,SAASP,uBAAuB;AAC9G,UAAMK,4BAA4BnB,YAAY;MAC5C,GAAGC;MACH5C,aAAa;QACX;UACE,GAAGgE;UACHV,cAAcjC;QAChB;;MAEFxB;IACF,CAAA;AACA1B,IAAAA,QAAO0E,MAAM,4DAA4D;AACzE,WAAOF;EACT;AACF;","names":["import_ssi_sdk","import_ssi_types","logger","Loggers","DEFAULT","get","getDriverAndStatusList","statusListId","opts","slDriver","driver","getDriver","id","dataSource","statusList","statusListStore","getStatusList","getCredentialStatusListOpts","credential","statusListOpts","statusLists","length","credentialStatus","Array","isArray","credStatus","statusListCredential","push","statusListIndex","statusListCorrelationId","statusEntryCorrelationId","getSdJwtStatusListOpts","status","status_list","uri","idx","processStatusListEntry","params","existingEntry","undefined","credentialId","getStatusListEntryByCredentialId","errorOnNotFound","debug","debugCredentialInfo","currentIndex","useIndexCondition","getStatusListEntryByIndex","checkCredentialIdMismatch","getRandomNewStatusListIndex","correlationId","updateArgs","value","type","bitsPerStatus","bitstringStatusList","updateResult","updateStatusListEntry","createStatusList","args","context","agent","slGetStatusList","dbName","e","Promise","reject","Error","slCreateStatusList","handleCredentialStatus","credentialStatusOpts","statusListOpt","index","Boolean","handleSdJwtCredentialStatus","info","logger","Loggers","DEFAULT","get","StatusListPlugin","instances","Array","defaultStatusListId","allDataSources","initialized","methods","slAddStatusToCredential","bind","slAddStatusToSdJwtCredential","slCreateStatusList","slGetStatusList","slImportStatusLists","opts","instanceId","id","warning","DataSources","singleInstance","init","dbName","getDbNames","driver","getDriver","dataSources","statusLists","getStatusLists","Promise","all","map","statusList","dataSource","getDbConnection","createStatusListInstance","push","imports","context","instanceImport","createStatusList","correlationId","issuer","driverOptions","getOptions","driverType","getType","getDriverForStatusListOption","effectiveStatusListId","instance","trim","find","inst","Error","args","sl","selectDatasource","getStatusList","createNewStatusList","statusListDetails","undefined","e","reject","statusListType","type","statusListCredential","bitsPerStatus","selectBitsPerStatus","bitstringStatusList","oauthStatusList","credential","rest","debug","credentialStatus","length","existingStatusId","isArray","stat","split","credentialId","handleCredentialStatus","statusListId","statusListOpts","opt","statusListCorrelationId","status","existingStatusUri","status_list","uri","handleSdJwtCredentialStatus","info","firstOpt"]}