@sphereon/ssi-sdk.vc-status-list 0.34.1-feature.SSISDK.26.RP.57 → 0.34.1-feature.SSISDK.44.finish.dcql.309

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
@@ -51,17 +51,17 @@ __export(index_exports, {
51
51
  module.exports = __toCommonJS(index_exports);
52
52
 
53
53
  // src/types/index.ts
54
- var StatusOAuth = /* @__PURE__ */ function(StatusOAuth2) {
54
+ var StatusOAuth = /* @__PURE__ */ (function(StatusOAuth2) {
55
55
  StatusOAuth2[StatusOAuth2["Valid"] = 0] = "Valid";
56
56
  StatusOAuth2[StatusOAuth2["Invalid"] = 1] = "Invalid";
57
57
  StatusOAuth2[StatusOAuth2["Suspended"] = 2] = "Suspended";
58
58
  return StatusOAuth2;
59
- }({});
60
- var Status2021 = /* @__PURE__ */ function(Status20212) {
59
+ })({});
60
+ var Status2021 = /* @__PURE__ */ (function(Status20212) {
61
61
  Status20212[Status20212["Valid"] = 0] = "Valid";
62
62
  Status20212[Status20212["Invalid"] = 1] = "Invalid";
63
63
  return Status20212;
64
- }({});
64
+ })({});
65
65
 
66
66
  // src/functions.ts
67
67
  var import_ssi_types7 = require("@sphereon/ssi-types");
@@ -251,7 +251,8 @@ var StatusList2021Implementation = class {
251
251
  statusListCredential,
252
252
  statusList2021: {
253
253
  statusPurpose,
254
- indexingDirection: "rightToLeft"
254
+ indexingDirection: "rightToLeft",
255
+ credentialIdMode: import_ssi_types2.StatusListCredentialIdMode.ISSUANCE
255
256
  },
256
257
  length,
257
258
  type: import_ssi_types2.StatusListType.StatusList2021,
@@ -290,7 +291,8 @@ var StatusList2021Implementation = class {
290
291
  encodedList,
291
292
  statusList2021: {
292
293
  statusPurpose: credentialSubject.statusPurpose,
293
- indexingDirection: "rightToLeft"
294
+ indexingDirection: "rightToLeft",
295
+ credentialIdMode: import_ssi_types2.StatusListCredentialIdMode.ISSUANCE
294
296
  },
295
297
  length: statusList.length - 1,
296
298
  type: import_ssi_types2.StatusListType.StatusList2021,
@@ -327,7 +329,8 @@ var StatusList2021Implementation = class {
327
329
  encodedList: newEncodedList,
328
330
  statusList2021: {
329
331
  statusPurpose: args.statusList2021.statusPurpose,
330
- indexingDirection: "rightToLeft"
332
+ indexingDirection: "rightToLeft",
333
+ credentialIdMode: import_ssi_types2.StatusListCredentialIdMode.ISSUANCE
331
334
  },
332
335
  length: statusList.length,
333
336
  proofFormat: args.proofFormat ?? "lds",
@@ -389,7 +392,8 @@ var StatusList2021Implementation = class {
389
392
  statusPurpose,
390
393
  statusList2021: {
391
394
  indexingDirection: "rightToLeft",
392
- statusPurpose
395
+ statusPurpose,
396
+ credentialIdMode: import_ssi_types2.StatusListCredentialIdMode.ISSUANCE
393
397
  }
394
398
  };
395
399
  } else {
@@ -414,7 +418,8 @@ var StatusList2021Implementation = class {
414
418
  statusPurpose: statusList2021Entity.statusPurpose,
415
419
  statusList2021: {
416
420
  indexingDirection: statusList2021Entity.indexingDirection,
417
- statusPurpose: statusList2021Entity.statusPurpose
421
+ statusPurpose: statusList2021Entity.statusPurpose,
422
+ credentialIdMode: import_ssi_types2.StatusListCredentialIdMode.ISSUANCE
418
423
  }
419
424
  };
420
425
  }
@@ -563,11 +568,12 @@ var getSigningAlgo = /* @__PURE__ */ __name((type) => {
563
568
  // src/impl/encoding/cbor.ts
564
569
  var import_jwt_status_list2 = require("@sd-jwt/jwt-status-list");
565
570
  var import_pako = require("pako");
566
- var mdoc = __toESM(require("@sphereon/kmp-mdoc-core"), 1);
571
+ var import_kmp_mdoc_core = __toESM(require("@sphereon/kmp-mdoc-core"), 1);
567
572
  var import_base64url2 = __toESM(require("base64url"), 1);
568
- var CborByteString = mdoc.com.sphereon.cbor.CborByteString;
569
- var CborUInt = mdoc.com.sphereon.cbor.CborUInt;
570
- var CborString = mdoc.com.sphereon.cbor.CborString;
573
+ var { com, kotlin } = import_kmp_mdoc_core.default;
574
+ var CborByteString = import_kmp_mdoc_core.default.com.sphereon.cbor.CborByteString;
575
+ var CborUInt = import_kmp_mdoc_core.default.com.sphereon.cbor.CborUInt;
576
+ var CborString = import_kmp_mdoc_core.default.com.sphereon.cbor.CborString;
571
577
  var decompressRawStatusList = import_jwt_status_list2.StatusList.decodeStatusList.bind(import_jwt_status_list2.StatusList);
572
578
  var CWT_CLAIMS = {
573
579
  SUBJECT: 2,
@@ -584,25 +590,25 @@ var createSignedCbor = /* @__PURE__ */ __name(async (context, statusList, issuer
584
590
  level: 9
585
591
  });
586
592
  const compressedBytes = new Int8Array(compressedList);
587
- const statusListMap = new mdoc.com.sphereon.cbor.CborMap(mdoc.kotlin.collections.KtMutableMap.fromJsMap(/* @__PURE__ */ new Map([
593
+ const statusListMap = new com.sphereon.cbor.CborMap(kotlin.collections.KtMutableMap.fromJsMap(/* @__PURE__ */ new Map([
588
594
  [
589
- new mdoc.com.sphereon.cbor.CborString("bits"),
590
- new mdoc.com.sphereon.cbor.CborUInt(mdoc.com.sphereon.kmp.LongKMP.fromNumber(statusList.getBitsPerStatus()))
595
+ new com.sphereon.cbor.CborString("bits"),
596
+ new com.sphereon.cbor.CborUInt(com.sphereon.kmp.LongKMP.fromNumber(statusList.getBitsPerStatus()))
591
597
  ],
592
598
  [
593
- new mdoc.com.sphereon.cbor.CborString("lst"),
594
- new mdoc.com.sphereon.cbor.CborByteString(compressedBytes)
599
+ new com.sphereon.cbor.CborString("lst"),
600
+ new com.sphereon.cbor.CborByteString(compressedBytes)
595
601
  ]
596
602
  ])));
597
- const protectedHeader = new mdoc.com.sphereon.cbor.CborMap(mdoc.kotlin.collections.KtMutableMap.fromJsMap(/* @__PURE__ */ new Map([
603
+ const protectedHeader = new com.sphereon.cbor.CborMap(kotlin.collections.KtMutableMap.fromJsMap(/* @__PURE__ */ new Map([
598
604
  [
599
- new mdoc.com.sphereon.cbor.CborUInt(mdoc.com.sphereon.kmp.LongKMP.fromNumber(16)),
600
- new mdoc.com.sphereon.cbor.CborString("statuslist+cwt")
605
+ new com.sphereon.cbor.CborUInt(com.sphereon.kmp.LongKMP.fromNumber(16)),
606
+ new com.sphereon.cbor.CborString("statuslist+cwt")
601
607
  ]
602
608
  ])));
603
- const protectedHeaderEncoded = mdoc.com.sphereon.cbor.Cbor.encode(protectedHeader);
609
+ const protectedHeaderEncoded = com.sphereon.cbor.Cbor.encode(protectedHeader);
604
610
  const claimsMap = buildClaimsMap(id, issuerString, statusListMap, expiresAt);
605
- const claimsEncoded = mdoc.com.sphereon.cbor.Cbor.encode(claimsMap);
611
+ const claimsEncoded = com.sphereon.cbor.Cbor.encode(claimsMap);
606
612
  const signedCWT = await context.agent.keyManagerSign({
607
613
  keyRef: identifier.kmsKeyRef,
608
614
  data: import_base64url2.default.encode(Buffer.from(claimsEncoded)),
@@ -617,8 +623,8 @@ var createSignedCbor = /* @__PURE__ */ __name(async (context, statusList, issuer
617
623
  new CborByteString(claimsEncodedInt8),
618
624
  new CborByteString(signatureInt8)
619
625
  ];
620
- const cwtArray = new mdoc.com.sphereon.cbor.CborArray(mdoc.kotlin.collections.KtMutableList.fromJsArray(cwtArrayElements));
621
- const cwtEncoded = mdoc.com.sphereon.cbor.Cbor.encode(cwtArray);
626
+ const cwtArray = new com.sphereon.cbor.CborArray(kotlin.collections.KtMutableList.fromJsArray(cwtArrayElements));
627
+ const cwtEncoded = com.sphereon.cbor.Cbor.encode(cwtArray);
622
628
  const cwtBuffer = Buffer.from(cwtEncoded);
623
629
  return {
624
630
  statusListCredential: import_base64url2.default.encode(cwtBuffer),
@@ -629,35 +635,35 @@ function buildClaimsMap(id, issuerString, statusListMap, expiresAt) {
629
635
  const ttl = 65535;
630
636
  const claimsEntries = [
631
637
  [
632
- new CborUInt(mdoc.com.sphereon.kmp.LongKMP.fromNumber(CWT_CLAIMS.SUBJECT)),
633
- new mdoc.com.sphereon.cbor.CborString(id)
638
+ new CborUInt(com.sphereon.kmp.LongKMP.fromNumber(CWT_CLAIMS.SUBJECT)),
639
+ new com.sphereon.cbor.CborString(id)
634
640
  ],
635
641
  [
636
- new CborUInt(mdoc.com.sphereon.kmp.LongKMP.fromNumber(CWT_CLAIMS.ISSUER)),
637
- new mdoc.com.sphereon.cbor.CborString(issuerString)
642
+ new CborUInt(com.sphereon.kmp.LongKMP.fromNumber(CWT_CLAIMS.ISSUER)),
643
+ new com.sphereon.cbor.CborString(issuerString)
638
644
  ],
639
645
  [
640
- new CborUInt(mdoc.com.sphereon.kmp.LongKMP.fromNumber(CWT_CLAIMS.ISSUED_AT)),
641
- new CborUInt(mdoc.com.sphereon.kmp.LongKMP.fromNumber(Math.floor(Date.now() / 1e3)))
646
+ new CborUInt(com.sphereon.kmp.LongKMP.fromNumber(CWT_CLAIMS.ISSUED_AT)),
647
+ new CborUInt(com.sphereon.kmp.LongKMP.fromNumber(Math.floor(Date.now() / 1e3)))
642
648
  ]
643
649
  ];
644
650
  if (expiresAt) {
645
651
  claimsEntries.push([
646
- new mdoc.com.sphereon.cbor.CborUInt(mdoc.com.sphereon.kmp.LongKMP.fromNumber(CWT_CLAIMS.EXPIRATION)),
647
- new mdoc.com.sphereon.cbor.CborUInt(mdoc.com.sphereon.kmp.LongKMP.fromNumber(Math.floor(expiresAt.getTime() / 1e3)))
652
+ new com.sphereon.cbor.CborUInt(com.sphereon.kmp.LongKMP.fromNumber(CWT_CLAIMS.EXPIRATION)),
653
+ new com.sphereon.cbor.CborUInt(com.sphereon.kmp.LongKMP.fromNumber(Math.floor(expiresAt.getTime() / 1e3)))
648
654
  ]);
649
655
  }
650
656
  if (ttl) {
651
657
  claimsEntries.push([
652
- new mdoc.com.sphereon.cbor.CborUInt(mdoc.com.sphereon.kmp.LongKMP.fromNumber(CWT_CLAIMS.TIME_TO_LIVE)),
653
- new mdoc.com.sphereon.cbor.CborUInt(mdoc.com.sphereon.kmp.LongKMP.fromNumber(ttl))
658
+ new com.sphereon.cbor.CborUInt(com.sphereon.kmp.LongKMP.fromNumber(CWT_CLAIMS.TIME_TO_LIVE)),
659
+ new com.sphereon.cbor.CborUInt(com.sphereon.kmp.LongKMP.fromNumber(ttl))
654
660
  ]);
655
661
  }
656
662
  claimsEntries.push([
657
- new mdoc.com.sphereon.cbor.CborUInt(mdoc.com.sphereon.kmp.LongKMP.fromNumber(CWT_CLAIMS.STATUS_LIST)),
663
+ new com.sphereon.cbor.CborUInt(com.sphereon.kmp.LongKMP.fromNumber(CWT_CLAIMS.STATUS_LIST)),
658
664
  statusListMap
659
665
  ]);
660
- const claimsMap = new mdoc.com.sphereon.cbor.CborMap(mdoc.kotlin.collections.KtMutableMap.fromJsMap(new Map(claimsEntries)));
666
+ const claimsMap = new com.sphereon.cbor.CborMap(kotlin.collections.KtMutableMap.fromJsMap(new Map(claimsEntries)));
661
667
  return claimsMap;
662
668
  }
663
669
  __name(buildClaimsMap, "buildClaimsMap");
@@ -669,7 +675,7 @@ var getCborValueFromMap = /* @__PURE__ */ __name((map, key) => {
669
675
  return value;
670
676
  }, "getCborValueFromMap");
671
677
  var getCborOptionalValueFromMap = /* @__PURE__ */ __name((map, key) => {
672
- const value = map.get(new CborUInt(mdoc.com.sphereon.kmp.LongKMP.fromNumber(key)));
678
+ const value = map.get(new CborUInt(com.sphereon.kmp.LongKMP.fromNumber(key)));
673
679
  if (!value) {
674
680
  return void 0;
675
681
  }
@@ -678,20 +684,20 @@ var getCborOptionalValueFromMap = /* @__PURE__ */ __name((map, key) => {
678
684
  var decodeStatusListCWT = /* @__PURE__ */ __name((cwt) => {
679
685
  const encodedCbor = import_base64url2.default.toBuffer(cwt);
680
686
  const encodedCborArray = new Int8Array(encodedCbor);
681
- const decodedCbor = mdoc.com.sphereon.cbor.Cbor.decode(encodedCborArray);
682
- if (!(decodedCbor instanceof mdoc.com.sphereon.cbor.CborArray)) {
687
+ const decodedCbor = com.sphereon.cbor.Cbor.decode(encodedCborArray);
688
+ if (!(decodedCbor instanceof com.sphereon.cbor.CborArray)) {
683
689
  throw new Error("Invalid CWT format: Expected a CBOR array");
684
690
  }
685
691
  const [, payload] = decodedCbor.value.asJsArrayView();
686
- if (!(payload instanceof mdoc.com.sphereon.cbor.CborByteString)) {
692
+ if (!(payload instanceof com.sphereon.cbor.CborByteString)) {
687
693
  throw new Error("Invalid payload format: Expected a CBOR ByteString");
688
694
  }
689
- const claims = mdoc.com.sphereon.cbor.Cbor.decode(payload.value);
690
- if (!(claims instanceof mdoc.com.sphereon.cbor.CborMap)) {
695
+ const claims = com.sphereon.cbor.Cbor.decode(payload.value);
696
+ if (!(claims instanceof com.sphereon.cbor.CborMap)) {
691
697
  throw new Error("Invalid claims format: Expected a CBOR map");
692
698
  }
693
699
  const claimsMap = claims.value.asJsMapView();
694
- const statusListMap = claimsMap.get(new CborUInt(mdoc.com.sphereon.kmp.LongKMP.fromNumber(65533))).value.asJsMapView();
700
+ const statusListMap = claimsMap.get(new CborUInt(com.sphereon.kmp.LongKMP.fromNumber(65533))).value.asJsMapView();
695
701
  const bits = Number(statusListMap.get(new CborString("bits")).value);
696
702
  const decoded = new Uint8Array(statusListMap.get(new CborString("lst")).value);
697
703
  const uint8Array = (0, import_pako.inflate)(decoded);