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