@bcts/xid 1.0.0-alpha.13 → 1.0.0-alpha.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 +12 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +8 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.iife.js +12 -0
- package/dist/index.iife.js.map +1 -1
- package/dist/index.mjs +12 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -7
- package/src/xid-document.ts +21 -0
package/dist/index.cjs
CHANGED
|
@@ -1603,6 +1603,18 @@ var XIDDocument = class XIDDocument {
|
|
|
1603
1603
|
return this.inceptionKey()?.privateKeys();
|
|
1604
1604
|
}
|
|
1605
1605
|
/**
|
|
1606
|
+
* Get the encryption key (encapsulation public key) for this document.
|
|
1607
|
+
*
|
|
1608
|
+
* Prefers the inception key for encryption. If no inception key is available,
|
|
1609
|
+
* falls back to the first key in the document.
|
|
1610
|
+
*/
|
|
1611
|
+
encryptionKey() {
|
|
1612
|
+
const inceptionKey = this.inceptionKey();
|
|
1613
|
+
if (inceptionKey !== void 0) return inceptionKey.publicKeys().encapsulationPublicKey();
|
|
1614
|
+
const firstKey = this._keys.values().next().value;
|
|
1615
|
+
if (firstKey !== void 0) return firstKey.publicKeys().encapsulationPublicKey();
|
|
1616
|
+
}
|
|
1617
|
+
/**
|
|
1606
1618
|
* Remove the inception key from the document.
|
|
1607
1619
|
*/
|
|
1608
1620
|
removeInceptionKey() {
|