@sphereon/ssi-sdk.vc-status-list 0.34.1-feature.SSISDK.17.bitstring.sl.13 → 0.34.1-feature.SSISDK.17.bitstring.sl.16

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.js CHANGED
@@ -92,29 +92,50 @@ function determineStatusListType(credential) {
92
92
  const proofFormat = determineProofFormat(credential);
93
93
  switch (proofFormat) {
94
94
  case "jwt":
95
- const payload = jwtDecode(credential);
96
- const keys = Object.keys(payload);
97
- if (keys.includes("status_list")) {
98
- return StatusListType.OAuthStatusList;
99
- } else if (keys.includes("vc")) {
100
- return StatusListType.StatusList2021;
101
- }
102
- break;
95
+ return determineJwtStatusListType(credential);
103
96
  case "lds":
104
- const uniform = CredentialMapper.toUniformCredential(credential);
105
- const type = uniform.type.find((t) => {
106
- return Object.values(StatusListType).some((statusType) => t.includes(statusType));
107
- });
108
- if (!type) {
109
- throw new Error("Invalid status list credential type");
110
- }
111
- return type.replace("Credential", "");
97
+ return determineLdsStatusListType(credential);
112
98
  case "cbor":
113
99
  return StatusListType.OAuthStatusList;
100
+ default:
101
+ throw new Error("Cannot determine status list type from credential payload");
114
102
  }
115
- throw new Error("Cannot determine status list type from credential payload");
116
103
  }
117
104
  __name(determineStatusListType, "determineStatusListType");
105
+ function determineJwtStatusListType(credential) {
106
+ const payload = jwtDecode(credential);
107
+ if ("status_list" in payload) {
108
+ return StatusListType.OAuthStatusList;
109
+ }
110
+ if ("credentialSubject" in payload) {
111
+ return getStatusListTypeFromSubject(payload.credentialSubject);
112
+ }
113
+ if ("vc" in payload && "credentialSubject" in payload.vc) {
114
+ return getStatusListTypeFromSubject(payload.vc.credentialSubject);
115
+ }
116
+ throw new Error("Invalid status list credential: credentialSubject not found");
117
+ }
118
+ __name(determineJwtStatusListType, "determineJwtStatusListType");
119
+ function determineLdsStatusListType(credential) {
120
+ const uniform = CredentialMapper.toUniformCredential(credential);
121
+ const statusListType = uniform.type.find((type) => Object.values(StatusListType).some((statusType) => type.includes(statusType)));
122
+ if (!statusListType) {
123
+ throw new Error("Invalid status list credential type");
124
+ }
125
+ return statusListType.replace("Credential", "");
126
+ }
127
+ __name(determineLdsStatusListType, "determineLdsStatusListType");
128
+ function getStatusListTypeFromSubject(credentialSubject) {
129
+ switch (credentialSubject.type) {
130
+ case "StatusList2021":
131
+ return StatusListType.StatusList2021;
132
+ case "BitstringStatusList":
133
+ return StatusListType.BitstringStatusList;
134
+ default:
135
+ throw new Error(`Unknown credential subject type: ${credentialSubject.type}`);
136
+ }
137
+ }
138
+ __name(getStatusListTypeFromSubject, "getStatusListTypeFromSubject");
118
139
  function determineProofFormat(credential) {
119
140
  const type = CredentialMapper.detectDocumentType(credential);
120
141
  switch (type) {
@@ -276,46 +297,78 @@ var StatusList2021Implementation = class {
276
297
  const status = statusList.getStatus(typeof args.statusListIndex === "number" ? args.statusListIndex : parseInt(args.statusListIndex));
277
298
  return status ? Status2021.Invalid : Status2021.Valid;
278
299
  }
279
- async toStatusListDetails(args) {
280
- const { statusListPayload } = args;
281
- const uniform = CredentialMapper2.toUniformCredential(statusListPayload);
300
+ /**
301
+ * Performs the initial parsing of a StatusListCredential.
302
+ * This method handles expensive operations like JWT/CWT decoding once.
303
+ * It extracts all details available from the credential payload itself.
304
+ */
305
+ async extractCredentialDetails(credential) {
306
+ const uniform = CredentialMapper2.toUniformCredential(credential);
282
307
  const { issuer, credentialSubject } = uniform;
283
- const id = getAssertedValue("id", uniform.id);
284
- const encodedList = getAssertedProperty("encodedList", credentialSubject);
285
- const proofFormat = CredentialMapper2.detectDocumentType(statusListPayload) === DocumentFormat2.JWT ? "jwt" : "lds";
286
- const statusPurpose = getAssertedProperty("statusPurpose", credentialSubject);
287
- const indexingDirection = "rightToLeft";
288
- const list = await StatusList.decode({
289
- encodedList
290
- });
308
+ const subject = Array.isArray(credentialSubject) ? credentialSubject[0] : credentialSubject;
291
309
  return {
292
- // Base implementation fields
293
- id,
294
- encodedList,
310
+ id: getAssertedValue("id", uniform.id),
295
311
  issuer,
296
- type: StatusListType2.StatusList2021,
297
- proofFormat,
298
- length: list.length,
299
- statusListCredential: statusListPayload,
300
- statuslistContentType: this.buildContentType(proofFormat),
301
- correlationId: args.correlationId,
302
- driverType: args.driverType,
303
- // Flattened StatusList2021-specific fields
304
- indexingDirection,
305
- statusPurpose,
306
- // Legacy nested structure for backward compatibility
307
- statusList2021: {
308
- indexingDirection,
312
+ encodedList: getAssertedProperty("encodedList", subject)
313
+ };
314
+ }
315
+ async toStatusListDetails(args) {
316
+ if ("statusListCredential" in args) {
317
+ const { statusListCredential, correlationId, driverType } = args;
318
+ const uniform = CredentialMapper2.toUniformCredential(statusListCredential);
319
+ const { issuer, credentialSubject } = uniform;
320
+ const subject = Array.isArray(credentialSubject) ? credentialSubject[0] : credentialSubject;
321
+ const id = getAssertedValue("id", uniform.id);
322
+ const encodedList = getAssertedProperty("encodedList", subject);
323
+ const statusPurpose = getAssertedProperty("statusPurpose", subject);
324
+ const proofFormat = CredentialMapper2.detectDocumentType(statusListCredential) === DocumentFormat2.JWT ? "jwt" : "lds";
325
+ const list = await StatusList.decode({
326
+ encodedList
327
+ });
328
+ return {
329
+ id,
330
+ encodedList,
331
+ issuer,
332
+ type: StatusListType2.StatusList2021,
333
+ proofFormat,
334
+ length: list.length,
335
+ statusListCredential,
336
+ statuslistContentType: this.buildContentType(proofFormat),
337
+ correlationId,
338
+ driverType,
339
+ indexingDirection: "rightToLeft",
309
340
  statusPurpose,
310
- // Optional fields from args
311
- ...args.correlationId && {
312
- correlationId: args.correlationId
313
- },
314
- ...args.driverType && {
315
- driverType: args.driverType
341
+ statusList2021: {
342
+ indexingDirection: "rightToLeft",
343
+ statusPurpose
316
344
  }
317
- }
318
- };
345
+ };
346
+ } else {
347
+ const { extractedDetails, statusListEntity } = args;
348
+ const statusList2021Entity = statusListEntity;
349
+ const proofFormat = CredentialMapper2.detectDocumentType(statusListEntity.statusListCredential) === DocumentFormat2.JWT ? "jwt" : "lds";
350
+ const list = await StatusList.decode({
351
+ encodedList: extractedDetails.encodedList
352
+ });
353
+ return {
354
+ id: extractedDetails.id,
355
+ encodedList: extractedDetails.encodedList,
356
+ issuer: extractedDetails.issuer,
357
+ type: StatusListType2.StatusList2021,
358
+ proofFormat,
359
+ length: list.length,
360
+ statusListCredential: statusListEntity.statusListCredential,
361
+ statuslistContentType: this.buildContentType(proofFormat),
362
+ correlationId: statusListEntity.correlationId,
363
+ driverType: statusListEntity.driverType,
364
+ indexingDirection: statusList2021Entity.indexingDirection,
365
+ statusPurpose: statusList2021Entity.statusPurpose,
366
+ statusList2021: {
367
+ indexingDirection: statusList2021Entity.indexingDirection,
368
+ statusPurpose: statusList2021Entity.statusPurpose
369
+ }
370
+ };
371
+ }
319
372
  }
320
373
  async createCredentialStatus(args) {
321
374
  const { statusList, statusListIndex } = args;
@@ -717,45 +770,85 @@ var OAuthStatusListImplementation = class {
717
770
  }
718
771
  return statusList.getStatus(index);
719
772
  }
720
- async toStatusListDetails(args) {
721
- const { statusListPayload } = args;
722
- const proofFormat = determineProofFormat(statusListPayload);
723
- const decoded = proofFormat === "jwt" ? decodeStatusListJWT(statusListPayload) : decodeStatusListCWT(statusListPayload);
724
- const { statusList, issuer, id, exp } = decoded;
725
- const bitsPerStatus = statusList.getBitsPerStatus();
726
- const expiresAt = exp ? new Date(exp * 1e3) : void 0;
773
+ /**
774
+ * Performs the initial parsing of a StatusListCredential.
775
+ * This method handles expensive operations like JWT/CWT decoding once.
776
+ * It extracts all details available from the credential payload itself.
777
+ */
778
+ async extractCredentialDetails(credential) {
779
+ if (typeof credential !== "string") {
780
+ return Promise.reject("statusListCredential must be a JWT or CWT string");
781
+ }
782
+ const proofFormat = determineProofFormat(credential);
783
+ const decoded = proofFormat === "jwt" ? decodeStatusListJWT(credential) : decodeStatusListCWT(credential);
727
784
  return {
728
- // Base implementation fields
729
- id,
730
- encodedList: statusList.compressStatusList(),
731
- issuer,
732
- type: StatusListType3.OAuthStatusList,
733
- proofFormat,
734
- length: statusList.statusList.length,
735
- statusListCredential: statusListPayload,
736
- statuslistContentType: this.buildContentType(proofFormat),
737
- correlationId: args.correlationId,
738
- driverType: args.driverType,
739
- // Flattened OAuth-specific fields
740
- bitsPerStatus,
741
- ...expiresAt && {
742
- expiresAt
743
- },
744
- // Legacy nested structure for backward compatibility
745
- oauthStatusList: {
785
+ id: decoded.id,
786
+ issuer: decoded.issuer,
787
+ encodedList: decoded.statusList.compressStatusList(),
788
+ decodedPayload: decoded
789
+ };
790
+ }
791
+ async toStatusListDetails(args) {
792
+ if ("statusListCredential" in args) {
793
+ const { statusListCredential, bitsPerStatus, correlationId, driverType } = args;
794
+ if (!bitsPerStatus || bitsPerStatus < 1) {
795
+ return Promise.reject(Error("bitsPerStatus must be set for OAuth status lists and must be 1 or higher"));
796
+ }
797
+ const proofFormat = determineProofFormat(statusListCredential);
798
+ const decoded = proofFormat === "jwt" ? decodeStatusListJWT(statusListCredential) : decodeStatusListCWT(statusListCredential);
799
+ const { statusList, issuer, id, exp } = decoded;
800
+ const expiresAt = exp ? new Date(exp * 1e3) : void 0;
801
+ return {
802
+ id,
803
+ encodedList: statusList.compressStatusList(),
804
+ issuer,
805
+ type: StatusListType3.OAuthStatusList,
806
+ proofFormat,
807
+ length: statusList.statusList.length,
808
+ statusListCredential,
809
+ statuslistContentType: this.buildContentType(proofFormat),
810
+ correlationId,
811
+ driverType,
746
812
  bitsPerStatus,
747
813
  ...expiresAt && {
748
814
  expiresAt
815
+ },
816
+ oauthStatusList: {
817
+ bitsPerStatus,
818
+ ...expiresAt && {
819
+ expiresAt
820
+ }
749
821
  }
750
- },
751
- // Optional fields from args
752
- ...args.correlationId && {
753
- correlationId: args.correlationId
754
- },
755
- ...args.driverType && {
756
- driverType: args.driverType
757
- }
758
- };
822
+ };
823
+ } else {
824
+ const { extractedDetails, statusListEntity } = args;
825
+ const oauthEntity = statusListEntity;
826
+ const decoded = extractedDetails.decodedPayload;
827
+ const proofFormat = determineProofFormat(statusListEntity.statusListCredential);
828
+ const expiresAt = decoded.exp ? new Date(decoded.exp * 1e3) : void 0;
829
+ return {
830
+ id: extractedDetails.id,
831
+ encodedList: extractedDetails.encodedList,
832
+ issuer: extractedDetails.issuer,
833
+ type: StatusListType3.OAuthStatusList,
834
+ proofFormat,
835
+ length: decoded.statusList.statusList.length,
836
+ statusListCredential: statusListEntity.statusListCredential,
837
+ statuslistContentType: this.buildContentType(proofFormat),
838
+ correlationId: statusListEntity.correlationId,
839
+ driverType: statusListEntity.driverType,
840
+ bitsPerStatus: oauthEntity.bitsPerStatus,
841
+ ...expiresAt && {
842
+ expiresAt
843
+ },
844
+ oauthStatusList: {
845
+ bitsPerStatus: oauthEntity.bitsPerStatus,
846
+ ...expiresAt && {
847
+ expiresAt
848
+ }
849
+ }
850
+ };
851
+ }
759
852
  }
760
853
  async createCredentialStatus(args) {
761
854
  const { statusList, statusListIndex } = args;
@@ -793,7 +886,7 @@ import { StatusListType as StatusListType5 } from "@sphereon/ssi-types";
793
886
  import { CredentialMapper as CredentialMapper3, DocumentFormat as DocumentFormat3, StatusListType as StatusListType4 } from "@sphereon/ssi-types";
794
887
  import { BitstreamStatusList, createStatusListCredential } from "@4sure-tech/vc-bitstring-status-lists";
795
888
  var DEFAULT_LIST_LENGTH3 = 131072;
796
- var DEFAULT_PROOF_FORMAT3 = "lds";
889
+ var DEFAULT_PROOF_FORMAT3 = "vc+jwt";
797
890
  var DEFAULT_STATUS_PURPOSE = "revocation";
798
891
  var BitstringStatusListImplementation = class {
799
892
  static {
@@ -875,8 +968,9 @@ var BitstringStatusListImplementation = class {
875
968
  encodedList: origEncodedList,
876
969
  statusSize: args.bitsPerStatus
877
970
  });
878
- statusList.setStatus(index, args.value);
879
- const proofFormat = CredentialMapper3.detectDocumentType(credential) === DocumentFormat3.JWT ? "jwt" : "lds";
971
+ const bitstringStatusId = args.value;
972
+ statusList.setStatus(index, bitstringStatusId);
973
+ const proofFormat = CredentialMapper3.detectDocumentType(credential) === DocumentFormat3.JWT ? "vc+jwt" : "lds";
880
974
  const credSubject = Array.isArray(credentialSubject) ? credentialSubject[0] : credentialSubject;
881
975
  const statusPurpose = getAssertedProperty("statusPurpose", credSubject);
882
976
  const validFrom = uniform.validFrom ? new Date(uniform.validFrom) : void 0;
@@ -1006,53 +1100,48 @@ var BitstringStatusListImplementation = class {
1006
1100
  return statusList.getStatus(numIndex);
1007
1101
  }
1008
1102
  /**
1009
- * Converts a status list credential payload to detailed status list information
1010
- *
1011
- * @param args - Conversion parameters including the status list payload
1012
- * @returns Promise resolving to detailed status list information
1103
+ * Performs the initial parsing of a StatusListCredential.
1104
+ * This method handles expensive operations like JWT/CWT decoding once.
1105
+ * It extracts all details available from the credential payload itself.
1013
1106
  */
1014
- async toStatusListDetails(args) {
1015
- const { statusListPayload, bitsPerStatus } = args;
1016
- if (!bitsPerStatus || bitsPerStatus < 1) {
1017
- return Promise.reject(Error("bitsPerStatus must be set for bitstring status lists and must be 1 or higher. (toStatusListDetails)"));
1018
- }
1019
- const uniform = CredentialMapper3.toUniformCredential(statusListPayload);
1107
+ async extractCredentialDetails(credential) {
1108
+ const uniform = CredentialMapper3.toUniformCredential(credential);
1020
1109
  const { issuer, credentialSubject } = uniform;
1021
- const id = getAssertedValue("id", uniform.id);
1022
- const encodedList = getAssertedProperty("encodedList", credentialSubject);
1023
- const proofFormat = CredentialMapper3.detectDocumentType(statusListPayload) === DocumentFormat3.JWT ? "vc+jwt" : "lds";
1024
- const credSubject = Array.isArray(credentialSubject) ? credentialSubject[0] : credentialSubject;
1025
- const statusPurpose = getAssertedProperty("statusPurpose", credSubject);
1026
- const validFrom = uniform.validFrom ? new Date(uniform.validFrom) : void 0;
1027
- const validUntil = uniform.validUntil ? new Date(uniform.validUntil) : void 0;
1028
- const ttl = credSubject.ttl;
1029
- const statuslistLength = BitstreamStatusList.getStatusListLength(encodedList, bitsPerStatus);
1110
+ const subject = Array.isArray(credentialSubject) ? credentialSubject[0] : credentialSubject;
1030
1111
  return {
1031
- // Base implementation fields
1032
- id,
1033
- encodedList,
1112
+ id: getAssertedValue("id", uniform.id),
1034
1113
  issuer,
1035
- type: StatusListType4.BitstringStatusList,
1036
- proofFormat,
1037
- length: statuslistLength,
1038
- statusListCredential: statusListPayload,
1039
- statuslistContentType: this.buildContentType(proofFormat),
1040
- correlationId: args.correlationId,
1041
- driverType: args.driverType,
1042
- // Flattened Bitstring-specific fields
1043
- statusPurpose,
1044
- bitsPerStatus,
1045
- ...validFrom && {
1046
- validFrom
1047
- },
1048
- ...validUntil && {
1049
- validUntil
1050
- },
1051
- ...ttl && {
1052
- ttl
1053
- },
1054
- // Legacy nested structure for backward compatibility
1055
- bitstringStatusList: {
1114
+ encodedList: getAssertedProperty("encodedList", subject)
1115
+ };
1116
+ }
1117
+ async toStatusListDetails(args) {
1118
+ if ("statusListCredential" in args) {
1119
+ const { statusListCredential, bitsPerStatus, correlationId, driverType } = args;
1120
+ if (!bitsPerStatus || bitsPerStatus < 1) {
1121
+ return Promise.reject(Error("bitsPerStatus must be set for bitstring status lists and must be 1 or higher"));
1122
+ }
1123
+ const uniform = CredentialMapper3.toUniformCredential(statusListCredential);
1124
+ const { issuer, credentialSubject } = uniform;
1125
+ const subject = Array.isArray(credentialSubject) ? credentialSubject[0] : credentialSubject;
1126
+ const id = getAssertedValue("id", uniform.id);
1127
+ const encodedList = getAssertedProperty("encodedList", subject);
1128
+ const statusPurpose = getAssertedProperty("statusPurpose", subject);
1129
+ const validFrom = uniform.validFrom ? new Date(uniform.validFrom) : void 0;
1130
+ const validUntil = uniform.validUntil ? new Date(uniform.validUntil) : void 0;
1131
+ const ttl = subject.ttl;
1132
+ const proofFormat = CredentialMapper3.detectDocumentType(statusListCredential) === DocumentFormat3.JWT ? "vc+jwt" : "lds";
1133
+ const statuslistLength = BitstreamStatusList.getStatusListLength(encodedList, bitsPerStatus);
1134
+ return {
1135
+ id,
1136
+ encodedList,
1137
+ issuer,
1138
+ type: StatusListType4.BitstringStatusList,
1139
+ proofFormat,
1140
+ length: statuslistLength,
1141
+ statusListCredential,
1142
+ statuslistContentType: this.buildContentType(proofFormat),
1143
+ correlationId,
1144
+ driverType,
1056
1145
  statusPurpose,
1057
1146
  bitsPerStatus,
1058
1147
  ...validFrom && {
@@ -1063,16 +1152,66 @@ var BitstringStatusListImplementation = class {
1063
1152
  },
1064
1153
  ...ttl && {
1065
1154
  ttl
1155
+ },
1156
+ bitstringStatusList: {
1157
+ statusPurpose,
1158
+ bitsPerStatus,
1159
+ ...validFrom && {
1160
+ validFrom
1161
+ },
1162
+ ...validUntil && {
1163
+ validUntil
1164
+ },
1165
+ ...ttl && {
1166
+ ttl
1167
+ }
1066
1168
  }
1067
- },
1068
- // Optional fields from args
1069
- ...args.correlationId && {
1070
- correlationId: args.correlationId
1071
- },
1072
- ...args.driverType && {
1073
- driverType: args.driverType
1169
+ };
1170
+ } else {
1171
+ const { extractedDetails, statusListEntity } = args;
1172
+ const bitstringEntity = statusListEntity;
1173
+ if (!bitstringEntity.bitsPerStatus) {
1174
+ return Promise.reject(Error("bitsPerStatus must be present for a bitstring status list"));
1074
1175
  }
1075
- };
1176
+ const proofFormat = CredentialMapper3.detectDocumentType(statusListEntity.statusListCredential) === DocumentFormat3.JWT ? "vc+jwt" : "lds";
1177
+ const statuslistLength = BitstreamStatusList.getStatusListLength(extractedDetails.encodedList, bitstringEntity.bitsPerStatus);
1178
+ return {
1179
+ id: extractedDetails.id,
1180
+ encodedList: extractedDetails.encodedList,
1181
+ issuer: extractedDetails.issuer,
1182
+ type: StatusListType4.BitstringStatusList,
1183
+ proofFormat,
1184
+ length: statuslistLength,
1185
+ statusListCredential: statusListEntity.statusListCredential,
1186
+ statuslistContentType: this.buildContentType(proofFormat),
1187
+ correlationId: statusListEntity.correlationId,
1188
+ driverType: statusListEntity.driverType,
1189
+ statusPurpose: bitstringEntity.statusPurpose,
1190
+ bitsPerStatus: bitstringEntity.bitsPerStatus,
1191
+ ...bitstringEntity.validFrom && {
1192
+ validFrom: bitstringEntity.validFrom
1193
+ },
1194
+ ...bitstringEntity.validUntil && {
1195
+ validUntil: bitstringEntity.validUntil
1196
+ },
1197
+ ...bitstringEntity.ttl && {
1198
+ ttl: bitstringEntity.ttl
1199
+ },
1200
+ bitstringStatusList: {
1201
+ statusPurpose: bitstringEntity.statusPurpose,
1202
+ bitsPerStatus: bitstringEntity.bitsPerStatus,
1203
+ ...bitstringEntity.validFrom && {
1204
+ validFrom: bitstringEntity.validFrom
1205
+ },
1206
+ ...bitstringEntity.validUntil && {
1207
+ validUntil: bitstringEntity.validUntil
1208
+ },
1209
+ ...bitstringEntity.ttl && {
1210
+ ttl: bitstringEntity.ttl
1211
+ }
1212
+ }
1213
+ };
1214
+ }
1076
1215
  }
1077
1216
  /**
1078
1217
  * Creates a credential status entry for a specific credential in a status list
@@ -1082,20 +1221,17 @@ var BitstringStatusListImplementation = class {
1082
1221
  */
1083
1222
  async createCredentialStatus(args) {
1084
1223
  const { statusList, statusListEntry, statusListIndex } = args;
1085
- const isBitstringEntry = /* @__PURE__ */ __name((entry) => {
1086
- return "statusPurpose" in entry;
1087
- }, "isBitstringEntry");
1088
- if (!isBitstringEntry(statusListEntry)) {
1089
- throw new Error("Expected bitstring status list entry for bitstring status list");
1090
- }
1091
1224
  const bitstringStatusList = statusList;
1225
+ const bitstringStatusListEntry = statusListEntry;
1092
1226
  return {
1093
1227
  id: `${statusList.id}#${statusListIndex}`,
1094
1228
  type: "BitstringStatusListEntry",
1095
- statusPurpose: statusListEntry.statusPurpose,
1229
+ statusPurpose: bitstringStatusListEntry.statusPurpose,
1096
1230
  statusListIndex: "" + statusListIndex,
1097
1231
  statusListCredential: statusList.id,
1098
- bitsPerStatus: bitstringStatusList.bitsPerStatus
1232
+ bitsPerStatus: bitstringStatusList.bitsPerStatus,
1233
+ statusMessage: bitstringStatusListEntry.statusMessage,
1234
+ statusReference: bitstringStatusListEntry.statusReference
1099
1235
  };
1100
1236
  }
1101
1237
  /**
@@ -1289,18 +1425,24 @@ async function updateStatusIndexFromStatusListCredential(args, context) {
1289
1425
  return implementation.updateStatusListIndex(args, context);
1290
1426
  }
1291
1427
  __name(updateStatusIndexFromStatusListCredential, "updateStatusIndexFromStatusListCredential");
1292
- async function statusListCredentialToDetails({ statusListType, correlationId, driverType, statusListCredential, bitsPerStatus }) {
1293
- const credential = getAssertedValue("statusListCredential", statusListCredential);
1428
+ async function extractCredentialDetails(statusListCredential) {
1429
+ const statusListType = determineStatusListType(statusListCredential);
1294
1430
  const implementation = getStatusListImplementation(statusListType);
1295
- const result = await implementation.toStatusListDetails({
1296
- statusListPayload: credential,
1297
- correlationId,
1298
- driverType,
1299
- bitsPerStatus
1300
- });
1301
- return result;
1431
+ return implementation.extractCredentialDetails(statusListCredential);
1432
+ }
1433
+ __name(extractCredentialDetails, "extractCredentialDetails");
1434
+ async function toStatusListDetails(args) {
1435
+ if ("statusListCredential" in args) {
1436
+ const statusListType = args.statusListType;
1437
+ const implementation = getStatusListImplementation(statusListType);
1438
+ return implementation.toStatusListDetails(args);
1439
+ } else {
1440
+ const statusListType = args.statusListEntity.type;
1441
+ const implementation = getStatusListImplementation(statusListType);
1442
+ return implementation.toStatusListDetails(args);
1443
+ }
1302
1444
  }
1303
- __name(statusListCredentialToDetails, "statusListCredentialToDetails");
1445
+ __name(toStatusListDetails, "toStatusListDetails");
1304
1446
  async function createCredentialStatusFromStatusList(args) {
1305
1447
  const { statusList, statusListEntry, statusListIndex } = args;
1306
1448
  const statusListType = determineStatusListType(statusList.statusListCredential);
@@ -1365,11 +1507,13 @@ export {
1365
1507
  checkStatusIndexFromStatusListCredential,
1366
1508
  createCredentialStatusFromStatusList,
1367
1509
  createNewStatusList,
1510
+ determineStatusListType,
1511
+ extractCredentialDetails,
1368
1512
  fetchStatusListCredential,
1369
1513
  simpleCheckStatusFromStatusListUrl,
1370
1514
  statusList2021ToVerifiableCredential,
1371
- statusListCredentialToDetails,
1372
1515
  statusPluginStatusFunction,
1516
+ toStatusListDetails,
1373
1517
  updateStatusIndexFromStatusListCredential,
1374
1518
  updateStatusListIndexFromEncodedList,
1375
1519
  vcLibCheckStatusFunction