@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-slim/keyhive_wasm.js
CHANGED
|
@@ -17,6 +17,108 @@ export 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 @@ export 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
|
*/
|
|
@@ -45,36 +149,6 @@ export class Access {
|
|
|
45
149
|
}
|
|
46
150
|
if (Symbol.dispose) Access.prototype[Symbol.dispose] = Access.prototype.free;
|
|
47
151
|
|
|
48
|
-
/**
|
|
49
|
-
* The result of adding a member: the membership delegation.
|
|
50
|
-
*/
|
|
51
|
-
export class AddMemberUpdate {
|
|
52
|
-
static __wrap(ptr) {
|
|
53
|
-
const obj = Object.create(AddMemberUpdate.prototype);
|
|
54
|
-
obj.__wbg_ptr = ptr;
|
|
55
|
-
AddMemberUpdateFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
56
|
-
return obj;
|
|
57
|
-
}
|
|
58
|
-
__destroy_into_raw() {
|
|
59
|
-
const ptr = this.__wbg_ptr;
|
|
60
|
-
this.__wbg_ptr = 0;
|
|
61
|
-
AddMemberUpdateFinalization.unregister(this);
|
|
62
|
-
return ptr;
|
|
63
|
-
}
|
|
64
|
-
free() {
|
|
65
|
-
const ptr = this.__destroy_into_raw();
|
|
66
|
-
wasm.__wbg_addmemberupdate_free(ptr, 0);
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* @returns {SignedDelegation}
|
|
70
|
-
*/
|
|
71
|
-
get delegation() {
|
|
72
|
-
const ret = wasm.addmemberupdate_delegation(this.__wbg_ptr);
|
|
73
|
-
return SignedDelegation.__wrap(ret);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
if (Symbol.dispose) AddMemberUpdate.prototype[Symbol.dispose] = AddMemberUpdate.prototype.free;
|
|
77
|
-
|
|
78
152
|
export class Agent {
|
|
79
153
|
static __wrap(ptr) {
|
|
80
154
|
const obj = Object.create(Agent.prototype);
|
|
@@ -586,33 +660,31 @@ if (Symbol.dispose) ContactCard.prototype[Symbol.dispose] = ContactCard.prototyp
|
|
|
586
660
|
|
|
587
661
|
/**
|
|
588
662
|
* Plaintext plus the application secret key that decrypted it.
|
|
589
|
-
*
|
|
590
|
-
* The key lets the consumer recover the blob's external predecessor-secret
|
|
591
|
-
* chain and chain further encryptions onto it, without re-entering CGKA.
|
|
592
663
|
*/
|
|
593
|
-
export class
|
|
664
|
+
export class DecryptedKeyed {
|
|
594
665
|
static __wrap(ptr) {
|
|
595
|
-
const obj = Object.create(
|
|
666
|
+
const obj = Object.create(DecryptedKeyed.prototype);
|
|
596
667
|
obj.__wbg_ptr = ptr;
|
|
597
|
-
|
|
668
|
+
DecryptedKeyedFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
598
669
|
return obj;
|
|
599
670
|
}
|
|
600
671
|
__destroy_into_raw() {
|
|
601
672
|
const ptr = this.__wbg_ptr;
|
|
602
673
|
this.__wbg_ptr = 0;
|
|
603
|
-
|
|
674
|
+
DecryptedKeyedFinalization.unregister(this);
|
|
604
675
|
return ptr;
|
|
605
676
|
}
|
|
606
677
|
free() {
|
|
607
678
|
const ptr = this.__destroy_into_raw();
|
|
608
|
-
wasm.
|
|
679
|
+
wasm.__wbg_decryptedkeyed_free(ptr, 0);
|
|
609
680
|
}
|
|
610
681
|
/**
|
|
611
682
|
* The 32-byte application secret key used to decrypt this content.
|
|
683
|
+
* Treat as secret: do not log or persist unencrypted.
|
|
612
684
|
* @returns {Uint8Array}
|
|
613
685
|
*/
|
|
614
686
|
get applicationSecret() {
|
|
615
|
-
const ret = wasm.
|
|
687
|
+
const ret = wasm.decryptedkeyed_applicationSecret(this.__wbg_ptr);
|
|
616
688
|
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
617
689
|
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
618
690
|
return v1;
|
|
@@ -621,13 +693,13 @@ export class DecryptedWithKey {
|
|
|
621
693
|
* @returns {Uint8Array}
|
|
622
694
|
*/
|
|
623
695
|
get plaintext() {
|
|
624
|
-
const ret = wasm.
|
|
696
|
+
const ret = wasm.decryptedkeyed_plaintext(this.__wbg_ptr);
|
|
625
697
|
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
626
698
|
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
627
699
|
return v1;
|
|
628
700
|
}
|
|
629
701
|
}
|
|
630
|
-
if (Symbol.dispose)
|
|
702
|
+
if (Symbol.dispose) DecryptedKeyed.prototype[Symbol.dispose] = DecryptedKeyed.prototype.free;
|
|
631
703
|
|
|
632
704
|
export class Delegation {
|
|
633
705
|
static __wrap(ptr) {
|
|
@@ -910,8 +982,7 @@ export class Encrypted {
|
|
|
910
982
|
}
|
|
911
983
|
/**
|
|
912
984
|
* Decrypt this content with an explicit 32-byte application secret key,
|
|
913
|
-
* bypassing CGKA.
|
|
914
|
-
* predecessor-secret chain once it has recovered a blob's key.
|
|
985
|
+
* bypassing CGKA.
|
|
915
986
|
* @param {Uint8Array} key
|
|
916
987
|
* @returns {Uint8Array}
|
|
917
988
|
*/
|
|
@@ -1007,15 +1078,50 @@ export class EncryptedContentWithUpdate {
|
|
|
1007
1078
|
const ptr = this.__destroy_into_raw();
|
|
1008
1079
|
wasm.__wbg_encryptedcontentwithupdate_free(ptr, 0);
|
|
1009
1080
|
}
|
|
1081
|
+
/**
|
|
1082
|
+
* @returns {Encrypted}
|
|
1083
|
+
*/
|
|
1084
|
+
encrypted_content() {
|
|
1085
|
+
const ret = wasm.encryptedcontentwithupdate_encrypted_content(this.__wbg_ptr);
|
|
1086
|
+
return Encrypted.__wrap(ret);
|
|
1087
|
+
}
|
|
1088
|
+
/**
|
|
1089
|
+
* @returns {SignedCgkaOperation | undefined}
|
|
1090
|
+
*/
|
|
1091
|
+
update_op() {
|
|
1092
|
+
const ret = wasm.encryptedcontentwithupdate_update_op(this.__wbg_ptr);
|
|
1093
|
+
return ret === 0 ? undefined : SignedCgkaOperation.__wrap(ret);
|
|
1094
|
+
}
|
|
1095
|
+
}
|
|
1096
|
+
if (Symbol.dispose) EncryptedContentWithUpdate.prototype[Symbol.dispose] = EncryptedContentWithUpdate.prototype.free;
|
|
1097
|
+
|
|
1098
|
+
/**
|
|
1099
|
+
* Encrypted content plus the application secret key it was encrypted under.
|
|
1100
|
+
*/
|
|
1101
|
+
export class EncryptedKeyed {
|
|
1102
|
+
static __wrap(ptr) {
|
|
1103
|
+
const obj = Object.create(EncryptedKeyed.prototype);
|
|
1104
|
+
obj.__wbg_ptr = ptr;
|
|
1105
|
+
EncryptedKeyedFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1106
|
+
return obj;
|
|
1107
|
+
}
|
|
1108
|
+
__destroy_into_raw() {
|
|
1109
|
+
const ptr = this.__wbg_ptr;
|
|
1110
|
+
this.__wbg_ptr = 0;
|
|
1111
|
+
EncryptedKeyedFinalization.unregister(this);
|
|
1112
|
+
return ptr;
|
|
1113
|
+
}
|
|
1114
|
+
free() {
|
|
1115
|
+
const ptr = this.__destroy_into_raw();
|
|
1116
|
+
wasm.__wbg_encryptedkeyed_free(ptr, 0);
|
|
1117
|
+
}
|
|
1010
1118
|
/**
|
|
1011
1119
|
* The 32-byte application secret key used to encrypt this content.
|
|
1012
|
-
*
|
|
1013
|
-
* Lets the consumer build the external predecessor-secret chain and chain
|
|
1014
|
-
* further encryptions onto this blob.
|
|
1120
|
+
* Treat as secret: do not log or persist unencrypted.
|
|
1015
1121
|
* @returns {Uint8Array}
|
|
1016
1122
|
*/
|
|
1017
1123
|
get applicationSecret() {
|
|
1018
|
-
const ret = wasm.
|
|
1124
|
+
const ret = wasm.encryptedkeyed_applicationSecret(this.__wbg_ptr);
|
|
1019
1125
|
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
1020
1126
|
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
1021
1127
|
return v1;
|
|
@@ -1024,18 +1130,18 @@ export class EncryptedContentWithUpdate {
|
|
|
1024
1130
|
* @returns {Encrypted}
|
|
1025
1131
|
*/
|
|
1026
1132
|
encrypted_content() {
|
|
1027
|
-
const ret = wasm.
|
|
1133
|
+
const ret = wasm.encryptedkeyed_encrypted_content(this.__wbg_ptr);
|
|
1028
1134
|
return Encrypted.__wrap(ret);
|
|
1029
1135
|
}
|
|
1030
1136
|
/**
|
|
1031
1137
|
* @returns {SignedCgkaOperation | undefined}
|
|
1032
1138
|
*/
|
|
1033
1139
|
update_op() {
|
|
1034
|
-
const ret = wasm.
|
|
1140
|
+
const ret = wasm.encryptedkeyed_update_op(this.__wbg_ptr);
|
|
1035
1141
|
return ret === 0 ? undefined : SignedCgkaOperation.__wrap(ret);
|
|
1036
1142
|
}
|
|
1037
1143
|
}
|
|
1038
|
-
if (Symbol.dispose)
|
|
1144
|
+
if (Symbol.dispose) EncryptedKeyed.prototype[Symbol.dispose] = EncryptedKeyed.prototype.free;
|
|
1039
1145
|
|
|
1040
1146
|
export class Event {
|
|
1041
1147
|
static __wrap(ptr) {
|
|
@@ -1485,7 +1591,7 @@ export class Keyhive {
|
|
|
1485
1591
|
* @param {Membered} membered
|
|
1486
1592
|
* @param {Access} access
|
|
1487
1593
|
* @param {Document[]} other_relevant_docs
|
|
1488
|
-
* @returns {Promise<
|
|
1594
|
+
* @returns {Promise<SignedDelegation>}
|
|
1489
1595
|
*/
|
|
1490
1596
|
addMember(to_add, membered, access, other_relevant_docs) {
|
|
1491
1597
|
_assertClass(to_add, Agent);
|
|
@@ -1505,6 +1611,20 @@ export class Keyhive {
|
|
|
1505
1611
|
const ret = wasm.keyhive_allAgentEvents(this.__wbg_ptr);
|
|
1506
1612
|
return ret;
|
|
1507
1613
|
}
|
|
1614
|
+
/**
|
|
1615
|
+
* The most permissive of `id`'s direct access and the document's
|
|
1616
|
+
* public access. Returns undefined if neither grants access (or the
|
|
1617
|
+
* document is unknown).
|
|
1618
|
+
* @param {Identifier} id
|
|
1619
|
+
* @param {DocumentId} doc_id
|
|
1620
|
+
* @returns {Promise<Access | undefined>}
|
|
1621
|
+
*/
|
|
1622
|
+
bestAccessForDoc(id, doc_id) {
|
|
1623
|
+
_assertClass(id, Identifier);
|
|
1624
|
+
_assertClass(doc_id, DocumentId);
|
|
1625
|
+
const ret = wasm.keyhive_bestAccessForDoc(this.__wbg_ptr, id.__wbg_ptr, doc_id.__wbg_ptr);
|
|
1626
|
+
return ret;
|
|
1627
|
+
}
|
|
1508
1628
|
/**
|
|
1509
1629
|
* @returns {Promise<ContactCard>}
|
|
1510
1630
|
*/
|
|
@@ -1558,8 +1678,8 @@ export class Keyhive {
|
|
|
1558
1678
|
/**
|
|
1559
1679
|
* Force a PCS key rotation and return the new leaf secret, serialized as a
|
|
1560
1680
|
* one-entry `BTreeMap<ShareKey, ShareSecretKey>` (the exact format
|
|
1561
|
-
* `importPrekeySecrets` accepts).
|
|
1562
|
-
*
|
|
1681
|
+
* `importPrekeySecrets` accepts).
|
|
1682
|
+
* The returned bytes are secret key material: do not log or persist unencrypted.
|
|
1563
1683
|
* @param {Document} doc
|
|
1564
1684
|
* @returns {Promise<Uint8Array>}
|
|
1565
1685
|
*/
|
|
@@ -1569,8 +1689,6 @@ export class Keyhive {
|
|
|
1569
1689
|
return ret;
|
|
1570
1690
|
}
|
|
1571
1691
|
/**
|
|
1572
|
-
* Generate a document. Whether it provides forward secrecy is determined by
|
|
1573
|
-
* this peer's forward-secrecy policy (chosen at `Keyhive.init`).
|
|
1574
1692
|
* @param {Peer[]} coparents
|
|
1575
1693
|
* @param {ChangeId} initial_content_ref_head
|
|
1576
1694
|
* @param {ChangeId[]} more_initial_content_refs
|
|
@@ -1695,7 +1813,6 @@ export class Keyhive {
|
|
|
1695
1813
|
return ret;
|
|
1696
1814
|
}
|
|
1697
1815
|
/**
|
|
1698
|
-
* Initialize a peer.
|
|
1699
1816
|
* @param {Signer} signer
|
|
1700
1817
|
* @param {CiphertextStore} ciphertext_store
|
|
1701
1818
|
* @param {Function} event_handler
|
|
@@ -1804,17 +1921,14 @@ export class Keyhive {
|
|
|
1804
1921
|
}
|
|
1805
1922
|
/**
|
|
1806
1923
|
* Decrypt content and also return the 32-byte application secret key used.
|
|
1807
|
-
*
|
|
1808
|
-
* The consumer follows the external predecessor-secret chain from this key
|
|
1809
|
-
* with `Encrypted.decryptWithKey`, avoiding further CGKA dives.
|
|
1810
1924
|
* @param {Document} doc
|
|
1811
1925
|
* @param {Encrypted} encrypted
|
|
1812
|
-
* @returns {Promise<
|
|
1926
|
+
* @returns {Promise<DecryptedKeyed>}
|
|
1813
1927
|
*/
|
|
1814
|
-
|
|
1928
|
+
tryDecryptKeyed(doc, encrypted) {
|
|
1815
1929
|
_assertClass(doc, Document);
|
|
1816
1930
|
_assertClass(encrypted, Encrypted);
|
|
1817
|
-
const ret = wasm.
|
|
1931
|
+
const ret = wasm.keyhive_tryDecryptKeyed(this.__wbg_ptr, doc.__wbg_ptr, encrypted.__wbg_ptr);
|
|
1818
1932
|
return ret;
|
|
1819
1933
|
}
|
|
1820
1934
|
/**
|
|
@@ -1851,6 +1965,25 @@ export class Keyhive {
|
|
|
1851
1965
|
const ret = wasm.keyhive_tryEncryptArchive(this.__wbg_ptr, doc.__wbg_ptr, content_ref.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
1852
1966
|
return ret;
|
|
1853
1967
|
}
|
|
1968
|
+
/**
|
|
1969
|
+
* Encrypt content and also return the application secret key it was
|
|
1970
|
+
* encrypted under.
|
|
1971
|
+
* @param {Document} doc
|
|
1972
|
+
* @param {ChangeId} content_ref
|
|
1973
|
+
* @param {ChangeId[]} js_pred_refs
|
|
1974
|
+
* @param {Uint8Array} content
|
|
1975
|
+
* @returns {Promise<EncryptedKeyed>}
|
|
1976
|
+
*/
|
|
1977
|
+
tryEncryptKeyed(doc, content_ref, js_pred_refs, content) {
|
|
1978
|
+
_assertClass(doc, Document);
|
|
1979
|
+
_assertClass(content_ref, ChangeId);
|
|
1980
|
+
const ptr0 = passArrayJsValueToWasm0(js_pred_refs, wasm.__wbindgen_malloc);
|
|
1981
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1982
|
+
const ptr1 = passArray8ToWasm0(content, wasm.__wbindgen_malloc);
|
|
1983
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1984
|
+
const ret = wasm.keyhive_tryEncryptKeyed(this.__wbg_ptr, doc.__wbg_ptr, content_ref.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
1985
|
+
return ret;
|
|
1986
|
+
}
|
|
1854
1987
|
/**
|
|
1855
1988
|
* @param {Document} doc
|
|
1856
1989
|
* @returns {Promise<Uint8Array | undefined>}
|
|
@@ -2664,13 +2797,7 @@ export function symmetricDecrypt(key, blob) {
|
|
|
2664
2797
|
}
|
|
2665
2798
|
|
|
2666
2799
|
/**
|
|
2667
|
-
*
|
|
2668
|
-
*
|
|
2669
|
-
* `associated_data` flavors the synthetic nonce (e.g. the document or content
|
|
2670
|
-
* id) so identical plaintext under the same key in different contexts produces
|
|
2671
|
-
* distinct ciphertext. Returns `nonce(24) || ciphertext` (the ciphertext
|
|
2672
|
-
* includes the Poly1305 tag). The nonce is carried in the output, so
|
|
2673
|
-
* [`symmetric_decrypt`] does not need the associated data.
|
|
2800
|
+
* Encrypt `plaintext` under a 32-byte `key`, returning `nonce(24) || ciphertext`.
|
|
2674
2801
|
* @param {Uint8Array} key
|
|
2675
2802
|
* @param {Uint8Array} plaintext
|
|
2676
2803
|
* @param {Uint8Array} associated_data
|
|
@@ -2754,10 +2881,6 @@ function __wbg_get_imports() {
|
|
|
2754
2881
|
const ret = arg0.add(arg1);
|
|
2755
2882
|
return ret;
|
|
2756
2883
|
},
|
|
2757
|
-
__wbg_addmemberupdate_new: function(arg0) {
|
|
2758
|
-
const ret = AddMemberUpdate.__wrap(arg0);
|
|
2759
|
-
return ret;
|
|
2760
|
-
},
|
|
2761
2884
|
__wbg_agent_new: function(arg0) {
|
|
2762
2885
|
const ret = Agent.__wrap(arg0);
|
|
2763
2886
|
return ret;
|
|
@@ -2824,8 +2947,8 @@ function __wbg_get_imports() {
|
|
|
2824
2947
|
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
2825
2948
|
}
|
|
2826
2949
|
},
|
|
2827
|
-
|
|
2828
|
-
const ret =
|
|
2950
|
+
__wbg_decryptedkeyed_new: function(arg0) {
|
|
2951
|
+
const ret = DecryptedKeyed.__wrap(arg0);
|
|
2829
2952
|
return ret;
|
|
2830
2953
|
},
|
|
2831
2954
|
__wbg_doccontentrefs_new: function(arg0) {
|
|
@@ -2840,6 +2963,10 @@ function __wbg_get_imports() {
|
|
|
2840
2963
|
const ret = EncryptedContentWithUpdate.__wrap(arg0);
|
|
2841
2964
|
return ret;
|
|
2842
2965
|
},
|
|
2966
|
+
__wbg_encryptedkeyed_new: function(arg0) {
|
|
2967
|
+
const ret = EncryptedKeyed.__wrap(arg0);
|
|
2968
|
+
return ret;
|
|
2969
|
+
},
|
|
2843
2970
|
__wbg_error_8b62d3db440cf4a8: function(arg0, arg1) {
|
|
2844
2971
|
let deferred0_0;
|
|
2845
2972
|
let deferred0_1;
|
|
@@ -3022,7 +3149,7 @@ function __wbg_get_imports() {
|
|
|
3022
3149
|
const a = state0.a;
|
|
3023
3150
|
state0.a = 0;
|
|
3024
3151
|
try {
|
|
3025
|
-
return
|
|
3152
|
+
return wasm_bindgen__convert__closures_____invoke__h3240482818b7fa6b(a, state0.b, arg0, arg1);
|
|
3026
3153
|
} finally {
|
|
3027
3154
|
state0.a = a;
|
|
3028
3155
|
}
|
|
@@ -3175,8 +3302,8 @@ function __wbg_get_imports() {
|
|
|
3175
3302
|
}
|
|
3176
3303
|
},
|
|
3177
3304
|
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
3178
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx:
|
|
3179
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
3305
|
+
// 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`.
|
|
3306
|
+
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h264249ebd10d2c4e);
|
|
3180
3307
|
return ret;
|
|
3181
3308
|
},
|
|
3182
3309
|
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
@@ -3261,23 +3388,20 @@ function __wbg_get_imports() {
|
|
|
3261
3388
|
};
|
|
3262
3389
|
}
|
|
3263
3390
|
|
|
3264
|
-
function
|
|
3265
|
-
const ret = wasm.
|
|
3391
|
+
function wasm_bindgen__convert__closures_____invoke__h264249ebd10d2c4e(arg0, arg1, arg2) {
|
|
3392
|
+
const ret = wasm.wasm_bindgen__convert__closures_____invoke__h264249ebd10d2c4e(arg0, arg1, arg2);
|
|
3266
3393
|
if (ret[1]) {
|
|
3267
3394
|
throw takeFromExternrefTable0(ret[0]);
|
|
3268
3395
|
}
|
|
3269
3396
|
}
|
|
3270
3397
|
|
|
3271
|
-
function
|
|
3272
|
-
wasm.
|
|
3398
|
+
function wasm_bindgen__convert__closures_____invoke__h3240482818b7fa6b(arg0, arg1, arg2, arg3) {
|
|
3399
|
+
wasm.wasm_bindgen__convert__closures_____invoke__h3240482818b7fa6b(arg0, arg1, arg2, arg3);
|
|
3273
3400
|
}
|
|
3274
3401
|
|
|
3275
3402
|
const AccessFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
3276
3403
|
? { register: () => {}, unregister: () => {} }
|
|
3277
3404
|
: new FinalizationRegistry(ptr => wasm.__wbg_access_free(ptr, 1));
|
|
3278
|
-
const AddMemberUpdateFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
3279
|
-
? { register: () => {}, unregister: () => {} }
|
|
3280
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_addmemberupdate_free(ptr, 1));
|
|
3281
3405
|
const AgentFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
3282
3406
|
? { register: () => {}, unregister: () => {} }
|
|
3283
3407
|
: new FinalizationRegistry(ptr => wasm.__wbg_agent_free(ptr, 1));
|
|
@@ -3308,9 +3432,9 @@ const CiphertextStoreFinalization = (typeof FinalizationRegistry === 'undefined'
|
|
|
3308
3432
|
const ContactCardFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
3309
3433
|
? { register: () => {}, unregister: () => {} }
|
|
3310
3434
|
: new FinalizationRegistry(ptr => wasm.__wbg_contactcard_free(ptr, 1));
|
|
3311
|
-
const
|
|
3435
|
+
const DecryptedKeyedFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
3312
3436
|
? { register: () => {}, unregister: () => {} }
|
|
3313
|
-
: new FinalizationRegistry(ptr => wasm.
|
|
3437
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_decryptedkeyed_free(ptr, 1));
|
|
3314
3438
|
const DelegationFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
3315
3439
|
? { register: () => {}, unregister: () => {} }
|
|
3316
3440
|
: new FinalizationRegistry(ptr => wasm.__wbg_delegation_free(ptr, 1));
|
|
@@ -3329,6 +3453,9 @@ const EncryptedFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
|
3329
3453
|
const EncryptedContentWithUpdateFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
3330
3454
|
? { register: () => {}, unregister: () => {} }
|
|
3331
3455
|
: new FinalizationRegistry(ptr => wasm.__wbg_encryptedcontentwithupdate_free(ptr, 1));
|
|
3456
|
+
const EncryptedKeyedFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
3457
|
+
? { register: () => {}, unregister: () => {} }
|
|
3458
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_encryptedkeyed_free(ptr, 1));
|
|
3332
3459
|
const EventFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
3333
3460
|
? { register: () => {}, unregister: () => {} }
|
|
3334
3461
|
: new FinalizationRegistry(ptr => wasm.__wbg_event_free(ptr, 1));
|
|
Binary file
|