@keyhive/keyhive 0.1.0-alpha.4 → 0.1.0-alpha.6
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/package.json +1 -1
- package/pkg/keyhive_wasm.d.ts +79 -40
- package/pkg/keyhive_wasm.js +1 -1
- package/pkg/keyhive_wasm_bg.js +214 -87
- package/pkg/keyhive_wasm_bg.wasm +0 -0
- package/pkg/keyhive_wasm_bg.wasm.d.ts +122 -108
- package/pkg-node/keyhive_wasm.d.ts +79 -40
- package/pkg-node/keyhive_wasm.js +217 -90
- package/pkg-node/keyhive_wasm_bg.wasm +0 -0
- package/pkg-node/keyhive_wasm_bg.wasm.d.ts +122 -108
- package/pkg-slim/keyhive_wasm.d.ts +201 -148
- package/pkg-slim/keyhive_wasm.js +214 -87
- package/pkg-slim/keyhive_wasm_bg.wasm +0 -0
- package/pkg-slim/keyhive_wasm_bg.wasm.base64.js +1 -1
- package/pkg-slim/keyhive_wasm_bg.wasm.d.ts +122 -108
package/pkg-node/keyhive_wasm.js
CHANGED
|
@@ -17,6 +17,108 @@ class Access {
|
|
|
17
17
|
const ptr = this.__destroy_into_raw();
|
|
18
18
|
wasm.__wbg_access_free(ptr, 0);
|
|
19
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* The ability to revoke any members of a group, not just those that they have causal senority over.
|
|
22
|
+
* @returns {Access}
|
|
23
|
+
*/
|
|
24
|
+
static admin() {
|
|
25
|
+
const ret = wasm.access_admin();
|
|
26
|
+
return Access.__wrap(ret);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* True if this level is at least as permissive as `other`.
|
|
30
|
+
* @param {Access} other
|
|
31
|
+
* @returns {boolean}
|
|
32
|
+
*/
|
|
33
|
+
atLeast(other) {
|
|
34
|
+
_assertClass(other, Access);
|
|
35
|
+
const ret = wasm.access_atLeast(this.__wbg_ptr, other.__wbg_ptr);
|
|
36
|
+
return ret !== 0;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Standard comparator result: -1 if less permissive than `other`,
|
|
40
|
+
* 0 if equal, 1 if more permissive.
|
|
41
|
+
* @param {Access} other
|
|
42
|
+
* @returns {number}
|
|
43
|
+
*/
|
|
44
|
+
compareTo(other) {
|
|
45
|
+
_assertClass(other, Access);
|
|
46
|
+
const ret = wasm.access_compareTo(this.__wbg_ptr, other.__wbg_ptr);
|
|
47
|
+
return ret;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* The ability to edit (append ops to) the content of a document.
|
|
51
|
+
* @returns {Access}
|
|
52
|
+
*/
|
|
53
|
+
static edit() {
|
|
54
|
+
const ret = wasm.access_edit();
|
|
55
|
+
return Access.__wrap(ret);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* @param {Access} other
|
|
59
|
+
* @returns {boolean}
|
|
60
|
+
*/
|
|
61
|
+
equals(other) {
|
|
62
|
+
_assertClass(other, Access);
|
|
63
|
+
const ret = wasm.access_equals(this.__wbg_ptr, other.__wbg_ptr);
|
|
64
|
+
return ret !== 0;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Parse an access level, throwing on invalid input.
|
|
68
|
+
* Accepts "relay", "read", "edit", or "admin" (case-insensitive).
|
|
69
|
+
* @param {string} s
|
|
70
|
+
* @returns {Access}
|
|
71
|
+
*/
|
|
72
|
+
static fromString(s) {
|
|
73
|
+
const ptr0 = passStringToWasm0(s, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
74
|
+
const len0 = WASM_VECTOR_LEN;
|
|
75
|
+
const ret = wasm.access_fromString(ptr0, len0);
|
|
76
|
+
if (ret[2]) {
|
|
77
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
78
|
+
}
|
|
79
|
+
return Access.__wrap(ret[0]);
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* True for Edit access or higher.
|
|
83
|
+
* @returns {boolean}
|
|
84
|
+
*/
|
|
85
|
+
get isEditor() {
|
|
86
|
+
const ret = wasm.access_isEditor(this.__wbg_ptr);
|
|
87
|
+
return ret !== 0;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* True for Read access or higher.
|
|
91
|
+
* @returns {boolean}
|
|
92
|
+
*/
|
|
93
|
+
get isReader() {
|
|
94
|
+
const ret = wasm.access_isReader(this.__wbg_ptr);
|
|
95
|
+
return ret !== 0;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Numeric level for ordering: Relay = 0, Read = 1, Edit = 2, Admin = 3.
|
|
99
|
+
* Higher levels imply all lower levels.
|
|
100
|
+
* @returns {number}
|
|
101
|
+
*/
|
|
102
|
+
get level() {
|
|
103
|
+
const ret = wasm.access_level(this.__wbg_ptr);
|
|
104
|
+
return ret;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* The ability to read (decrypt) the content of a document.
|
|
108
|
+
* @returns {Access}
|
|
109
|
+
*/
|
|
110
|
+
static read() {
|
|
111
|
+
const ret = wasm.access_read();
|
|
112
|
+
return Access.__wrap(ret);
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* The ability to retrieve bytes over the network.
|
|
116
|
+
* @returns {Access}
|
|
117
|
+
*/
|
|
118
|
+
static relay() {
|
|
119
|
+
const ret = wasm.access_relay();
|
|
120
|
+
return Access.__wrap(ret);
|
|
121
|
+
}
|
|
20
122
|
/**
|
|
21
123
|
* @returns {string}
|
|
22
124
|
*/
|
|
@@ -33,6 +135,8 @@ class Access {
|
|
|
33
135
|
}
|
|
34
136
|
}
|
|
35
137
|
/**
|
|
138
|
+
* Parse an access level, returning undefined on invalid input.
|
|
139
|
+
* Prefer `fromString`, which throws a descriptive error instead.
|
|
36
140
|
* @param {string} s
|
|
37
141
|
* @returns {Access | undefined}
|
|
38
142
|
*/
|
|
@@ -46,37 +150,6 @@ class Access {
|
|
|
46
150
|
if (Symbol.dispose) Access.prototype[Symbol.dispose] = Access.prototype.free;
|
|
47
151
|
exports.Access = Access;
|
|
48
152
|
|
|
49
|
-
/**
|
|
50
|
-
* The result of adding a member: the membership delegation.
|
|
51
|
-
*/
|
|
52
|
-
class AddMemberUpdate {
|
|
53
|
-
static __wrap(ptr) {
|
|
54
|
-
const obj = Object.create(AddMemberUpdate.prototype);
|
|
55
|
-
obj.__wbg_ptr = ptr;
|
|
56
|
-
AddMemberUpdateFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
57
|
-
return obj;
|
|
58
|
-
}
|
|
59
|
-
__destroy_into_raw() {
|
|
60
|
-
const ptr = this.__wbg_ptr;
|
|
61
|
-
this.__wbg_ptr = 0;
|
|
62
|
-
AddMemberUpdateFinalization.unregister(this);
|
|
63
|
-
return ptr;
|
|
64
|
-
}
|
|
65
|
-
free() {
|
|
66
|
-
const ptr = this.__destroy_into_raw();
|
|
67
|
-
wasm.__wbg_addmemberupdate_free(ptr, 0);
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* @returns {SignedDelegation}
|
|
71
|
-
*/
|
|
72
|
-
get delegation() {
|
|
73
|
-
const ret = wasm.addmemberupdate_delegation(this.__wbg_ptr);
|
|
74
|
-
return SignedDelegation.__wrap(ret);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
if (Symbol.dispose) AddMemberUpdate.prototype[Symbol.dispose] = AddMemberUpdate.prototype.free;
|
|
78
|
-
exports.AddMemberUpdate = AddMemberUpdate;
|
|
79
|
-
|
|
80
153
|
class Agent {
|
|
81
154
|
static __wrap(ptr) {
|
|
82
155
|
const obj = Object.create(Agent.prototype);
|
|
@@ -598,33 +671,31 @@ exports.ContactCard = ContactCard;
|
|
|
598
671
|
|
|
599
672
|
/**
|
|
600
673
|
* Plaintext plus the application secret key that decrypted it.
|
|
601
|
-
*
|
|
602
|
-
* The key lets the consumer recover the blob's external predecessor-secret
|
|
603
|
-
* chain and chain further encryptions onto it, without re-entering CGKA.
|
|
604
674
|
*/
|
|
605
|
-
class
|
|
675
|
+
class DecryptedKeyed {
|
|
606
676
|
static __wrap(ptr) {
|
|
607
|
-
const obj = Object.create(
|
|
677
|
+
const obj = Object.create(DecryptedKeyed.prototype);
|
|
608
678
|
obj.__wbg_ptr = ptr;
|
|
609
|
-
|
|
679
|
+
DecryptedKeyedFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
610
680
|
return obj;
|
|
611
681
|
}
|
|
612
682
|
__destroy_into_raw() {
|
|
613
683
|
const ptr = this.__wbg_ptr;
|
|
614
684
|
this.__wbg_ptr = 0;
|
|
615
|
-
|
|
685
|
+
DecryptedKeyedFinalization.unregister(this);
|
|
616
686
|
return ptr;
|
|
617
687
|
}
|
|
618
688
|
free() {
|
|
619
689
|
const ptr = this.__destroy_into_raw();
|
|
620
|
-
wasm.
|
|
690
|
+
wasm.__wbg_decryptedkeyed_free(ptr, 0);
|
|
621
691
|
}
|
|
622
692
|
/**
|
|
623
693
|
* The 32-byte application secret key used to decrypt this content.
|
|
694
|
+
* Treat as secret: do not log or persist unencrypted.
|
|
624
695
|
* @returns {Uint8Array}
|
|
625
696
|
*/
|
|
626
697
|
get applicationSecret() {
|
|
627
|
-
const ret = wasm.
|
|
698
|
+
const ret = wasm.decryptedkeyed_applicationSecret(this.__wbg_ptr);
|
|
628
699
|
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
629
700
|
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
630
701
|
return v1;
|
|
@@ -633,14 +704,14 @@ class DecryptedWithKey {
|
|
|
633
704
|
* @returns {Uint8Array}
|
|
634
705
|
*/
|
|
635
706
|
get plaintext() {
|
|
636
|
-
const ret = wasm.
|
|
707
|
+
const ret = wasm.decryptedkeyed_plaintext(this.__wbg_ptr);
|
|
637
708
|
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
638
709
|
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
639
710
|
return v1;
|
|
640
711
|
}
|
|
641
712
|
}
|
|
642
|
-
if (Symbol.dispose)
|
|
643
|
-
exports.
|
|
713
|
+
if (Symbol.dispose) DecryptedKeyed.prototype[Symbol.dispose] = DecryptedKeyed.prototype.free;
|
|
714
|
+
exports.DecryptedKeyed = DecryptedKeyed;
|
|
644
715
|
|
|
645
716
|
class Delegation {
|
|
646
717
|
static __wrap(ptr) {
|
|
@@ -927,8 +998,7 @@ class Encrypted {
|
|
|
927
998
|
}
|
|
928
999
|
/**
|
|
929
1000
|
* Decrypt this content with an explicit 32-byte application secret key,
|
|
930
|
-
* bypassing CGKA.
|
|
931
|
-
* predecessor-secret chain once it has recovered a blob's key.
|
|
1001
|
+
* bypassing CGKA.
|
|
932
1002
|
* @param {Uint8Array} key
|
|
933
1003
|
* @returns {Uint8Array}
|
|
934
1004
|
*/
|
|
@@ -1025,15 +1095,51 @@ class EncryptedContentWithUpdate {
|
|
|
1025
1095
|
const ptr = this.__destroy_into_raw();
|
|
1026
1096
|
wasm.__wbg_encryptedcontentwithupdate_free(ptr, 0);
|
|
1027
1097
|
}
|
|
1098
|
+
/**
|
|
1099
|
+
* @returns {Encrypted}
|
|
1100
|
+
*/
|
|
1101
|
+
encrypted_content() {
|
|
1102
|
+
const ret = wasm.encryptedcontentwithupdate_encrypted_content(this.__wbg_ptr);
|
|
1103
|
+
return Encrypted.__wrap(ret);
|
|
1104
|
+
}
|
|
1105
|
+
/**
|
|
1106
|
+
* @returns {SignedCgkaOperation | undefined}
|
|
1107
|
+
*/
|
|
1108
|
+
update_op() {
|
|
1109
|
+
const ret = wasm.encryptedcontentwithupdate_update_op(this.__wbg_ptr);
|
|
1110
|
+
return ret === 0 ? undefined : SignedCgkaOperation.__wrap(ret);
|
|
1111
|
+
}
|
|
1112
|
+
}
|
|
1113
|
+
if (Symbol.dispose) EncryptedContentWithUpdate.prototype[Symbol.dispose] = EncryptedContentWithUpdate.prototype.free;
|
|
1114
|
+
exports.EncryptedContentWithUpdate = EncryptedContentWithUpdate;
|
|
1115
|
+
|
|
1116
|
+
/**
|
|
1117
|
+
* Encrypted content plus the application secret key it was encrypted under.
|
|
1118
|
+
*/
|
|
1119
|
+
class EncryptedKeyed {
|
|
1120
|
+
static __wrap(ptr) {
|
|
1121
|
+
const obj = Object.create(EncryptedKeyed.prototype);
|
|
1122
|
+
obj.__wbg_ptr = ptr;
|
|
1123
|
+
EncryptedKeyedFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1124
|
+
return obj;
|
|
1125
|
+
}
|
|
1126
|
+
__destroy_into_raw() {
|
|
1127
|
+
const ptr = this.__wbg_ptr;
|
|
1128
|
+
this.__wbg_ptr = 0;
|
|
1129
|
+
EncryptedKeyedFinalization.unregister(this);
|
|
1130
|
+
return ptr;
|
|
1131
|
+
}
|
|
1132
|
+
free() {
|
|
1133
|
+
const ptr = this.__destroy_into_raw();
|
|
1134
|
+
wasm.__wbg_encryptedkeyed_free(ptr, 0);
|
|
1135
|
+
}
|
|
1028
1136
|
/**
|
|
1029
1137
|
* The 32-byte application secret key used to encrypt this content.
|
|
1030
|
-
*
|
|
1031
|
-
* Lets the consumer build the external predecessor-secret chain and chain
|
|
1032
|
-
* further encryptions onto this blob.
|
|
1138
|
+
* Treat as secret: do not log or persist unencrypted.
|
|
1033
1139
|
* @returns {Uint8Array}
|
|
1034
1140
|
*/
|
|
1035
1141
|
get applicationSecret() {
|
|
1036
|
-
const ret = wasm.
|
|
1142
|
+
const ret = wasm.encryptedkeyed_applicationSecret(this.__wbg_ptr);
|
|
1037
1143
|
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
1038
1144
|
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
1039
1145
|
return v1;
|
|
@@ -1042,19 +1148,19 @@ class EncryptedContentWithUpdate {
|
|
|
1042
1148
|
* @returns {Encrypted}
|
|
1043
1149
|
*/
|
|
1044
1150
|
encrypted_content() {
|
|
1045
|
-
const ret = wasm.
|
|
1151
|
+
const ret = wasm.encryptedkeyed_encrypted_content(this.__wbg_ptr);
|
|
1046
1152
|
return Encrypted.__wrap(ret);
|
|
1047
1153
|
}
|
|
1048
1154
|
/**
|
|
1049
1155
|
* @returns {SignedCgkaOperation | undefined}
|
|
1050
1156
|
*/
|
|
1051
1157
|
update_op() {
|
|
1052
|
-
const ret = wasm.
|
|
1158
|
+
const ret = wasm.encryptedkeyed_update_op(this.__wbg_ptr);
|
|
1053
1159
|
return ret === 0 ? undefined : SignedCgkaOperation.__wrap(ret);
|
|
1054
1160
|
}
|
|
1055
1161
|
}
|
|
1056
|
-
if (Symbol.dispose)
|
|
1057
|
-
exports.
|
|
1162
|
+
if (Symbol.dispose) EncryptedKeyed.prototype[Symbol.dispose] = EncryptedKeyed.prototype.free;
|
|
1163
|
+
exports.EncryptedKeyed = EncryptedKeyed;
|
|
1058
1164
|
|
|
1059
1165
|
class Event {
|
|
1060
1166
|
static __wrap(ptr) {
|
|
@@ -1513,7 +1619,7 @@ class Keyhive {
|
|
|
1513
1619
|
* @param {Membered} membered
|
|
1514
1620
|
* @param {Access} access
|
|
1515
1621
|
* @param {Document[]} other_relevant_docs
|
|
1516
|
-
* @returns {Promise<
|
|
1622
|
+
* @returns {Promise<SignedDelegation>}
|
|
1517
1623
|
*/
|
|
1518
1624
|
addMember(to_add, membered, access, other_relevant_docs) {
|
|
1519
1625
|
_assertClass(to_add, Agent);
|
|
@@ -1533,6 +1639,20 @@ class Keyhive {
|
|
|
1533
1639
|
const ret = wasm.keyhive_allAgentEvents(this.__wbg_ptr);
|
|
1534
1640
|
return ret;
|
|
1535
1641
|
}
|
|
1642
|
+
/**
|
|
1643
|
+
* The most permissive of `id`'s direct access and the document's
|
|
1644
|
+
* public access. Returns undefined if neither grants access (or the
|
|
1645
|
+
* document is unknown).
|
|
1646
|
+
* @param {Identifier} id
|
|
1647
|
+
* @param {DocumentId} doc_id
|
|
1648
|
+
* @returns {Promise<Access | undefined>}
|
|
1649
|
+
*/
|
|
1650
|
+
bestAccessForDoc(id, doc_id) {
|
|
1651
|
+
_assertClass(id, Identifier);
|
|
1652
|
+
_assertClass(doc_id, DocumentId);
|
|
1653
|
+
const ret = wasm.keyhive_bestAccessForDoc(this.__wbg_ptr, id.__wbg_ptr, doc_id.__wbg_ptr);
|
|
1654
|
+
return ret;
|
|
1655
|
+
}
|
|
1536
1656
|
/**
|
|
1537
1657
|
* @returns {Promise<ContactCard>}
|
|
1538
1658
|
*/
|
|
@@ -1586,8 +1706,8 @@ class Keyhive {
|
|
|
1586
1706
|
/**
|
|
1587
1707
|
* Force a PCS key rotation and return the new leaf secret, serialized as a
|
|
1588
1708
|
* one-entry `BTreeMap<ShareKey, ShareSecretKey>` (the exact format
|
|
1589
|
-
* `importPrekeySecrets` accepts).
|
|
1590
|
-
*
|
|
1709
|
+
* `importPrekeySecrets` accepts).
|
|
1710
|
+
* The returned bytes are secret key material: do not log or persist unencrypted.
|
|
1591
1711
|
* @param {Document} doc
|
|
1592
1712
|
* @returns {Promise<Uint8Array>}
|
|
1593
1713
|
*/
|
|
@@ -1597,8 +1717,6 @@ class Keyhive {
|
|
|
1597
1717
|
return ret;
|
|
1598
1718
|
}
|
|
1599
1719
|
/**
|
|
1600
|
-
* Generate a document. Whether it provides forward secrecy is determined by
|
|
1601
|
-
* this peer's forward-secrecy policy (chosen at `Keyhive.init`).
|
|
1602
1720
|
* @param {Peer[]} coparents
|
|
1603
1721
|
* @param {ChangeId} initial_content_ref_head
|
|
1604
1722
|
* @param {ChangeId[]} more_initial_content_refs
|
|
@@ -1723,7 +1841,6 @@ class Keyhive {
|
|
|
1723
1841
|
return ret;
|
|
1724
1842
|
}
|
|
1725
1843
|
/**
|
|
1726
|
-
* Initialize a peer.
|
|
1727
1844
|
* @param {Signer} signer
|
|
1728
1845
|
* @param {CiphertextStore} ciphertext_store
|
|
1729
1846
|
* @param {Function} event_handler
|
|
@@ -1832,17 +1949,14 @@ class Keyhive {
|
|
|
1832
1949
|
}
|
|
1833
1950
|
/**
|
|
1834
1951
|
* Decrypt content and also return the 32-byte application secret key used.
|
|
1835
|
-
*
|
|
1836
|
-
* The consumer follows the external predecessor-secret chain from this key
|
|
1837
|
-
* with `Encrypted.decryptWithKey`, avoiding further CGKA dives.
|
|
1838
1952
|
* @param {Document} doc
|
|
1839
1953
|
* @param {Encrypted} encrypted
|
|
1840
|
-
* @returns {Promise<
|
|
1954
|
+
* @returns {Promise<DecryptedKeyed>}
|
|
1841
1955
|
*/
|
|
1842
|
-
|
|
1956
|
+
tryDecryptKeyed(doc, encrypted) {
|
|
1843
1957
|
_assertClass(doc, Document);
|
|
1844
1958
|
_assertClass(encrypted, Encrypted);
|
|
1845
|
-
const ret = wasm.
|
|
1959
|
+
const ret = wasm.keyhive_tryDecryptKeyed(this.__wbg_ptr, doc.__wbg_ptr, encrypted.__wbg_ptr);
|
|
1846
1960
|
return ret;
|
|
1847
1961
|
}
|
|
1848
1962
|
/**
|
|
@@ -1879,6 +1993,25 @@ class Keyhive {
|
|
|
1879
1993
|
const ret = wasm.keyhive_tryEncryptArchive(this.__wbg_ptr, doc.__wbg_ptr, content_ref.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
1880
1994
|
return ret;
|
|
1881
1995
|
}
|
|
1996
|
+
/**
|
|
1997
|
+
* Encrypt content and also return the application secret key it was
|
|
1998
|
+
* encrypted under.
|
|
1999
|
+
* @param {Document} doc
|
|
2000
|
+
* @param {ChangeId} content_ref
|
|
2001
|
+
* @param {ChangeId[]} js_pred_refs
|
|
2002
|
+
* @param {Uint8Array} content
|
|
2003
|
+
* @returns {Promise<EncryptedKeyed>}
|
|
2004
|
+
*/
|
|
2005
|
+
tryEncryptKeyed(doc, content_ref, js_pred_refs, content) {
|
|
2006
|
+
_assertClass(doc, Document);
|
|
2007
|
+
_assertClass(content_ref, ChangeId);
|
|
2008
|
+
const ptr0 = passArrayJsValueToWasm0(js_pred_refs, wasm.__wbindgen_malloc);
|
|
2009
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2010
|
+
const ptr1 = passArray8ToWasm0(content, wasm.__wbindgen_malloc);
|
|
2011
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2012
|
+
const ret = wasm.keyhive_tryEncryptKeyed(this.__wbg_ptr, doc.__wbg_ptr, content_ref.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
2013
|
+
return ret;
|
|
2014
|
+
}
|
|
1882
2015
|
/**
|
|
1883
2016
|
* @param {Document} doc
|
|
1884
2017
|
* @returns {Promise<Uint8Array | undefined>}
|
|
@@ -2708,13 +2841,7 @@ function symmetricDecrypt(key, blob) {
|
|
|
2708
2841
|
exports.symmetricDecrypt = symmetricDecrypt;
|
|
2709
2842
|
|
|
2710
2843
|
/**
|
|
2711
|
-
*
|
|
2712
|
-
*
|
|
2713
|
-
* `associated_data` flavors the synthetic nonce (e.g. the document or content
|
|
2714
|
-
* id) so identical plaintext under the same key in different contexts produces
|
|
2715
|
-
* distinct ciphertext. Returns `nonce(24) || ciphertext` (the ciphertext
|
|
2716
|
-
* includes the Poly1305 tag). The nonce is carried in the output, so
|
|
2717
|
-
* [`symmetric_decrypt`] does not need the associated data.
|
|
2844
|
+
* Encrypt `plaintext` under a 32-byte `key`, returning `nonce(24) || ciphertext`.
|
|
2718
2845
|
* @param {Uint8Array} key
|
|
2719
2846
|
* @param {Uint8Array} plaintext
|
|
2720
2847
|
* @param {Uint8Array} associated_data
|
|
@@ -2799,10 +2926,6 @@ function __wbg_get_imports() {
|
|
|
2799
2926
|
const ret = arg0.add(arg1);
|
|
2800
2927
|
return ret;
|
|
2801
2928
|
},
|
|
2802
|
-
__wbg_addmemberupdate_new: function(arg0) {
|
|
2803
|
-
const ret = AddMemberUpdate.__wrap(arg0);
|
|
2804
|
-
return ret;
|
|
2805
|
-
},
|
|
2806
2929
|
__wbg_agent_new: function(arg0) {
|
|
2807
2930
|
const ret = Agent.__wrap(arg0);
|
|
2808
2931
|
return ret;
|
|
@@ -2869,8 +2992,8 @@ function __wbg_get_imports() {
|
|
|
2869
2992
|
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
2870
2993
|
}
|
|
2871
2994
|
},
|
|
2872
|
-
|
|
2873
|
-
const ret =
|
|
2995
|
+
__wbg_decryptedkeyed_new: function(arg0) {
|
|
2996
|
+
const ret = DecryptedKeyed.__wrap(arg0);
|
|
2874
2997
|
return ret;
|
|
2875
2998
|
},
|
|
2876
2999
|
__wbg_doccontentrefs_new: function(arg0) {
|
|
@@ -2885,6 +3008,10 @@ function __wbg_get_imports() {
|
|
|
2885
3008
|
const ret = EncryptedContentWithUpdate.__wrap(arg0);
|
|
2886
3009
|
return ret;
|
|
2887
3010
|
},
|
|
3011
|
+
__wbg_encryptedkeyed_new: function(arg0) {
|
|
3012
|
+
const ret = EncryptedKeyed.__wrap(arg0);
|
|
3013
|
+
return ret;
|
|
3014
|
+
},
|
|
2888
3015
|
__wbg_error_8b62d3db440cf4a8: function(arg0, arg1) {
|
|
2889
3016
|
let deferred0_0;
|
|
2890
3017
|
let deferred0_1;
|
|
@@ -3067,7 +3194,7 @@ function __wbg_get_imports() {
|
|
|
3067
3194
|
const a = state0.a;
|
|
3068
3195
|
state0.a = 0;
|
|
3069
3196
|
try {
|
|
3070
|
-
return
|
|
3197
|
+
return wasm_bindgen__convert__closures_____invoke__h3240482818b7fa6b(a, state0.b, arg0, arg1);
|
|
3071
3198
|
} finally {
|
|
3072
3199
|
state0.a = a;
|
|
3073
3200
|
}
|
|
@@ -3220,8 +3347,8 @@ function __wbg_get_imports() {
|
|
|
3220
3347
|
}
|
|
3221
3348
|
},
|
|
3222
3349
|
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
3223
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx:
|
|
3224
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
3350
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 719, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
3351
|
+
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h264249ebd10d2c4e);
|
|
3225
3352
|
return ret;
|
|
3226
3353
|
},
|
|
3227
3354
|
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
@@ -3306,23 +3433,20 @@ function __wbg_get_imports() {
|
|
|
3306
3433
|
};
|
|
3307
3434
|
}
|
|
3308
3435
|
|
|
3309
|
-
function
|
|
3310
|
-
const ret = wasm.
|
|
3436
|
+
function wasm_bindgen__convert__closures_____invoke__h264249ebd10d2c4e(arg0, arg1, arg2) {
|
|
3437
|
+
const ret = wasm.wasm_bindgen__convert__closures_____invoke__h264249ebd10d2c4e(arg0, arg1, arg2);
|
|
3311
3438
|
if (ret[1]) {
|
|
3312
3439
|
throw takeFromExternrefTable0(ret[0]);
|
|
3313
3440
|
}
|
|
3314
3441
|
}
|
|
3315
3442
|
|
|
3316
|
-
function
|
|
3317
|
-
wasm.
|
|
3443
|
+
function wasm_bindgen__convert__closures_____invoke__h3240482818b7fa6b(arg0, arg1, arg2, arg3) {
|
|
3444
|
+
wasm.wasm_bindgen__convert__closures_____invoke__h3240482818b7fa6b(arg0, arg1, arg2, arg3);
|
|
3318
3445
|
}
|
|
3319
3446
|
|
|
3320
3447
|
const AccessFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
3321
3448
|
? { register: () => {}, unregister: () => {} }
|
|
3322
3449
|
: new FinalizationRegistry(ptr => wasm.__wbg_access_free(ptr, 1));
|
|
3323
|
-
const AddMemberUpdateFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
3324
|
-
? { register: () => {}, unregister: () => {} }
|
|
3325
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_addmemberupdate_free(ptr, 1));
|
|
3326
3450
|
const AgentFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
3327
3451
|
? { register: () => {}, unregister: () => {} }
|
|
3328
3452
|
: new FinalizationRegistry(ptr => wasm.__wbg_agent_free(ptr, 1));
|
|
@@ -3353,9 +3477,9 @@ const CiphertextStoreFinalization = (typeof FinalizationRegistry === 'undefined'
|
|
|
3353
3477
|
const ContactCardFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
3354
3478
|
? { register: () => {}, unregister: () => {} }
|
|
3355
3479
|
: new FinalizationRegistry(ptr => wasm.__wbg_contactcard_free(ptr, 1));
|
|
3356
|
-
const
|
|
3480
|
+
const DecryptedKeyedFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
3357
3481
|
? { register: () => {}, unregister: () => {} }
|
|
3358
|
-
: new FinalizationRegistry(ptr => wasm.
|
|
3482
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_decryptedkeyed_free(ptr, 1));
|
|
3359
3483
|
const DelegationFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
3360
3484
|
? { register: () => {}, unregister: () => {} }
|
|
3361
3485
|
: new FinalizationRegistry(ptr => wasm.__wbg_delegation_free(ptr, 1));
|
|
@@ -3374,6 +3498,9 @@ const EncryptedFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
|
3374
3498
|
const EncryptedContentWithUpdateFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
3375
3499
|
? { register: () => {}, unregister: () => {} }
|
|
3376
3500
|
: new FinalizationRegistry(ptr => wasm.__wbg_encryptedcontentwithupdate_free(ptr, 1));
|
|
3501
|
+
const EncryptedKeyedFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
3502
|
+
? { register: () => {}, unregister: () => {} }
|
|
3503
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_encryptedkeyed_free(ptr, 1));
|
|
3377
3504
|
const EventFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
3378
3505
|
? { register: () => {}, unregister: () => {} }
|
|
3379
3506
|
: new FinalizationRegistry(ptr => wasm.__wbg_event_free(ptr, 1));
|
|
Binary file
|