@bcts/xid 1.0.0-alpha.12 → 1.0.0-alpha.13

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,6 +1,6 @@
1
+ let _bcts_components = require("@bcts/components");
1
2
  let _bcts_known_values = require("@bcts/known-values");
2
3
  let _bcts_envelope = require("@bcts/envelope");
3
- let _bcts_components = require("@bcts/components");
4
4
  let _bcts_provenance_mark = require("@bcts/provenance-mark");
5
5
  let _bcts_dcbor = require("@bcts/dcbor");
6
6
 
@@ -577,14 +577,14 @@ let XIDPrivateKeyOptions = /* @__PURE__ */ function(XIDPrivateKeyOptions$1) {
577
577
  * Represents a key in an XID document.
578
578
  */
579
579
  var Key = class Key {
580
- _publicKeyBase;
581
- _privateKeys;
580
+ _publicKeys;
581
+ _privateKeyData;
582
582
  _nickname;
583
583
  _endpoints;
584
584
  _permissions;
585
- constructor(publicKeyBase, privateKeys, nickname = "", endpoints = /* @__PURE__ */ new Set(), permissions = Permissions.new()) {
586
- this._publicKeyBase = publicKeyBase;
587
- this._privateKeys = privateKeys;
585
+ constructor(publicKeys, privateKeyData, nickname = "", endpoints = /* @__PURE__ */ new Set(), permissions = Permissions.new()) {
586
+ this._publicKeys = publicKeys;
587
+ this._privateKeyData = privateKeyData;
588
588
  this._nickname = nickname;
589
589
  this._endpoints = endpoints;
590
590
  this._permissions = permissions;
@@ -592,64 +592,78 @@ var Key = class Key {
592
592
  /**
593
593
  * Create a new Key with only public keys.
594
594
  */
595
- static new(publicKeyBase) {
596
- return new Key(publicKeyBase);
595
+ static new(publicKeys) {
596
+ return new Key(publicKeys);
597
597
  }
598
598
  /**
599
599
  * Create a new Key with public keys and allow-all permissions.
600
600
  */
601
- static newAllowAll(publicKeyBase) {
602
- return new Key(publicKeyBase, void 0, "", /* @__PURE__ */ new Set(), Permissions.newAllowAll());
601
+ static newAllowAll(publicKeys) {
602
+ return new Key(publicKeys, void 0, "", /* @__PURE__ */ new Set(), Permissions.newAllowAll());
603
603
  }
604
604
  /**
605
- * Create a new Key with private key base.
605
+ * Create a new Key with private keys.
606
606
  */
607
- static newWithPrivateKeyBase(privateKeyBase) {
607
+ static newWithPrivateKeys(privateKeys, publicKeys) {
608
608
  const salt = _bcts_components.Salt.random(32);
609
- return new Key(privateKeyBase.publicKeys(), {
609
+ return new Key(publicKeys, {
610
610
  data: {
611
611
  type: "decrypted",
612
- privateKeyBase
612
+ privateKeys
613
613
  },
614
614
  salt
615
615
  }, "", /* @__PURE__ */ new Set(), Permissions.newAllowAll());
616
616
  }
617
617
  /**
618
- * Get the public key base.
618
+ * Create a new Key with private key base (derives keys from it).
619
+ */
620
+ static newWithPrivateKeyBase(privateKeyBase) {
621
+ const privateKeys = privateKeyBase.ed25519PrivateKeys();
622
+ const publicKeys = privateKeyBase.ed25519PublicKeys();
623
+ return Key.newWithPrivateKeys(privateKeys, publicKeys);
624
+ }
625
+ /**
626
+ * Get the public keys.
619
627
  */
620
- publicKeyBase() {
621
- return this._publicKeyBase;
628
+ publicKeys() {
629
+ return this._publicKeys;
622
630
  }
623
631
  /**
624
- * Get the private key base, if available and decrypted.
632
+ * Get the private keys, if available and decrypted.
625
633
  */
626
- privateKeyBase() {
627
- if (this._privateKeys === void 0) return void 0;
628
- if (this._privateKeys.data.type === "decrypted") return this._privateKeys.data.privateKeyBase;
634
+ privateKeys() {
635
+ if (this._privateKeyData === void 0) return void 0;
636
+ if (this._privateKeyData.data.type === "decrypted") return this._privateKeyData.data.privateKeys;
629
637
  }
630
638
  /**
631
639
  * Check if this key has decrypted private keys.
632
640
  */
633
641
  hasPrivateKeys() {
634
- return this._privateKeys?.data.type === "decrypted";
642
+ return this._privateKeyData?.data.type === "decrypted";
635
643
  }
636
644
  /**
637
645
  * Check if this key has encrypted private keys.
638
646
  */
639
647
  hasEncryptedPrivateKeys() {
640
- return this._privateKeys?.data.type === "encrypted";
648
+ return this._privateKeyData?.data.type === "encrypted";
641
649
  }
642
650
  /**
643
651
  * Get the salt used for private key decorrelation.
644
652
  */
645
653
  privateKeySalt() {
646
- return this._privateKeys?.salt;
654
+ return this._privateKeyData?.salt;
647
655
  }
648
656
  /**
649
- * Get the reference for this key (based on public key).
657
+ * Get the reference for this key (based on public keys tagged CBOR).
650
658
  */
651
659
  reference() {
652
- return _bcts_components.Reference.hash(this._publicKeyBase.data());
660
+ return this._publicKeys.reference();
661
+ }
662
+ /**
663
+ * Verify a signature against a message.
664
+ */
665
+ verify(signature, message) {
666
+ return this._publicKeys.verify(signature, message);
653
667
  }
654
668
  /**
655
669
  * Get the endpoints set.
@@ -691,26 +705,26 @@ var Key = class Key {
691
705
  * Convert to envelope with specified options.
692
706
  */
693
707
  intoEnvelopeOpt(privateKeyOptions = XIDPrivateKeyOptions.Omit) {
694
- let envelope = _bcts_envelope.Envelope.new(this._publicKeyBase.data());
695
- if (this._privateKeys !== void 0) {
696
- const { data, salt } = this._privateKeys;
708
+ let envelope = _bcts_envelope.Envelope.new(this._publicKeys.taggedCborData());
709
+ if (this._privateKeyData !== void 0) {
710
+ const { data, salt } = this._privateKeyData;
697
711
  if (data.type === "encrypted") {
698
712
  envelope = envelope.addAssertion(kv$3(_bcts_known_values.PRIVATE_KEY), data.envelope);
699
713
  envelope = envelope.addAssertion(kv$3(_bcts_known_values.SALT), salt.toData());
700
714
  } else if (data.type === "decrypted") switch (typeof privateKeyOptions === "object" ? privateKeyOptions.type : privateKeyOptions) {
701
715
  case XIDPrivateKeyOptions.Include:
702
- envelope = envelope.addAssertion(kv$3(_bcts_known_values.PRIVATE_KEY), data.privateKeyBase.data());
716
+ envelope = envelope.addAssertion(kv$3(_bcts_known_values.PRIVATE_KEY), data.privateKeys.taggedCborData());
703
717
  envelope = envelope.addAssertion(kv$3(_bcts_known_values.SALT), salt.toData());
704
718
  break;
705
719
  case XIDPrivateKeyOptions.Elide: {
706
- const elidedAssertion = _bcts_envelope.Envelope.newAssertion(kv$3(_bcts_known_values.PRIVATE_KEY), data.privateKeyBase.data()).elide();
720
+ const elidedAssertion = _bcts_envelope.Envelope.newAssertion(kv$3(_bcts_known_values.PRIVATE_KEY), data.privateKeys.taggedCborData()).elide();
707
721
  envelope = envelope.addAssertionEnvelope(elidedAssertion);
708
722
  envelope = envelope.addAssertion(kv$3(_bcts_known_values.SALT), salt.toData());
709
723
  break;
710
724
  }
711
725
  case XIDPrivateKeyOptions.Encrypt:
712
726
  if (typeof privateKeyOptions === "object") {
713
- const encrypted = _bcts_envelope.Envelope.new(data.privateKeyBase.data()).encryptSubject(privateKeyOptions.password);
727
+ const encrypted = _bcts_envelope.Envelope.new(data.privateKeys.taggedCborData()).encryptSubject(privateKeyOptions.password);
714
728
  envelope = envelope.addAssertion(kv$3(_bcts_known_values.PRIVATE_KEY), encrypted);
715
729
  envelope = envelope.addAssertion(kv$3(_bcts_known_values.SALT), salt.toData());
716
730
  }
@@ -732,10 +746,10 @@ var Key = class Key {
732
746
  */
733
747
  static tryFromEnvelope(envelope, password) {
734
748
  const env = envelope;
735
- const publicKeyData = (env.case().type === "node" ? env.subject() : env).asByteString();
736
- if (publicKeyData === void 0) throw XIDError.component(/* @__PURE__ */ new Error("Could not extract public key from envelope"));
737
- const publicKeyBase = new _bcts_envelope.PublicKeyBase(publicKeyData);
738
- let privateKeys;
749
+ const publicKeysData = (env.case().type === "node" ? env.subject() : env).asByteString();
750
+ if (publicKeysData === void 0) throw XIDError.component(/* @__PURE__ */ new Error("Could not extract public keys from envelope"));
751
+ const publicKeys = _bcts_components.PublicKeys.fromTaggedCborData(publicKeysData);
752
+ let privateKeyData;
739
753
  let salt = _bcts_components.Salt.random(32);
740
754
  const saltAssertions = env.assertionsWithPredicate(_bcts_known_values.SALT);
741
755
  if (saltAssertions.length > 0) {
@@ -752,15 +766,15 @@ var Key = class Key {
752
766
  const privateKeyObject = assertionCase.assertion.object();
753
767
  if (privateKeyObject.case().type === "encrypted") if (password !== void 0) try {
754
768
  const decryptedData = privateKeyObject.decryptSubject(password).asByteString();
755
- if (decryptedData !== void 0) privateKeys = {
769
+ if (decryptedData !== void 0) privateKeyData = {
756
770
  data: {
757
771
  type: "decrypted",
758
- privateKeyBase: _bcts_envelope.PrivateKeyBase.fromBytes(decryptedData, publicKeyData)
772
+ privateKeys: _bcts_components.PrivateKeys.fromTaggedCborData(decryptedData)
759
773
  },
760
774
  salt
761
775
  };
762
776
  } catch {
763
- privateKeys = {
777
+ privateKeyData = {
764
778
  data: {
765
779
  type: "encrypted",
766
780
  envelope: privateKeyObject
@@ -768,7 +782,7 @@ var Key = class Key {
768
782
  salt
769
783
  };
770
784
  }
771
- else privateKeys = {
785
+ else privateKeyData = {
772
786
  data: {
773
787
  type: "encrypted",
774
788
  envelope: privateKeyObject
@@ -776,11 +790,11 @@ var Key = class Key {
776
790
  salt
777
791
  };
778
792
  else {
779
- const privateKeyData = privateKeyObject.asByteString();
780
- if (privateKeyData !== void 0) privateKeys = {
793
+ const privateKeysBytes = privateKeyObject.asByteString();
794
+ if (privateKeysBytes !== void 0) privateKeyData = {
781
795
  data: {
782
796
  type: "decrypted",
783
- privateKeyBase: _bcts_envelope.PrivateKeyBase.fromBytes(privateKeyData, publicKeyData)
797
+ privateKeys: _bcts_components.PrivateKeys.fromTaggedCborData(privateKeysBytes)
784
798
  },
785
799
  salt
786
800
  };
@@ -799,27 +813,27 @@ var Key = class Key {
799
813
  if (text !== void 0) endpoints.add(text);
800
814
  }
801
815
  const permissions = Permissions.tryFromEnvelope(envelope);
802
- return new Key(publicKeyBase, privateKeys, nickname, endpoints, permissions);
816
+ return new Key(publicKeys, privateKeyData, nickname, endpoints, permissions);
803
817
  }
804
818
  /**
805
819
  * Check equality with another Key.
806
820
  */
807
821
  equals(other) {
808
- return this._publicKeyBase.hex() === other._publicKeyBase.hex();
822
+ return this._publicKeys.equals(other._publicKeys);
809
823
  }
810
824
  /**
811
825
  * Get a hash key for use in Sets/Maps.
812
826
  */
813
827
  hashKey() {
814
- return this._publicKeyBase.hex();
828
+ return this._publicKeys.reference().toHex();
815
829
  }
816
830
  /**
817
831
  * Clone this Key.
818
832
  */
819
833
  clone() {
820
- return new Key(this._publicKeyBase, this._privateKeys !== void 0 ? {
821
- data: this._privateKeys.data,
822
- salt: this._privateKeys.salt
834
+ return new Key(this._publicKeys, this._privateKeyData !== void 0 ? {
835
+ data: this._privateKeyData.data,
836
+ salt: this._privateKeyData.salt
823
837
  } : void 0, this._nickname, new Set(this._endpoints), this._permissions.clone());
824
838
  }
825
839
  };
@@ -966,11 +980,11 @@ var Service = class Service {
966
980
  intoEnvelope() {
967
981
  let envelope = _bcts_envelope.Envelope.new(this._uri);
968
982
  for (const keyRef of this._keyReferences) {
969
- const refBytes = hexToBytes$1(keyRef);
983
+ const refBytes = hexToBytes(keyRef);
970
984
  envelope = envelope.addAssertion(kv$2(_bcts_known_values.KEY), refBytes);
971
985
  }
972
986
  for (const delegateRef of this._delegateReferences) {
973
- const refBytes = hexToBytes$1(delegateRef);
987
+ const refBytes = hexToBytes(delegateRef);
974
988
  envelope = envelope.addAssertion(kv$2(_bcts_known_values.DELEGATE), refBytes);
975
989
  }
976
990
  if (this._capability !== "") envelope = envelope.addAssertion(kv$2(_bcts_known_values.CAPABILITY), this._capability);
@@ -1051,7 +1065,7 @@ var Service = class Service {
1051
1065
  return clone;
1052
1066
  }
1053
1067
  };
1054
- function hexToBytes$1(hex) {
1068
+ function hexToBytes(hex) {
1055
1069
  const bytes = new Uint8Array(hex.length / 2);
1056
1070
  for (let i = 0; i < hex.length; i += 2) bytes[i / 2] = parseInt(hex.substring(i, i + 2), 16);
1057
1071
  return bytes;
@@ -1462,18 +1476,19 @@ var XIDDocument = class XIDDocument {
1462
1476
  static new(keyOptions = { type: "default" }, markOptions = { type: "none" }) {
1463
1477
  const inceptionKey = XIDDocument.inceptionKeyForOptions(keyOptions);
1464
1478
  const provenance = XIDDocument.genesisMarkWithOptions(markOptions);
1465
- const doc = new XIDDocument(_bcts_components.XID.from(hashPublicKey(inceptionKey.publicKeyBase())), /* @__PURE__ */ new Set(), /* @__PURE__ */ new Map(), /* @__PURE__ */ new Map(), /* @__PURE__ */ new Map(), provenance);
1479
+ const doc = new XIDDocument(_bcts_components.XID.from(inceptionKey.publicKeys().reference().getDigest().toData()), /* @__PURE__ */ new Set(), /* @__PURE__ */ new Map(), /* @__PURE__ */ new Map(), /* @__PURE__ */ new Map(), provenance);
1466
1480
  doc.addKey(inceptionKey);
1467
1481
  return doc;
1468
1482
  }
1469
1483
  static inceptionKeyForOptions(options) {
1470
1484
  switch (options.type) {
1471
1485
  case "default": {
1472
- const privateKeyBase = _bcts_envelope.PrivateKeyBase.generate();
1486
+ const privateKeyBase = _bcts_components.PrivateKeyBase.new();
1473
1487
  return Key.newWithPrivateKeyBase(privateKeyBase);
1474
1488
  }
1475
- case "publicKeyBase": return Key.newAllowAll(options.publicKeyBase);
1489
+ case "publicKeys": return Key.newAllowAll(options.publicKeys);
1476
1490
  case "privateKeyBase": return Key.newWithPrivateKeyBase(options.privateKeyBase);
1491
+ case "privateKeys": return Key.newWithPrivateKeys(options.privateKeys, options.publicKeys);
1477
1492
  }
1478
1493
  }
1479
1494
  static genesisMarkWithOptions(options) {
@@ -1540,10 +1555,10 @@ var XIDDocument = class XIDDocument {
1540
1555
  this._keys.set(hashKey, key);
1541
1556
  }
1542
1557
  /**
1543
- * Find a key by its public key base.
1558
+ * Find a key by its public keys.
1544
1559
  */
1545
- findKeyByPublicKeyBase(publicKeyBase) {
1546
- const hashKey = publicKeyBase.hex();
1560
+ findKeyByPublicKeys(publicKeys) {
1561
+ const hashKey = publicKeys.reference().toHex();
1547
1562
  return this._keys.get(hashKey);
1548
1563
  }
1549
1564
  /**
@@ -1555,8 +1570,8 @@ var XIDDocument = class XIDDocument {
1555
1570
  /**
1556
1571
  * Take and remove a key.
1557
1572
  */
1558
- takeKey(publicKeyBase) {
1559
- const hashKey = publicKeyBase.hex();
1573
+ takeKey(publicKeys) {
1574
+ const hashKey = publicKeys.reference().toHex();
1560
1575
  const key = this._keys.get(hashKey);
1561
1576
  if (key !== void 0) this._keys.delete(hashKey);
1562
1577
  return key;
@@ -1564,28 +1579,28 @@ var XIDDocument = class XIDDocument {
1564
1579
  /**
1565
1580
  * Remove a key.
1566
1581
  */
1567
- removeKey(publicKeyBase) {
1568
- if (this.servicesReferenceKey(publicKeyBase)) throw XIDError.stillReferenced("key");
1569
- const hashKey = publicKeyBase.hex();
1582
+ removeKey(publicKeys) {
1583
+ if (this.servicesReferenceKey(publicKeys)) throw XIDError.stillReferenced("key");
1584
+ const hashKey = publicKeys.reference().toHex();
1570
1585
  if (!this._keys.delete(hashKey)) throw XIDError.notFound("key");
1571
1586
  }
1572
1587
  /**
1573
- * Check if the given public key is the inception signing key.
1588
+ * Check if the given public keys is the inception signing key.
1574
1589
  */
1575
- isInceptionKey(publicKeyBase) {
1576
- return bytesEqual(hashPublicKey(publicKeyBase), this._xid.toData());
1590
+ isInceptionKey(publicKeys) {
1591
+ return bytesEqual(publicKeys.reference().getDigest().toData(), this._xid.toData());
1577
1592
  }
1578
1593
  /**
1579
1594
  * Get the inception key, if it exists in the document.
1580
1595
  */
1581
1596
  inceptionKey() {
1582
- for (const key of this._keys.values()) if (this.isInceptionKey(key.publicKeyBase())) return key;
1597
+ for (const key of this._keys.values()) if (this.isInceptionKey(key.publicKeys())) return key;
1583
1598
  }
1584
1599
  /**
1585
- * Get the inception private key base, if available.
1600
+ * Get the inception private keys, if available.
1586
1601
  */
1587
- inceptionPrivateKeyBase() {
1588
- return this.inceptionKey()?.privateKeyBase();
1602
+ inceptionPrivateKeys() {
1603
+ return this.inceptionKey()?.privateKeys();
1589
1604
  }
1590
1605
  /**
1591
1606
  * Remove the inception key from the document.
@@ -1690,13 +1705,11 @@ var XIDDocument = class XIDDocument {
1690
1705
  checkServiceConsistency(service) {
1691
1706
  if (service.keyReferences().size === 0 && service.delegateReferences().size === 0) throw XIDError.noReferences(service.uri());
1692
1707
  for (const keyRef of service.keyReferences()) {
1693
- const refBytes = hexToBytes(keyRef);
1694
- const ref = _bcts_components.Reference.hash(refBytes);
1708
+ const ref = _bcts_components.Reference.fromHex(keyRef);
1695
1709
  if (this.findKeyByReference(ref) === void 0) throw XIDError.unknownKeyReference(keyRef, service.uri());
1696
1710
  }
1697
1711
  for (const delegateRef of service.delegateReferences()) {
1698
- const refBytes = hexToBytes(delegateRef);
1699
- const ref = _bcts_components.Reference.hash(refBytes);
1712
+ const ref = _bcts_components.Reference.fromHex(delegateRef);
1700
1713
  if (this.findDelegateByReference(ref) === void 0) throw XIDError.unknownDelegateReference(delegateRef, service.uri());
1701
1714
  }
1702
1715
  if (service.permissions().allow.size === 0) throw XIDError.noPermissions(service.uri());
@@ -1704,8 +1717,8 @@ var XIDDocument = class XIDDocument {
1704
1717
  /**
1705
1718
  * Check if any service references the given key.
1706
1719
  */
1707
- servicesReferenceKey(publicKeyBase) {
1708
- const keyRef = _bcts_components.Reference.hash(publicKeyBase.data()).toHex();
1720
+ servicesReferenceKey(publicKeys) {
1721
+ const keyRef = publicKeys.reference().toHex();
1709
1722
  for (const service of this._services.values()) if (service.keyReferences().has(keyRef)) return true;
1710
1723
  return false;
1711
1724
  }
@@ -1784,13 +1797,18 @@ var XIDDocument = class XIDDocument {
1784
1797
  case "inception": {
1785
1798
  const inceptionKey = this.inceptionKey();
1786
1799
  if (inceptionKey === void 0) throw XIDError.missingInceptionKey();
1787
- const privateKeyBase = inceptionKey.privateKeyBase();
1788
- if (privateKeyBase === void 0) throw XIDError.missingInceptionKey();
1789
- envelope = envelope.addSignature(privateKeyBase);
1800
+ const privateKeys = inceptionKey.privateKeys();
1801
+ if (privateKeys === void 0) throw XIDError.missingInceptionKey();
1802
+ envelope = envelope.sign(privateKeys);
1790
1803
  break;
1791
1804
  }
1792
- case "privateKeyBase":
1793
- envelope = envelope.addSignature(signingOptions.privateKeyBase);
1805
+ case "privateKeyBase": {
1806
+ const privateKeys = signingOptions.privateKeyBase.ed25519PrivateKeys();
1807
+ envelope = envelope.sign(privateKeys);
1808
+ break;
1809
+ }
1810
+ case "privateKeys":
1811
+ envelope = envelope.sign(signingOptions.privateKeys);
1794
1812
  break;
1795
1813
  case "none":
1796
1814
  default: break;
@@ -1817,8 +1835,8 @@ var XIDDocument = class XIDDocument {
1817
1835
  const doc = XIDDocument.fromEnvelopeInner(unwrapped, password);
1818
1836
  const inceptionKey = doc.inceptionKey();
1819
1837
  if (inceptionKey === void 0) throw XIDError.missingInceptionKey();
1820
- if (!envelopeExt.hasSignatureFrom(inceptionKey.publicKeyBase())) throw XIDError.signatureVerificationFailed();
1821
- if (!doc.isInceptionKey(inceptionKey.publicKeyBase())) throw XIDError.invalidXid();
1838
+ if (!envelopeExt.hasSignatureFrom(inceptionKey.publicKeys())) throw XIDError.signatureVerificationFailed();
1839
+ if (!doc.isInceptionKey(inceptionKey.publicKeys())) throw XIDError.invalidXid();
1822
1840
  return doc;
1823
1841
  }
1824
1842
  }
@@ -1872,7 +1890,7 @@ var XIDDocument = class XIDDocument {
1872
1890
  * Create a signed envelope.
1873
1891
  */
1874
1892
  toSignedEnvelope(signingKey) {
1875
- return this.toEnvelope(XIDPrivateKeyOptions.Omit, XIDGeneratorOptions.Omit, { type: "none" }).addSignature(signingKey);
1893
+ return this.toEnvelope(XIDPrivateKeyOptions.Omit, XIDGeneratorOptions.Omit, { type: "none" }).sign(signingKey);
1876
1894
  }
1877
1895
  /**
1878
1896
  * Get the reference for this document.
@@ -1900,19 +1918,11 @@ var XIDDocument = class XIDDocument {
1900
1918
  }
1901
1919
  };
1902
1920
  registerXIDDocumentClass(XIDDocument);
1903
- function hexToBytes(hex) {
1904
- const bytes = new Uint8Array(hex.length / 2);
1905
- for (let i = 0; i < hex.length; i += 2) bytes[i / 2] = parseInt(hex.substring(i, i + 2), 16);
1906
- return bytes;
1907
- }
1908
1921
  function bytesEqual(a, b) {
1909
1922
  if (a.length !== b.length) return false;
1910
1923
  for (let i = 0; i < a.length; i++) if (a[i] !== b[i]) return false;
1911
1924
  return true;
1912
1925
  }
1913
- function hashPublicKey(publicKeyBase) {
1914
- return _bcts_components.Reference.hash(publicKeyBase.data()).getDigest().toData();
1915
- }
1916
1926
 
1917
1927
  //#endregion
1918
1928
  //#region src/index.ts
@@ -1929,6 +1939,12 @@ exports.Provenance = Provenance;
1929
1939
  exports.Service = Service;
1930
1940
  exports.Shared = Shared;
1931
1941
  exports.VERSION = VERSION;
1942
+ Object.defineProperty(exports, 'XID', {
1943
+ enumerable: true,
1944
+ get: function () {
1945
+ return _bcts_components.XID;
1946
+ }
1947
+ });
1932
1948
  exports.XIDDocument = XIDDocument;
1933
1949
  exports.XIDError = XIDError;
1934
1950
  exports.XIDErrorCode = XIDErrorCode;