@sphereon/ssi-sdk.vc-status-list 0.34.1-feature.SSISDK.26.54 → 0.34.1-feature.SSISDK.26.RP.55

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
@@ -514,12 +514,11 @@ var getSigningAlgo = /* @__PURE__ */ __name((type) => {
514
514
  // src/impl/encoding/cbor.ts
515
515
  import { StatusList as StatusList3 } from "@sd-jwt/jwt-status-list";
516
516
  import { deflate, inflate } from "pako";
517
- import pkg from "@sphereon/kmp-mdoc-core";
517
+ import * as mdoc from "@sphereon/kmp-mdoc-core";
518
518
  import base64url2 from "base64url";
519
- var { com, kotlin } = pkg;
520
- var CborByteString = com.sphereon.cbor.CborByteString;
521
- var CborUInt = com.sphereon.cbor.CborUInt;
522
- var CborString = com.sphereon.cbor.CborString;
519
+ var CborByteString = mdoc.com.sphereon.cbor.CborByteString;
520
+ var CborUInt = mdoc.com.sphereon.cbor.CborUInt;
521
+ var CborString = mdoc.com.sphereon.cbor.CborString;
523
522
  var decompressRawStatusList = StatusList3.decodeStatusList.bind(StatusList3);
524
523
  var CWT_CLAIMS = {
525
524
  SUBJECT: 2,
@@ -536,25 +535,25 @@ var createSignedCbor = /* @__PURE__ */ __name(async (context, statusList, issuer
536
535
  level: 9
537
536
  });
538
537
  const compressedBytes = new Int8Array(compressedList);
539
- const statusListMap = new com.sphereon.cbor.CborMap(kotlin.collections.KtMutableMap.fromJsMap(/* @__PURE__ */ new Map([
538
+ const statusListMap = new mdoc.com.sphereon.cbor.CborMap(mdoc.kotlin.collections.KtMutableMap.fromJsMap(/* @__PURE__ */ new Map([
540
539
  [
541
- new com.sphereon.cbor.CborString("bits"),
542
- new com.sphereon.cbor.CborUInt(com.sphereon.kmp.LongKMP.fromNumber(statusList.getBitsPerStatus()))
540
+ new mdoc.com.sphereon.cbor.CborString("bits"),
541
+ new mdoc.com.sphereon.cbor.CborUInt(mdoc.com.sphereon.kmp.LongKMP.fromNumber(statusList.getBitsPerStatus()))
543
542
  ],
544
543
  [
545
- new com.sphereon.cbor.CborString("lst"),
546
- new com.sphereon.cbor.CborByteString(compressedBytes)
544
+ new mdoc.com.sphereon.cbor.CborString("lst"),
545
+ new mdoc.com.sphereon.cbor.CborByteString(compressedBytes)
547
546
  ]
548
547
  ])));
549
- const protectedHeader = new com.sphereon.cbor.CborMap(kotlin.collections.KtMutableMap.fromJsMap(/* @__PURE__ */ new Map([
548
+ const protectedHeader = new mdoc.com.sphereon.cbor.CborMap(mdoc.kotlin.collections.KtMutableMap.fromJsMap(/* @__PURE__ */ new Map([
550
549
  [
551
- new com.sphereon.cbor.CborUInt(com.sphereon.kmp.LongKMP.fromNumber(16)),
552
- new com.sphereon.cbor.CborString("statuslist+cwt")
550
+ new mdoc.com.sphereon.cbor.CborUInt(mdoc.com.sphereon.kmp.LongKMP.fromNumber(16)),
551
+ new mdoc.com.sphereon.cbor.CborString("statuslist+cwt")
553
552
  ]
554
553
  ])));
555
- const protectedHeaderEncoded = com.sphereon.cbor.Cbor.encode(protectedHeader);
554
+ const protectedHeaderEncoded = mdoc.com.sphereon.cbor.Cbor.encode(protectedHeader);
556
555
  const claimsMap = buildClaimsMap(id, issuerString, statusListMap, expiresAt);
557
- const claimsEncoded = com.sphereon.cbor.Cbor.encode(claimsMap);
556
+ const claimsEncoded = mdoc.com.sphereon.cbor.Cbor.encode(claimsMap);
558
557
  const signedCWT = await context.agent.keyManagerSign({
559
558
  keyRef: identifier.kmsKeyRef,
560
559
  data: base64url2.encode(Buffer.from(claimsEncoded)),
@@ -569,8 +568,8 @@ var createSignedCbor = /* @__PURE__ */ __name(async (context, statusList, issuer
569
568
  new CborByteString(claimsEncodedInt8),
570
569
  new CborByteString(signatureInt8)
571
570
  ];
572
- const cwtArray = new com.sphereon.cbor.CborArray(kotlin.collections.KtMutableList.fromJsArray(cwtArrayElements));
573
- const cwtEncoded = com.sphereon.cbor.Cbor.encode(cwtArray);
571
+ const cwtArray = new mdoc.com.sphereon.cbor.CborArray(mdoc.kotlin.collections.KtMutableList.fromJsArray(cwtArrayElements));
572
+ const cwtEncoded = mdoc.com.sphereon.cbor.Cbor.encode(cwtArray);
574
573
  const cwtBuffer = Buffer.from(cwtEncoded);
575
574
  return {
576
575
  statusListCredential: base64url2.encode(cwtBuffer),
@@ -581,35 +580,35 @@ function buildClaimsMap(id, issuerString, statusListMap, expiresAt) {
581
580
  const ttl = 65535;
582
581
  const claimsEntries = [
583
582
  [
584
- new CborUInt(com.sphereon.kmp.LongKMP.fromNumber(CWT_CLAIMS.SUBJECT)),
585
- new com.sphereon.cbor.CborString(id)
583
+ new CborUInt(mdoc.com.sphereon.kmp.LongKMP.fromNumber(CWT_CLAIMS.SUBJECT)),
584
+ new mdoc.com.sphereon.cbor.CborString(id)
586
585
  ],
587
586
  [
588
- new CborUInt(com.sphereon.kmp.LongKMP.fromNumber(CWT_CLAIMS.ISSUER)),
589
- new com.sphereon.cbor.CborString(issuerString)
587
+ new CborUInt(mdoc.com.sphereon.kmp.LongKMP.fromNumber(CWT_CLAIMS.ISSUER)),
588
+ new mdoc.com.sphereon.cbor.CborString(issuerString)
590
589
  ],
591
590
  [
592
- new CborUInt(com.sphereon.kmp.LongKMP.fromNumber(CWT_CLAIMS.ISSUED_AT)),
593
- new CborUInt(com.sphereon.kmp.LongKMP.fromNumber(Math.floor(Date.now() / 1e3)))
591
+ new CborUInt(mdoc.com.sphereon.kmp.LongKMP.fromNumber(CWT_CLAIMS.ISSUED_AT)),
592
+ new CborUInt(mdoc.com.sphereon.kmp.LongKMP.fromNumber(Math.floor(Date.now() / 1e3)))
594
593
  ]
595
594
  ];
596
595
  if (expiresAt) {
597
596
  claimsEntries.push([
598
- new com.sphereon.cbor.CborUInt(com.sphereon.kmp.LongKMP.fromNumber(CWT_CLAIMS.EXPIRATION)),
599
- new com.sphereon.cbor.CborUInt(com.sphereon.kmp.LongKMP.fromNumber(Math.floor(expiresAt.getTime() / 1e3)))
597
+ new mdoc.com.sphereon.cbor.CborUInt(mdoc.com.sphereon.kmp.LongKMP.fromNumber(CWT_CLAIMS.EXPIRATION)),
598
+ new mdoc.com.sphereon.cbor.CborUInt(mdoc.com.sphereon.kmp.LongKMP.fromNumber(Math.floor(expiresAt.getTime() / 1e3)))
600
599
  ]);
601
600
  }
602
601
  if (ttl) {
603
602
  claimsEntries.push([
604
- new com.sphereon.cbor.CborUInt(com.sphereon.kmp.LongKMP.fromNumber(CWT_CLAIMS.TIME_TO_LIVE)),
605
- new com.sphereon.cbor.CborUInt(com.sphereon.kmp.LongKMP.fromNumber(ttl))
603
+ new mdoc.com.sphereon.cbor.CborUInt(mdoc.com.sphereon.kmp.LongKMP.fromNumber(CWT_CLAIMS.TIME_TO_LIVE)),
604
+ new mdoc.com.sphereon.cbor.CborUInt(mdoc.com.sphereon.kmp.LongKMP.fromNumber(ttl))
606
605
  ]);
607
606
  }
608
607
  claimsEntries.push([
609
- new com.sphereon.cbor.CborUInt(com.sphereon.kmp.LongKMP.fromNumber(CWT_CLAIMS.STATUS_LIST)),
608
+ new mdoc.com.sphereon.cbor.CborUInt(mdoc.com.sphereon.kmp.LongKMP.fromNumber(CWT_CLAIMS.STATUS_LIST)),
610
609
  statusListMap
611
610
  ]);
612
- const claimsMap = new com.sphereon.cbor.CborMap(kotlin.collections.KtMutableMap.fromJsMap(new Map(claimsEntries)));
611
+ const claimsMap = new mdoc.com.sphereon.cbor.CborMap(mdoc.kotlin.collections.KtMutableMap.fromJsMap(new Map(claimsEntries)));
613
612
  return claimsMap;
614
613
  }
615
614
  __name(buildClaimsMap, "buildClaimsMap");
@@ -621,7 +620,7 @@ var getCborValueFromMap = /* @__PURE__ */ __name((map, key) => {
621
620
  return value;
622
621
  }, "getCborValueFromMap");
623
622
  var getCborOptionalValueFromMap = /* @__PURE__ */ __name((map, key) => {
624
- const value = map.get(new CborUInt(com.sphereon.kmp.LongKMP.fromNumber(key)));
623
+ const value = map.get(new CborUInt(mdoc.com.sphereon.kmp.LongKMP.fromNumber(key)));
625
624
  if (!value) {
626
625
  return void 0;
627
626
  }
@@ -630,20 +629,20 @@ var getCborOptionalValueFromMap = /* @__PURE__ */ __name((map, key) => {
630
629
  var decodeStatusListCWT = /* @__PURE__ */ __name((cwt) => {
631
630
  const encodedCbor = base64url2.toBuffer(cwt);
632
631
  const encodedCborArray = new Int8Array(encodedCbor);
633
- const decodedCbor = com.sphereon.cbor.Cbor.decode(encodedCborArray);
634
- if (!(decodedCbor instanceof com.sphereon.cbor.CborArray)) {
632
+ const decodedCbor = mdoc.com.sphereon.cbor.Cbor.decode(encodedCborArray);
633
+ if (!(decodedCbor instanceof mdoc.com.sphereon.cbor.CborArray)) {
635
634
  throw new Error("Invalid CWT format: Expected a CBOR array");
636
635
  }
637
636
  const [, payload] = decodedCbor.value.asJsArrayView();
638
- if (!(payload instanceof com.sphereon.cbor.CborByteString)) {
637
+ if (!(payload instanceof mdoc.com.sphereon.cbor.CborByteString)) {
639
638
  throw new Error("Invalid payload format: Expected a CBOR ByteString");
640
639
  }
641
- const claims = com.sphereon.cbor.Cbor.decode(payload.value);
642
- if (!(claims instanceof com.sphereon.cbor.CborMap)) {
640
+ const claims = mdoc.com.sphereon.cbor.Cbor.decode(payload.value);
641
+ if (!(claims instanceof mdoc.com.sphereon.cbor.CborMap)) {
643
642
  throw new Error("Invalid claims format: Expected a CBOR map");
644
643
  }
645
644
  const claimsMap = claims.value.asJsMapView();
646
- const statusListMap = claimsMap.get(new CborUInt(com.sphereon.kmp.LongKMP.fromNumber(65533))).value.asJsMapView();
645
+ const statusListMap = claimsMap.get(new CborUInt(mdoc.com.sphereon.kmp.LongKMP.fromNumber(65533))).value.asJsMapView();
647
646
  const bits = Number(statusListMap.get(new CborString("bits")).value);
648
647
  const decoded = new Uint8Array(statusListMap.get(new CborString("lst")).value);
649
648
  const uint8Array = inflate(decoded);