@sphereon/ssi-sdk.vc-status-list 0.34.1-feature.SSISDK.17.bitstring.sl.11 → 0.34.1-feature.SSISDK.17.bitstring.sl.14
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 +395 -216
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +75 -41
- package/dist/index.d.ts +75 -41
- package/dist/index.js +396 -217
- package/dist/index.js.map +1 -1
- package/package.json +5 -4
- package/src/functions.ts +50 -62
- package/src/impl/BitstringStatusListImplementation.ts +265 -121
- package/src/impl/IStatusList.ts +43 -11
- package/src/impl/OAuthStatusList.ts +81 -33
- package/src/impl/StatusList2021.ts +79 -39
- package/src/index.ts +1 -0
- package/src/types/index.ts +22 -36
- package/src/utils.ts +48 -19
package/dist/index.cjs
CHANGED
|
@@ -37,11 +37,13 @@ __export(index_exports, {
|
|
|
37
37
|
checkStatusIndexFromStatusListCredential: () => checkStatusIndexFromStatusListCredential,
|
|
38
38
|
createCredentialStatusFromStatusList: () => createCredentialStatusFromStatusList,
|
|
39
39
|
createNewStatusList: () => createNewStatusList,
|
|
40
|
+
determineStatusListType: () => determineStatusListType,
|
|
41
|
+
extractCredentialDetails: () => extractCredentialDetails,
|
|
40
42
|
fetchStatusListCredential: () => fetchStatusListCredential,
|
|
41
43
|
simpleCheckStatusFromStatusListUrl: () => simpleCheckStatusFromStatusListUrl,
|
|
42
44
|
statusList2021ToVerifiableCredential: () => statusList2021ToVerifiableCredential,
|
|
43
|
-
statusListCredentialToDetails: () => statusListCredentialToDetails,
|
|
44
45
|
statusPluginStatusFunction: () => statusPluginStatusFunction,
|
|
46
|
+
toStatusListDetails: () => toStatusListDetails,
|
|
45
47
|
updateStatusIndexFromStatusListCredential: () => updateStatusIndexFromStatusListCredential,
|
|
46
48
|
updateStatusListIndexFromEncodedList: () => updateStatusListIndexFromEncodedList,
|
|
47
49
|
vcLibCheckStatusFunction: () => vcLibCheckStatusFunction
|
|
@@ -123,7 +125,8 @@ var ValidProofTypeMap = /* @__PURE__ */ new Map([
|
|
|
123
125
|
[
|
|
124
126
|
import_ssi_types.StatusListType.BitstringStatusList,
|
|
125
127
|
[
|
|
126
|
-
"lds"
|
|
128
|
+
"lds",
|
|
129
|
+
"vc+jwt"
|
|
127
130
|
]
|
|
128
131
|
]
|
|
129
132
|
]);
|
|
@@ -138,29 +141,50 @@ function determineStatusListType(credential) {
|
|
|
138
141
|
const proofFormat = determineProofFormat(credential);
|
|
139
142
|
switch (proofFormat) {
|
|
140
143
|
case "jwt":
|
|
141
|
-
|
|
142
|
-
const keys = Object.keys(payload);
|
|
143
|
-
if (keys.includes("status_list")) {
|
|
144
|
-
return import_ssi_types.StatusListType.OAuthStatusList;
|
|
145
|
-
} else if (keys.includes("vc")) {
|
|
146
|
-
return import_ssi_types.StatusListType.StatusList2021;
|
|
147
|
-
}
|
|
148
|
-
break;
|
|
144
|
+
return determineJwtStatusListType(credential);
|
|
149
145
|
case "lds":
|
|
150
|
-
|
|
151
|
-
const type = uniform.type.find((t) => {
|
|
152
|
-
return Object.values(import_ssi_types.StatusListType).some((statusType) => t.includes(statusType));
|
|
153
|
-
});
|
|
154
|
-
if (!type) {
|
|
155
|
-
throw new Error("Invalid status list credential type");
|
|
156
|
-
}
|
|
157
|
-
return type.replace("Credential", "");
|
|
146
|
+
return determineLdsStatusListType(credential);
|
|
158
147
|
case "cbor":
|
|
159
148
|
return import_ssi_types.StatusListType.OAuthStatusList;
|
|
149
|
+
default:
|
|
150
|
+
throw new Error("Cannot determine status list type from credential payload");
|
|
160
151
|
}
|
|
161
|
-
throw new Error("Cannot determine status list type from credential payload");
|
|
162
152
|
}
|
|
163
153
|
__name(determineStatusListType, "determineStatusListType");
|
|
154
|
+
function determineJwtStatusListType(credential) {
|
|
155
|
+
const payload = (0, import_jwt_decode.jwtDecode)(credential);
|
|
156
|
+
if ("status_list" in payload) {
|
|
157
|
+
return import_ssi_types.StatusListType.OAuthStatusList;
|
|
158
|
+
}
|
|
159
|
+
if ("credentialSubject" in payload) {
|
|
160
|
+
return getStatusListTypeFromSubject(payload.credentialSubject);
|
|
161
|
+
}
|
|
162
|
+
if ("vc" in payload && "credentialSubject" in payload.vc) {
|
|
163
|
+
return getStatusListTypeFromSubject(payload.vc.credentialSubject);
|
|
164
|
+
}
|
|
165
|
+
throw new Error("Invalid status list credential: credentialSubject not found");
|
|
166
|
+
}
|
|
167
|
+
__name(determineJwtStatusListType, "determineJwtStatusListType");
|
|
168
|
+
function determineLdsStatusListType(credential) {
|
|
169
|
+
const uniform = import_ssi_types.CredentialMapper.toUniformCredential(credential);
|
|
170
|
+
const statusListType = uniform.type.find((type) => Object.values(import_ssi_types.StatusListType).some((statusType) => type.includes(statusType)));
|
|
171
|
+
if (!statusListType) {
|
|
172
|
+
throw new Error("Invalid status list credential type");
|
|
173
|
+
}
|
|
174
|
+
return statusListType.replace("Credential", "");
|
|
175
|
+
}
|
|
176
|
+
__name(determineLdsStatusListType, "determineLdsStatusListType");
|
|
177
|
+
function getStatusListTypeFromSubject(credentialSubject) {
|
|
178
|
+
switch (credentialSubject.type) {
|
|
179
|
+
case "StatusList2021":
|
|
180
|
+
return import_ssi_types.StatusListType.StatusList2021;
|
|
181
|
+
case "BitstringStatusList":
|
|
182
|
+
return import_ssi_types.StatusListType.BitstringStatusList;
|
|
183
|
+
default:
|
|
184
|
+
throw new Error(`Unknown credential subject type: ${credentialSubject.type}`);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
__name(getStatusListTypeFromSubject, "getStatusListTypeFromSubject");
|
|
164
188
|
function determineProofFormat(credential) {
|
|
165
189
|
const type = import_ssi_types.CredentialMapper.detectDocumentType(credential);
|
|
166
190
|
switch (type) {
|
|
@@ -322,46 +346,73 @@ var StatusList2021Implementation = class {
|
|
|
322
346
|
const status = statusList.getStatus(typeof args.statusListIndex === "number" ? args.statusListIndex : parseInt(args.statusListIndex));
|
|
323
347
|
return status ? Status2021.Invalid : Status2021.Valid;
|
|
324
348
|
}
|
|
325
|
-
async
|
|
326
|
-
const
|
|
327
|
-
const uniform = import_ssi_types2.CredentialMapper.toUniformCredential(statusListPayload);
|
|
349
|
+
async extractCredentialDetails(credential) {
|
|
350
|
+
const uniform = import_ssi_types2.CredentialMapper.toUniformCredential(credential);
|
|
328
351
|
const { issuer, credentialSubject } = uniform;
|
|
329
|
-
const
|
|
330
|
-
const encodedList = getAssertedProperty("encodedList", credentialSubject);
|
|
331
|
-
const proofFormat = import_ssi_types2.CredentialMapper.detectDocumentType(statusListPayload) === import_ssi_types2.DocumentFormat.JWT ? "jwt" : "lds";
|
|
332
|
-
const statusPurpose = getAssertedProperty("statusPurpose", credentialSubject);
|
|
333
|
-
const indexingDirection = "rightToLeft";
|
|
334
|
-
const list = await import_vc_status_list.StatusList.decode({
|
|
335
|
-
encodedList
|
|
336
|
-
});
|
|
352
|
+
const subject = Array.isArray(credentialSubject) ? credentialSubject[0] : credentialSubject;
|
|
337
353
|
return {
|
|
338
|
-
|
|
339
|
-
id,
|
|
340
|
-
encodedList,
|
|
354
|
+
id: getAssertedValue("id", uniform.id),
|
|
341
355
|
issuer,
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
correlationId
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
356
|
+
encodedList: getAssertedProperty("encodedList", subject)
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
async toStatusListDetails(args) {
|
|
360
|
+
if ("statusListCredential" in args) {
|
|
361
|
+
const { statusListCredential, correlationId, driverType } = args;
|
|
362
|
+
const uniform = import_ssi_types2.CredentialMapper.toUniformCredential(statusListCredential);
|
|
363
|
+
const { issuer, credentialSubject } = uniform;
|
|
364
|
+
const subject = Array.isArray(credentialSubject) ? credentialSubject[0] : credentialSubject;
|
|
365
|
+
const id = getAssertedValue("id", uniform.id);
|
|
366
|
+
const encodedList = getAssertedProperty("encodedList", subject);
|
|
367
|
+
const statusPurpose = getAssertedProperty("statusPurpose", subject);
|
|
368
|
+
const proofFormat = import_ssi_types2.CredentialMapper.detectDocumentType(statusListCredential) === import_ssi_types2.DocumentFormat.JWT ? "jwt" : "lds";
|
|
369
|
+
const list = await import_vc_status_list.StatusList.decode({
|
|
370
|
+
encodedList
|
|
371
|
+
});
|
|
372
|
+
return {
|
|
373
|
+
id,
|
|
374
|
+
encodedList,
|
|
375
|
+
issuer,
|
|
376
|
+
type: import_ssi_types2.StatusListType.StatusList2021,
|
|
377
|
+
proofFormat,
|
|
378
|
+
length: list.length,
|
|
379
|
+
statusListCredential,
|
|
380
|
+
statuslistContentType: this.buildContentType(proofFormat),
|
|
381
|
+
correlationId,
|
|
382
|
+
driverType,
|
|
383
|
+
indexingDirection: "rightToLeft",
|
|
355
384
|
statusPurpose,
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
},
|
|
360
|
-
...args.driverType && {
|
|
361
|
-
driverType: args.driverType
|
|
385
|
+
statusList2021: {
|
|
386
|
+
indexingDirection: "rightToLeft",
|
|
387
|
+
statusPurpose
|
|
362
388
|
}
|
|
363
|
-
}
|
|
364
|
-
}
|
|
389
|
+
};
|
|
390
|
+
} else {
|
|
391
|
+
const { extractedDetails, statusListEntity } = args;
|
|
392
|
+
const statusList2021Entity = statusListEntity;
|
|
393
|
+
const proofFormat = import_ssi_types2.CredentialMapper.detectDocumentType(statusListEntity.statusListCredential) === import_ssi_types2.DocumentFormat.JWT ? "jwt" : "lds";
|
|
394
|
+
const list = await import_vc_status_list.StatusList.decode({
|
|
395
|
+
encodedList: extractedDetails.encodedList
|
|
396
|
+
});
|
|
397
|
+
return {
|
|
398
|
+
id: extractedDetails.id,
|
|
399
|
+
encodedList: extractedDetails.encodedList,
|
|
400
|
+
issuer: extractedDetails.issuer,
|
|
401
|
+
type: import_ssi_types2.StatusListType.StatusList2021,
|
|
402
|
+
proofFormat,
|
|
403
|
+
length: list.length,
|
|
404
|
+
statusListCredential: statusListEntity.statusListCredential,
|
|
405
|
+
statuslistContentType: this.buildContentType(proofFormat),
|
|
406
|
+
correlationId: statusListEntity.correlationId,
|
|
407
|
+
driverType: statusListEntity.driverType,
|
|
408
|
+
indexingDirection: statusList2021Entity.indexingDirection,
|
|
409
|
+
statusPurpose: statusList2021Entity.statusPurpose,
|
|
410
|
+
statusList2021: {
|
|
411
|
+
indexingDirection: statusList2021Entity.indexingDirection,
|
|
412
|
+
statusPurpose: statusList2021Entity.statusPurpose
|
|
413
|
+
}
|
|
414
|
+
};
|
|
415
|
+
}
|
|
365
416
|
}
|
|
366
417
|
async createCredentialStatus(args) {
|
|
367
418
|
const { statusList, statusListIndex } = args;
|
|
@@ -763,45 +814,80 @@ var OAuthStatusListImplementation = class {
|
|
|
763
814
|
}
|
|
764
815
|
return statusList.getStatus(index);
|
|
765
816
|
}
|
|
766
|
-
async
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
const
|
|
771
|
-
const
|
|
772
|
-
const expiresAt = exp ? new Date(exp * 1e3) : void 0;
|
|
817
|
+
async extractCredentialDetails(credential) {
|
|
818
|
+
if (typeof credential !== "string") {
|
|
819
|
+
return Promise.reject("statusListCredential must be a JWT or CWT string");
|
|
820
|
+
}
|
|
821
|
+
const proofFormat = determineProofFormat(credential);
|
|
822
|
+
const decoded = proofFormat === "jwt" ? decodeStatusListJWT(credential) : decodeStatusListCWT(credential);
|
|
773
823
|
return {
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
encodedList: statusList.compressStatusList(),
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
824
|
+
id: decoded.id,
|
|
825
|
+
issuer: decoded.issuer,
|
|
826
|
+
encodedList: decoded.statusList.compressStatusList(),
|
|
827
|
+
decodedPayload: decoded
|
|
828
|
+
};
|
|
829
|
+
}
|
|
830
|
+
async toStatusListDetails(args) {
|
|
831
|
+
if ("statusListCredential" in args) {
|
|
832
|
+
const { statusListCredential, bitsPerStatus, correlationId, driverType } = args;
|
|
833
|
+
if (!bitsPerStatus || bitsPerStatus < 1) {
|
|
834
|
+
return Promise.reject(Error("bitsPerStatus must be set for OAuth status lists and must be 1 or higher"));
|
|
835
|
+
}
|
|
836
|
+
const proofFormat = determineProofFormat(statusListCredential);
|
|
837
|
+
const decoded = proofFormat === "jwt" ? decodeStatusListJWT(statusListCredential) : decodeStatusListCWT(statusListCredential);
|
|
838
|
+
const { statusList, issuer, id, exp } = decoded;
|
|
839
|
+
const expiresAt = exp ? new Date(exp * 1e3) : void 0;
|
|
840
|
+
return {
|
|
841
|
+
id,
|
|
842
|
+
encodedList: statusList.compressStatusList(),
|
|
843
|
+
issuer,
|
|
844
|
+
type: import_ssi_types4.StatusListType.OAuthStatusList,
|
|
845
|
+
proofFormat,
|
|
846
|
+
length: statusList.statusList.length,
|
|
847
|
+
statusListCredential,
|
|
848
|
+
statuslistContentType: this.buildContentType(proofFormat),
|
|
849
|
+
correlationId,
|
|
850
|
+
driverType,
|
|
792
851
|
bitsPerStatus,
|
|
793
852
|
...expiresAt && {
|
|
794
853
|
expiresAt
|
|
854
|
+
},
|
|
855
|
+
oauthStatusList: {
|
|
856
|
+
bitsPerStatus,
|
|
857
|
+
...expiresAt && {
|
|
858
|
+
expiresAt
|
|
859
|
+
}
|
|
795
860
|
}
|
|
796
|
-
}
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
861
|
+
};
|
|
862
|
+
} else {
|
|
863
|
+
const { extractedDetails, statusListEntity } = args;
|
|
864
|
+
const oauthEntity = statusListEntity;
|
|
865
|
+
const decoded = extractedDetails.decodedPayload;
|
|
866
|
+
const proofFormat = determineProofFormat(statusListEntity.statusListCredential);
|
|
867
|
+
const expiresAt = decoded.exp ? new Date(decoded.exp * 1e3) : void 0;
|
|
868
|
+
return {
|
|
869
|
+
id: extractedDetails.id,
|
|
870
|
+
encodedList: extractedDetails.encodedList,
|
|
871
|
+
issuer: extractedDetails.issuer,
|
|
872
|
+
type: import_ssi_types4.StatusListType.OAuthStatusList,
|
|
873
|
+
proofFormat,
|
|
874
|
+
length: decoded.statusList.statusList.length,
|
|
875
|
+
statusListCredential: statusListEntity.statusListCredential,
|
|
876
|
+
statuslistContentType: this.buildContentType(proofFormat),
|
|
877
|
+
correlationId: statusListEntity.correlationId,
|
|
878
|
+
driverType: statusListEntity.driverType,
|
|
879
|
+
bitsPerStatus: oauthEntity.bitsPerStatus,
|
|
880
|
+
...expiresAt && {
|
|
881
|
+
expiresAt
|
|
882
|
+
},
|
|
883
|
+
oauthStatusList: {
|
|
884
|
+
bitsPerStatus: oauthEntity.bitsPerStatus,
|
|
885
|
+
...expiresAt && {
|
|
886
|
+
expiresAt
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
};
|
|
890
|
+
}
|
|
805
891
|
}
|
|
806
892
|
async createCredentialStatus(args) {
|
|
807
893
|
const { statusList, statusListIndex } = args;
|
|
@@ -839,12 +925,19 @@ var import_ssi_types6 = require("@sphereon/ssi-types");
|
|
|
839
925
|
var import_ssi_types5 = require("@sphereon/ssi-types");
|
|
840
926
|
var import_vc_bitstring_status_lists = require("@4sure-tech/vc-bitstring-status-lists");
|
|
841
927
|
var DEFAULT_LIST_LENGTH3 = 131072;
|
|
842
|
-
var DEFAULT_PROOF_FORMAT3 = "
|
|
928
|
+
var DEFAULT_PROOF_FORMAT3 = "vc+jwt";
|
|
843
929
|
var DEFAULT_STATUS_PURPOSE = "revocation";
|
|
844
930
|
var BitstringStatusListImplementation = class {
|
|
845
931
|
static {
|
|
846
932
|
__name(this, "BitstringStatusListImplementation");
|
|
847
933
|
}
|
|
934
|
+
/**
|
|
935
|
+
* Creates a new bitstring status list with the specified configuration
|
|
936
|
+
*
|
|
937
|
+
* @param args - Configuration for the new status list including issuer, purpose, and size
|
|
938
|
+
* @param context - Veramo agent context for credential operations
|
|
939
|
+
* @returns Promise resolving to the created status list details
|
|
940
|
+
*/
|
|
848
941
|
async createNewStatusList(args, context) {
|
|
849
942
|
if (!args.bitstringStatusList) {
|
|
850
943
|
throw new Error("BitstringStatusList options are required for type BitstringStatusList");
|
|
@@ -852,28 +945,34 @@ var BitstringStatusListImplementation = class {
|
|
|
852
945
|
const length = args?.length ?? DEFAULT_LIST_LENGTH3;
|
|
853
946
|
const proofFormat = args?.proofFormat ?? DEFAULT_PROOF_FORMAT3;
|
|
854
947
|
assertValidProofType(import_ssi_types5.StatusListType.BitstringStatusList, proofFormat);
|
|
855
|
-
const veramoProofFormat = proofFormat;
|
|
856
948
|
const { issuer, id } = args;
|
|
857
949
|
const correlationId = getAssertedValue("correlationId", args.correlationId);
|
|
858
950
|
const { statusPurpose, bitsPerStatus, validFrom, validUntil, ttl } = args.bitstringStatusList;
|
|
859
|
-
const
|
|
860
|
-
|
|
861
|
-
|
|
951
|
+
const unsignedCredential = await (0, import_vc_bitstring_status_lists.createStatusListCredential)({
|
|
952
|
+
id,
|
|
953
|
+
issuer,
|
|
862
954
|
statusPurpose: statusPurpose ?? DEFAULT_STATUS_PURPOSE,
|
|
863
955
|
validFrom: ensureDate(validFrom),
|
|
864
956
|
validUntil: ensureDate(validUntil),
|
|
865
957
|
ttl
|
|
958
|
+
});
|
|
959
|
+
const statusListCredential = await this.createVerifiableCredential({
|
|
960
|
+
unsignedCredential,
|
|
961
|
+
id,
|
|
962
|
+
issuer,
|
|
963
|
+
proofFormat,
|
|
964
|
+
keyRef: args.keyRef
|
|
866
965
|
}, context);
|
|
867
966
|
return {
|
|
868
|
-
encodedList:
|
|
967
|
+
encodedList: unsignedCredential.credentialSubject.encodedList,
|
|
869
968
|
statusListCredential,
|
|
870
969
|
bitstringStatusList: {
|
|
871
970
|
statusPurpose: statusPurpose ?? DEFAULT_STATUS_PURPOSE,
|
|
872
|
-
...
|
|
873
|
-
validFrom: new Date(
|
|
971
|
+
...unsignedCredential.validFrom && {
|
|
972
|
+
validFrom: new Date(unsignedCredential.validFrom)
|
|
874
973
|
},
|
|
875
|
-
...
|
|
876
|
-
validUntil: new Date(
|
|
974
|
+
...unsignedCredential.validUntil && {
|
|
975
|
+
validUntil: new Date(unsignedCredential.validUntil)
|
|
877
976
|
},
|
|
878
977
|
ttl,
|
|
879
978
|
bitsPerStatus
|
|
@@ -887,9 +986,16 @@ var BitstringStatusListImplementation = class {
|
|
|
887
986
|
statuslistContentType: this.buildContentType(proofFormat)
|
|
888
987
|
};
|
|
889
988
|
}
|
|
989
|
+
/**
|
|
990
|
+
* Updates the status of a specific credential in an existing status list
|
|
991
|
+
*
|
|
992
|
+
* @param args - Update parameters including the status list credential, index, and new value
|
|
993
|
+
* @param context - Veramo agent context for credential operations
|
|
994
|
+
* @returns Promise resolving to the updated status list details
|
|
995
|
+
*/
|
|
890
996
|
async updateStatusListIndex(args, context) {
|
|
891
997
|
if (!args.bitsPerStatus || args.bitsPerStatus < 1) {
|
|
892
|
-
return Promise.reject("bitsPerStatus must be set for bitstring status lists and must be 1 or higher. (updateStatusListIndex)");
|
|
998
|
+
return Promise.reject(Error("bitsPerStatus must be set for bitstring status lists and must be 1 or higher. (updateStatusListIndex)"));
|
|
893
999
|
}
|
|
894
1000
|
const credential = args.statusListCredential;
|
|
895
1001
|
const uniform = import_ssi_types5.CredentialMapper.toUniformCredential(credential);
|
|
@@ -901,34 +1007,40 @@ var BitstringStatusListImplementation = class {
|
|
|
901
1007
|
encodedList: origEncodedList,
|
|
902
1008
|
statusSize: args.bitsPerStatus
|
|
903
1009
|
});
|
|
904
|
-
|
|
905
|
-
|
|
1010
|
+
const bitstringStatusId = args.value;
|
|
1011
|
+
statusList.setStatus(index, bitstringStatusId);
|
|
1012
|
+
const proofFormat = import_ssi_types5.CredentialMapper.detectDocumentType(credential) === import_ssi_types5.DocumentFormat.JWT ? "vc+jwt" : "lds";
|
|
906
1013
|
const credSubject = Array.isArray(credentialSubject) ? credentialSubject[0] : credentialSubject;
|
|
907
1014
|
const statusPurpose = getAssertedProperty("statusPurpose", credSubject);
|
|
908
1015
|
const validFrom = uniform.validFrom ? new Date(uniform.validFrom) : void 0;
|
|
909
1016
|
const validUntil = uniform.validUntil ? new Date(uniform.validUntil) : void 0;
|
|
910
1017
|
const ttl = credSubject.ttl;
|
|
911
|
-
const
|
|
912
|
-
...args,
|
|
1018
|
+
const unsignedCredential = await (0, import_vc_bitstring_status_lists.createStatusListCredential)({
|
|
913
1019
|
id,
|
|
914
1020
|
issuer,
|
|
915
1021
|
statusList,
|
|
1022
|
+
statusPurpose: statusPurpose ?? DEFAULT_STATUS_PURPOSE,
|
|
1023
|
+
validFrom: ensureDate(validFrom),
|
|
1024
|
+
validUntil: ensureDate(validUntil),
|
|
1025
|
+
ttl
|
|
1026
|
+
});
|
|
1027
|
+
const updatedCredential = await this.createVerifiableCredential({
|
|
1028
|
+
unsignedCredential,
|
|
1029
|
+
id,
|
|
1030
|
+
issuer,
|
|
916
1031
|
proofFormat,
|
|
917
|
-
|
|
918
|
-
ttl,
|
|
919
|
-
validFrom,
|
|
920
|
-
validUntil
|
|
1032
|
+
keyRef: args.keyRef
|
|
921
1033
|
}, context);
|
|
922
1034
|
return {
|
|
923
1035
|
statusListCredential: updatedCredential,
|
|
924
|
-
encodedList:
|
|
1036
|
+
encodedList: unsignedCredential.credentialSubject.encodedList,
|
|
925
1037
|
bitstringStatusList: {
|
|
926
1038
|
statusPurpose,
|
|
927
|
-
...
|
|
928
|
-
validFrom: new Date(
|
|
1039
|
+
...unsignedCredential.validFrom && {
|
|
1040
|
+
validFrom: new Date(unsignedCredential.validFrom)
|
|
929
1041
|
},
|
|
930
|
-
...
|
|
931
|
-
validUntil: new Date(
|
|
1042
|
+
...unsignedCredential.validUntil && {
|
|
1043
|
+
validUntil: new Date(unsignedCredential.validUntil)
|
|
932
1044
|
},
|
|
933
1045
|
bitsPerStatus: args.bitsPerStatus,
|
|
934
1046
|
ttl
|
|
@@ -941,17 +1053,23 @@ var BitstringStatusListImplementation = class {
|
|
|
941
1053
|
statuslistContentType: this.buildContentType(proofFormat)
|
|
942
1054
|
};
|
|
943
1055
|
}
|
|
1056
|
+
/**
|
|
1057
|
+
* Updates a status list by decoding an encoded list, modifying it, and re-encoding
|
|
1058
|
+
*
|
|
1059
|
+
* @param args - Update parameters including encoded list, index, and new value
|
|
1060
|
+
* @param context - Veramo agent context for credential operations
|
|
1061
|
+
* @returns Promise resolving to the updated status list details
|
|
1062
|
+
*/
|
|
944
1063
|
async updateStatusListFromEncodedList(args, context) {
|
|
945
1064
|
if (!args.bitstringStatusList) {
|
|
946
1065
|
throw new Error("bitstringStatusList options required for type BitstringStatusList");
|
|
947
1066
|
}
|
|
948
1067
|
if (args.bitstringStatusList.bitsPerStatus < 1) {
|
|
949
|
-
return Promise.reject("bitsPerStatus must be set for bitstring status lists and must be 1 or higher. (updateStatusListFromEncodedList)");
|
|
1068
|
+
return Promise.reject(Error("bitsPerStatus must be set for bitstring status lists and must be 1 or higher. (updateStatusListFromEncodedList)"));
|
|
950
1069
|
}
|
|
951
1070
|
const { statusPurpose, bitsPerStatus, ttl, validFrom, validUntil } = args.bitstringStatusList;
|
|
952
1071
|
const proofFormat = args?.proofFormat ?? DEFAULT_PROOF_FORMAT3;
|
|
953
1072
|
assertValidProofType(import_ssi_types5.StatusListType.BitstringStatusList, proofFormat);
|
|
954
|
-
const veramoProofFormat = proofFormat;
|
|
955
1073
|
const { issuer, id } = getAssertedValues(args);
|
|
956
1074
|
const statusList = await import_vc_bitstring_status_lists.BitstreamStatusList.decode({
|
|
957
1075
|
encodedList: args.encodedList,
|
|
@@ -959,29 +1077,34 @@ var BitstringStatusListImplementation = class {
|
|
|
959
1077
|
});
|
|
960
1078
|
const index = typeof args.statusListIndex === "number" ? args.statusListIndex : parseInt(args.statusListIndex);
|
|
961
1079
|
statusList.setStatus(index, args.value);
|
|
962
|
-
const
|
|
1080
|
+
const unsignedCredential = await (0, import_vc_bitstring_status_lists.createStatusListCredential)({
|
|
963
1081
|
id,
|
|
964
1082
|
issuer,
|
|
965
1083
|
statusList,
|
|
966
|
-
|
|
967
|
-
keyRef: args.keyRef,
|
|
968
|
-
statusPurpose,
|
|
1084
|
+
statusPurpose: statusPurpose ?? DEFAULT_STATUS_PURPOSE,
|
|
969
1085
|
validFrom: ensureDate(validFrom),
|
|
970
1086
|
validUntil: ensureDate(validUntil),
|
|
971
1087
|
ttl
|
|
1088
|
+
});
|
|
1089
|
+
const credential = await this.createVerifiableCredential({
|
|
1090
|
+
unsignedCredential,
|
|
1091
|
+
id,
|
|
1092
|
+
issuer,
|
|
1093
|
+
proofFormat,
|
|
1094
|
+
keyRef: args.keyRef
|
|
972
1095
|
}, context);
|
|
973
1096
|
return {
|
|
974
1097
|
type: import_ssi_types5.StatusListType.BitstringStatusList,
|
|
975
1098
|
statusListCredential: credential,
|
|
976
|
-
encodedList:
|
|
1099
|
+
encodedList: unsignedCredential.credentialSubject.encodedList,
|
|
977
1100
|
bitstringStatusList: {
|
|
978
1101
|
statusPurpose,
|
|
979
1102
|
bitsPerStatus,
|
|
980
|
-
...
|
|
981
|
-
validFrom: new Date(
|
|
1103
|
+
...unsignedCredential.validFrom && {
|
|
1104
|
+
validFrom: new Date(unsignedCredential.validFrom)
|
|
982
1105
|
},
|
|
983
|
-
...
|
|
984
|
-
validUntil: new Date(
|
|
1106
|
+
...unsignedCredential.validUntil && {
|
|
1107
|
+
validUntil: new Date(unsignedCredential.validUntil)
|
|
985
1108
|
},
|
|
986
1109
|
ttl
|
|
987
1110
|
},
|
|
@@ -992,17 +1115,22 @@ var BitstringStatusListImplementation = class {
|
|
|
992
1115
|
statuslistContentType: this.buildContentType(proofFormat)
|
|
993
1116
|
};
|
|
994
1117
|
}
|
|
1118
|
+
/**
|
|
1119
|
+
* Checks the status of a specific credential by its index in the status list
|
|
1120
|
+
*
|
|
1121
|
+
* @param args - Check parameters including the status list credential and index
|
|
1122
|
+
* @returns Promise resolving to the status value at the specified index
|
|
1123
|
+
*/
|
|
995
1124
|
async checkStatusIndex(args) {
|
|
996
1125
|
if (!args.bitsPerStatus || args.bitsPerStatus < 1) {
|
|
997
|
-
return Promise.reject("bitsPerStatus must be set for bitstring status lists and must be 1 or higher. (checkStatusIndex)");
|
|
1126
|
+
return Promise.reject(Error("bitsPerStatus must be set for bitstring status lists and must be 1 or higher. (checkStatusIndex)"));
|
|
998
1127
|
}
|
|
999
1128
|
const uniform = import_ssi_types5.CredentialMapper.toUniformCredential(args.statusListCredential);
|
|
1000
1129
|
const { credentialSubject } = uniform;
|
|
1001
1130
|
const encodedList = getAssertedProperty("encodedList", credentialSubject);
|
|
1002
|
-
const statusSize = args.bitsPerStatus;
|
|
1003
1131
|
const statusList = await import_vc_bitstring_status_lists.BitstreamStatusList.decode({
|
|
1004
1132
|
encodedList,
|
|
1005
|
-
statusSize
|
|
1133
|
+
statusSize: args.bitsPerStatus
|
|
1006
1134
|
});
|
|
1007
1135
|
const numIndex = typeof args.statusListIndex === "number" ? args.statusListIndex : parseInt(args.statusListIndex);
|
|
1008
1136
|
if (statusList.getLength() <= numIndex) {
|
|
@@ -1010,48 +1138,44 @@ var BitstringStatusListImplementation = class {
|
|
|
1010
1138
|
}
|
|
1011
1139
|
return statusList.getStatus(numIndex);
|
|
1012
1140
|
}
|
|
1013
|
-
async
|
|
1014
|
-
const
|
|
1015
|
-
if (!bitsPerStatus || bitsPerStatus < 1) {
|
|
1016
|
-
return Promise.reject("bitsPerStatus must be set for bitstring status lists and must be 1 or higher. (toStatusListDetails)");
|
|
1017
|
-
}
|
|
1018
|
-
const uniform = import_ssi_types5.CredentialMapper.toUniformCredential(statusListPayload);
|
|
1141
|
+
async extractCredentialDetails(credential) {
|
|
1142
|
+
const uniform = import_ssi_types5.CredentialMapper.toUniformCredential(credential);
|
|
1019
1143
|
const { issuer, credentialSubject } = uniform;
|
|
1020
|
-
const
|
|
1021
|
-
const encodedList = getAssertedProperty("encodedList", credentialSubject);
|
|
1022
|
-
const proofFormat = import_ssi_types5.CredentialMapper.detectDocumentType(statusListPayload) === import_ssi_types5.DocumentFormat.JWT ? "jwt" : "lds";
|
|
1023
|
-
const credSubject = Array.isArray(credentialSubject) ? credentialSubject[0] : credentialSubject;
|
|
1024
|
-
const statusPurpose = getAssertedProperty("statusPurpose", credSubject);
|
|
1025
|
-
const validFrom = uniform.validFrom ? new Date(uniform.validFrom) : void 0;
|
|
1026
|
-
const validUntil = uniform.validUntil ? new Date(uniform.validUntil) : void 0;
|
|
1027
|
-
const ttl = credSubject.ttl;
|
|
1028
|
-
const statuslistLength = import_vc_bitstring_status_lists.BitstreamStatusList.getStatusListLength(encodedList, bitsPerStatus);
|
|
1144
|
+
const subject = Array.isArray(credentialSubject) ? credentialSubject[0] : credentialSubject;
|
|
1029
1145
|
return {
|
|
1030
|
-
|
|
1031
|
-
id,
|
|
1032
|
-
encodedList,
|
|
1146
|
+
id: getAssertedValue("id", uniform.id),
|
|
1033
1147
|
issuer,
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
correlationId
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1148
|
+
encodedList: getAssertedProperty("encodedList", subject)
|
|
1149
|
+
};
|
|
1150
|
+
}
|
|
1151
|
+
async toStatusListDetails(args) {
|
|
1152
|
+
if ("statusListCredential" in args) {
|
|
1153
|
+
const { statusListCredential, bitsPerStatus, correlationId, driverType } = args;
|
|
1154
|
+
if (!bitsPerStatus || bitsPerStatus < 1) {
|
|
1155
|
+
return Promise.reject(Error("bitsPerStatus must be set for bitstring status lists and must be 1 or higher"));
|
|
1156
|
+
}
|
|
1157
|
+
const uniform = import_ssi_types5.CredentialMapper.toUniformCredential(statusListCredential);
|
|
1158
|
+
const { issuer, credentialSubject } = uniform;
|
|
1159
|
+
const subject = Array.isArray(credentialSubject) ? credentialSubject[0] : credentialSubject;
|
|
1160
|
+
const id = getAssertedValue("id", uniform.id);
|
|
1161
|
+
const encodedList = getAssertedProperty("encodedList", subject);
|
|
1162
|
+
const statusPurpose = getAssertedProperty("statusPurpose", subject);
|
|
1163
|
+
const validFrom = uniform.validFrom ? new Date(uniform.validFrom) : void 0;
|
|
1164
|
+
const validUntil = uniform.validUntil ? new Date(uniform.validUntil) : void 0;
|
|
1165
|
+
const ttl = subject.ttl;
|
|
1166
|
+
const proofFormat = import_ssi_types5.CredentialMapper.detectDocumentType(statusListCredential) === import_ssi_types5.DocumentFormat.JWT ? "vc+jwt" : "lds";
|
|
1167
|
+
const statuslistLength = import_vc_bitstring_status_lists.BitstreamStatusList.getStatusListLength(encodedList, bitsPerStatus);
|
|
1168
|
+
return {
|
|
1169
|
+
id,
|
|
1170
|
+
encodedList,
|
|
1171
|
+
issuer,
|
|
1172
|
+
type: import_ssi_types5.StatusListType.BitstringStatusList,
|
|
1173
|
+
proofFormat,
|
|
1174
|
+
length: statuslistLength,
|
|
1175
|
+
statusListCredential,
|
|
1176
|
+
statuslistContentType: this.buildContentType(proofFormat),
|
|
1177
|
+
correlationId,
|
|
1178
|
+
driverType,
|
|
1055
1179
|
statusPurpose,
|
|
1056
1180
|
bitsPerStatus,
|
|
1057
1181
|
...validFrom && {
|
|
@@ -1062,56 +1186,124 @@ var BitstringStatusListImplementation = class {
|
|
|
1062
1186
|
},
|
|
1063
1187
|
...ttl && {
|
|
1064
1188
|
ttl
|
|
1189
|
+
},
|
|
1190
|
+
bitstringStatusList: {
|
|
1191
|
+
statusPurpose,
|
|
1192
|
+
bitsPerStatus,
|
|
1193
|
+
...validFrom && {
|
|
1194
|
+
validFrom
|
|
1195
|
+
},
|
|
1196
|
+
...validUntil && {
|
|
1197
|
+
validUntil
|
|
1198
|
+
},
|
|
1199
|
+
...ttl && {
|
|
1200
|
+
ttl
|
|
1201
|
+
}
|
|
1065
1202
|
}
|
|
1066
|
-
}
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
driverType: args.driverType
|
|
1203
|
+
};
|
|
1204
|
+
} else {
|
|
1205
|
+
const { extractedDetails, statusListEntity } = args;
|
|
1206
|
+
const bitstringEntity = statusListEntity;
|
|
1207
|
+
if (!bitstringEntity.bitsPerStatus) {
|
|
1208
|
+
return Promise.reject(Error("bitsPerStatus must be present for a bitstring status list"));
|
|
1073
1209
|
}
|
|
1074
|
-
|
|
1210
|
+
const proofFormat = import_ssi_types5.CredentialMapper.detectDocumentType(statusListEntity.statusListCredential) === import_ssi_types5.DocumentFormat.JWT ? "vc+jwt" : "lds";
|
|
1211
|
+
const statuslistLength = import_vc_bitstring_status_lists.BitstreamStatusList.getStatusListLength(extractedDetails.encodedList, bitstringEntity.bitsPerStatus);
|
|
1212
|
+
return {
|
|
1213
|
+
id: extractedDetails.id,
|
|
1214
|
+
encodedList: extractedDetails.encodedList,
|
|
1215
|
+
issuer: extractedDetails.issuer,
|
|
1216
|
+
type: import_ssi_types5.StatusListType.BitstringStatusList,
|
|
1217
|
+
proofFormat,
|
|
1218
|
+
length: statuslistLength,
|
|
1219
|
+
statusListCredential: statusListEntity.statusListCredential,
|
|
1220
|
+
statuslistContentType: this.buildContentType(proofFormat),
|
|
1221
|
+
correlationId: statusListEntity.correlationId,
|
|
1222
|
+
driverType: statusListEntity.driverType,
|
|
1223
|
+
statusPurpose: bitstringEntity.statusPurpose,
|
|
1224
|
+
bitsPerStatus: bitstringEntity.bitsPerStatus,
|
|
1225
|
+
...bitstringEntity.validFrom && {
|
|
1226
|
+
validFrom: bitstringEntity.validFrom
|
|
1227
|
+
},
|
|
1228
|
+
...bitstringEntity.validUntil && {
|
|
1229
|
+
validUntil: bitstringEntity.validUntil
|
|
1230
|
+
},
|
|
1231
|
+
...bitstringEntity.ttl && {
|
|
1232
|
+
ttl: bitstringEntity.ttl
|
|
1233
|
+
},
|
|
1234
|
+
bitstringStatusList: {
|
|
1235
|
+
statusPurpose: bitstringEntity.statusPurpose,
|
|
1236
|
+
bitsPerStatus: bitstringEntity.bitsPerStatus,
|
|
1237
|
+
...bitstringEntity.validFrom && {
|
|
1238
|
+
validFrom: bitstringEntity.validFrom
|
|
1239
|
+
},
|
|
1240
|
+
...bitstringEntity.validUntil && {
|
|
1241
|
+
validUntil: bitstringEntity.validUntil
|
|
1242
|
+
},
|
|
1243
|
+
...bitstringEntity.ttl && {
|
|
1244
|
+
ttl: bitstringEntity.ttl
|
|
1245
|
+
}
|
|
1246
|
+
}
|
|
1247
|
+
};
|
|
1248
|
+
}
|
|
1075
1249
|
}
|
|
1250
|
+
/**
|
|
1251
|
+
* Creates a credential status entry for a specific credential in a status list
|
|
1252
|
+
*
|
|
1253
|
+
* @param args - Parameters including the status list, entry details, and index
|
|
1254
|
+
* @returns Promise resolving to the credential status entry
|
|
1255
|
+
*/
|
|
1076
1256
|
async createCredentialStatus(args) {
|
|
1077
1257
|
const { statusList, statusListEntry, statusListIndex } = args;
|
|
1078
|
-
const isBitstringEntry = /* @__PURE__ */ __name((entry) => {
|
|
1079
|
-
return "statusPurpose" in entry;
|
|
1080
|
-
}, "isBitstringEntry");
|
|
1081
|
-
if (!isBitstringEntry(statusListEntry)) {
|
|
1082
|
-
throw new Error("Expected bitstring status list entry for bitstring status list");
|
|
1083
|
-
}
|
|
1084
1258
|
const bitstringStatusList = statusList;
|
|
1259
|
+
const bitstringStatusListEntry = statusListEntry;
|
|
1085
1260
|
return {
|
|
1086
1261
|
id: `${statusList.id}#${statusListIndex}`,
|
|
1087
1262
|
type: "BitstringStatusListEntry",
|
|
1088
|
-
statusPurpose:
|
|
1263
|
+
statusPurpose: bitstringStatusListEntry.statusPurpose,
|
|
1089
1264
|
statusListIndex: "" + statusListIndex,
|
|
1090
1265
|
statusListCredential: statusList.id,
|
|
1091
|
-
bitsPerStatus: bitstringStatusList.bitsPerStatus
|
|
1266
|
+
bitsPerStatus: bitstringStatusList.bitsPerStatus,
|
|
1267
|
+
statusMessage: bitstringStatusListEntry.statusMessage,
|
|
1268
|
+
statusReference: bitstringStatusListEntry.statusReference
|
|
1092
1269
|
};
|
|
1093
1270
|
}
|
|
1271
|
+
/**
|
|
1272
|
+
* Creates a signed verifiable credential from an unsigned status list credential
|
|
1273
|
+
*
|
|
1274
|
+
* @param args - Parameters including the unsigned credential and signing details
|
|
1275
|
+
* @param context - Veramo agent context for credential operations
|
|
1276
|
+
* @returns Promise resolving to the signed credential
|
|
1277
|
+
*/
|
|
1094
1278
|
async createVerifiableCredential(args, context) {
|
|
1279
|
+
const { unsignedCredential, issuer, proofFormat, keyRef } = args;
|
|
1095
1280
|
const identifier = await context.agent.identifierManagedGet({
|
|
1096
|
-
identifier: typeof
|
|
1281
|
+
identifier: typeof issuer === "string" ? issuer : issuer.id,
|
|
1097
1282
|
vmRelationship: "assertionMethod",
|
|
1098
1283
|
offlineWhenNoDIDRegistered: true
|
|
1099
1284
|
});
|
|
1100
|
-
const unsignedCredential = await (0, import_vc_bitstring_status_lists.createStatusListCredential)(args);
|
|
1101
1285
|
const verifiableCredential = await context.agent.createVerifiableCredential({
|
|
1102
1286
|
credential: unsignedCredential,
|
|
1103
|
-
keyRef:
|
|
1104
|
-
proofFormat
|
|
1287
|
+
keyRef: keyRef ?? identifier.kmsKeyRef,
|
|
1288
|
+
proofFormat,
|
|
1105
1289
|
fetchRemoteContexts: true
|
|
1106
1290
|
});
|
|
1107
1291
|
return import_ssi_types5.CredentialMapper.toWrappedVerifiableCredential(verifiableCredential).original;
|
|
1108
1292
|
}
|
|
1293
|
+
/**
|
|
1294
|
+
* Builds the appropriate content type string for a given proof format
|
|
1295
|
+
*
|
|
1296
|
+
* @param proofFormat - The proof format to build content type for
|
|
1297
|
+
* @returns The corresponding content type string
|
|
1298
|
+
*/
|
|
1109
1299
|
buildContentType(proofFormat) {
|
|
1110
1300
|
switch (proofFormat) {
|
|
1111
1301
|
case "jwt":
|
|
1112
|
-
return
|
|
1302
|
+
return "application/statuslist+jwt";
|
|
1113
1303
|
case "cbor":
|
|
1114
|
-
return
|
|
1304
|
+
return "application/statuslist+cwt";
|
|
1305
|
+
case "vc+jwt":
|
|
1306
|
+
return "application/statuslist+vc+jwt";
|
|
1115
1307
|
case "lds":
|
|
1116
1308
|
return "application/statuslist+ld+json";
|
|
1117
1309
|
default:
|
|
@@ -1267,37 +1459,24 @@ async function updateStatusIndexFromStatusListCredential(args, context) {
|
|
|
1267
1459
|
return implementation.updateStatusListIndex(args, context);
|
|
1268
1460
|
}
|
|
1269
1461
|
__name(updateStatusIndexFromStatusListCredential, "updateStatusIndexFromStatusListCredential");
|
|
1270
|
-
async function
|
|
1271
|
-
const
|
|
1272
|
-
let statusListType;
|
|
1273
|
-
const documentFormat = import_ssi_types7.CredentialMapper.detectDocumentType(credential);
|
|
1274
|
-
if (documentFormat === import_ssi_types7.DocumentFormat.JWT) {
|
|
1275
|
-
const [header] = credential.split(".");
|
|
1276
|
-
const decodedHeader = JSON.parse(Buffer.from(header, "base64").toString());
|
|
1277
|
-
if (decodedHeader.typ === "statuslist+jwt") {
|
|
1278
|
-
statusListType = import_ssi_types7.StatusListType.OAuthStatusList;
|
|
1279
|
-
}
|
|
1280
|
-
} else if (documentFormat === import_ssi_types7.DocumentFormat.MSO_MDOC) {
|
|
1281
|
-
statusListType = import_ssi_types7.StatusListType.OAuthStatusList;
|
|
1282
|
-
}
|
|
1283
|
-
if (!statusListType) {
|
|
1284
|
-
const uniform = import_ssi_types7.CredentialMapper.toUniformCredential(credential);
|
|
1285
|
-
const type = uniform.type.find((t) => t.includes("StatusList2021") || t.includes("OAuth2StatusList") || t.includes("BitstringStatusList"));
|
|
1286
|
-
if (!type) {
|
|
1287
|
-
throw new Error("Invalid status list credential type");
|
|
1288
|
-
}
|
|
1289
|
-
statusListType = type.replace("Credential", "");
|
|
1290
|
-
}
|
|
1462
|
+
async function extractCredentialDetails(statusListCredential) {
|
|
1463
|
+
const statusListType = determineStatusListType(statusListCredential);
|
|
1291
1464
|
const implementation = getStatusListImplementation(statusListType);
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1465
|
+
return implementation.extractCredentialDetails(statusListCredential);
|
|
1466
|
+
}
|
|
1467
|
+
__name(extractCredentialDetails, "extractCredentialDetails");
|
|
1468
|
+
async function toStatusListDetails(args) {
|
|
1469
|
+
if ("statusListCredential" in args) {
|
|
1470
|
+
const statusListType = args.statusListType;
|
|
1471
|
+
const implementation = getStatusListImplementation(statusListType);
|
|
1472
|
+
return implementation.toStatusListDetails(args);
|
|
1473
|
+
} else {
|
|
1474
|
+
const statusListType = args.statusListEntity.type;
|
|
1475
|
+
const implementation = getStatusListImplementation(statusListType);
|
|
1476
|
+
return implementation.toStatusListDetails(args);
|
|
1477
|
+
}
|
|
1299
1478
|
}
|
|
1300
|
-
__name(
|
|
1479
|
+
__name(toStatusListDetails, "toStatusListDetails");
|
|
1301
1480
|
async function createCredentialStatusFromStatusList(args) {
|
|
1302
1481
|
const { statusList, statusListEntry, statusListIndex } = args;
|
|
1303
1482
|
const statusListType = determineStatusListType(statusList.statusListCredential);
|