@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/keyhive_wasm_bg.js
CHANGED
|
@@ -15,6 +15,108 @@ export class Access {
|
|
|
15
15
|
const ptr = this.__destroy_into_raw();
|
|
16
16
|
wasm.__wbg_access_free(ptr, 0);
|
|
17
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* The ability to revoke any members of a group, not just those that they have causal senority over.
|
|
20
|
+
* @returns {Access}
|
|
21
|
+
*/
|
|
22
|
+
static admin() {
|
|
23
|
+
const ret = wasm.access_admin();
|
|
24
|
+
return Access.__wrap(ret);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* True if this level is at least as permissive as `other`.
|
|
28
|
+
* @param {Access} other
|
|
29
|
+
* @returns {boolean}
|
|
30
|
+
*/
|
|
31
|
+
atLeast(other) {
|
|
32
|
+
_assertClass(other, Access);
|
|
33
|
+
const ret = wasm.access_atLeast(this.__wbg_ptr, other.__wbg_ptr);
|
|
34
|
+
return ret !== 0;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Standard comparator result: -1 if less permissive than `other`,
|
|
38
|
+
* 0 if equal, 1 if more permissive.
|
|
39
|
+
* @param {Access} other
|
|
40
|
+
* @returns {number}
|
|
41
|
+
*/
|
|
42
|
+
compareTo(other) {
|
|
43
|
+
_assertClass(other, Access);
|
|
44
|
+
const ret = wasm.access_compareTo(this.__wbg_ptr, other.__wbg_ptr);
|
|
45
|
+
return ret;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* The ability to edit (append ops to) the content of a document.
|
|
49
|
+
* @returns {Access}
|
|
50
|
+
*/
|
|
51
|
+
static edit() {
|
|
52
|
+
const ret = wasm.access_edit();
|
|
53
|
+
return Access.__wrap(ret);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* @param {Access} other
|
|
57
|
+
* @returns {boolean}
|
|
58
|
+
*/
|
|
59
|
+
equals(other) {
|
|
60
|
+
_assertClass(other, Access);
|
|
61
|
+
const ret = wasm.access_equals(this.__wbg_ptr, other.__wbg_ptr);
|
|
62
|
+
return ret !== 0;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Parse an access level, throwing on invalid input.
|
|
66
|
+
* Accepts "relay", "read", "edit", or "admin" (case-insensitive).
|
|
67
|
+
* @param {string} s
|
|
68
|
+
* @returns {Access}
|
|
69
|
+
*/
|
|
70
|
+
static fromString(s) {
|
|
71
|
+
const ptr0 = passStringToWasm0(s, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
72
|
+
const len0 = WASM_VECTOR_LEN;
|
|
73
|
+
const ret = wasm.access_fromString(ptr0, len0);
|
|
74
|
+
if (ret[2]) {
|
|
75
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
76
|
+
}
|
|
77
|
+
return Access.__wrap(ret[0]);
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* True for Edit access or higher.
|
|
81
|
+
* @returns {boolean}
|
|
82
|
+
*/
|
|
83
|
+
get isEditor() {
|
|
84
|
+
const ret = wasm.access_isEditor(this.__wbg_ptr);
|
|
85
|
+
return ret !== 0;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* True for Read access or higher.
|
|
89
|
+
* @returns {boolean}
|
|
90
|
+
*/
|
|
91
|
+
get isReader() {
|
|
92
|
+
const ret = wasm.access_isReader(this.__wbg_ptr);
|
|
93
|
+
return ret !== 0;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Numeric level for ordering: Relay = 0, Read = 1, Edit = 2, Admin = 3.
|
|
97
|
+
* Higher levels imply all lower levels.
|
|
98
|
+
* @returns {number}
|
|
99
|
+
*/
|
|
100
|
+
get level() {
|
|
101
|
+
const ret = wasm.access_level(this.__wbg_ptr);
|
|
102
|
+
return ret;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* The ability to read (decrypt) the content of a document.
|
|
106
|
+
* @returns {Access}
|
|
107
|
+
*/
|
|
108
|
+
static read() {
|
|
109
|
+
const ret = wasm.access_read();
|
|
110
|
+
return Access.__wrap(ret);
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* The ability to retrieve bytes over the network.
|
|
114
|
+
* @returns {Access}
|
|
115
|
+
*/
|
|
116
|
+
static relay() {
|
|
117
|
+
const ret = wasm.access_relay();
|
|
118
|
+
return Access.__wrap(ret);
|
|
119
|
+
}
|
|
18
120
|
/**
|
|
19
121
|
* @returns {string}
|
|
20
122
|
*/
|
|
@@ -31,6 +133,8 @@ export class Access {
|
|
|
31
133
|
}
|
|
32
134
|
}
|
|
33
135
|
/**
|
|
136
|
+
* Parse an access level, returning undefined on invalid input.
|
|
137
|
+
* Prefer `fromString`, which throws a descriptive error instead.
|
|
34
138
|
* @param {string} s
|
|
35
139
|
* @returns {Access | undefined}
|
|
36
140
|
*/
|
|
@@ -43,36 +147,6 @@ export class Access {
|
|
|
43
147
|
}
|
|
44
148
|
if (Symbol.dispose) Access.prototype[Symbol.dispose] = Access.prototype.free;
|
|
45
149
|
|
|
46
|
-
/**
|
|
47
|
-
* The result of adding a member: the membership delegation.
|
|
48
|
-
*/
|
|
49
|
-
export class AddMemberUpdate {
|
|
50
|
-
static __wrap(ptr) {
|
|
51
|
-
const obj = Object.create(AddMemberUpdate.prototype);
|
|
52
|
-
obj.__wbg_ptr = ptr;
|
|
53
|
-
AddMemberUpdateFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
54
|
-
return obj;
|
|
55
|
-
}
|
|
56
|
-
__destroy_into_raw() {
|
|
57
|
-
const ptr = this.__wbg_ptr;
|
|
58
|
-
this.__wbg_ptr = 0;
|
|
59
|
-
AddMemberUpdateFinalization.unregister(this);
|
|
60
|
-
return ptr;
|
|
61
|
-
}
|
|
62
|
-
free() {
|
|
63
|
-
const ptr = this.__destroy_into_raw();
|
|
64
|
-
wasm.__wbg_addmemberupdate_free(ptr, 0);
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* @returns {SignedDelegation}
|
|
68
|
-
*/
|
|
69
|
-
get delegation() {
|
|
70
|
-
const ret = wasm.addmemberupdate_delegation(this.__wbg_ptr);
|
|
71
|
-
return SignedDelegation.__wrap(ret);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
if (Symbol.dispose) AddMemberUpdate.prototype[Symbol.dispose] = AddMemberUpdate.prototype.free;
|
|
75
|
-
|
|
76
150
|
export class Agent {
|
|
77
151
|
static __wrap(ptr) {
|
|
78
152
|
const obj = Object.create(Agent.prototype);
|
|
@@ -584,33 +658,31 @@ if (Symbol.dispose) ContactCard.prototype[Symbol.dispose] = ContactCard.prototyp
|
|
|
584
658
|
|
|
585
659
|
/**
|
|
586
660
|
* Plaintext plus the application secret key that decrypted it.
|
|
587
|
-
*
|
|
588
|
-
* The key lets the consumer recover the blob's external predecessor-secret
|
|
589
|
-
* chain and chain further encryptions onto it, without re-entering CGKA.
|
|
590
661
|
*/
|
|
591
|
-
export class
|
|
662
|
+
export class DecryptedKeyed {
|
|
592
663
|
static __wrap(ptr) {
|
|
593
|
-
const obj = Object.create(
|
|
664
|
+
const obj = Object.create(DecryptedKeyed.prototype);
|
|
594
665
|
obj.__wbg_ptr = ptr;
|
|
595
|
-
|
|
666
|
+
DecryptedKeyedFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
596
667
|
return obj;
|
|
597
668
|
}
|
|
598
669
|
__destroy_into_raw() {
|
|
599
670
|
const ptr = this.__wbg_ptr;
|
|
600
671
|
this.__wbg_ptr = 0;
|
|
601
|
-
|
|
672
|
+
DecryptedKeyedFinalization.unregister(this);
|
|
602
673
|
return ptr;
|
|
603
674
|
}
|
|
604
675
|
free() {
|
|
605
676
|
const ptr = this.__destroy_into_raw();
|
|
606
|
-
wasm.
|
|
677
|
+
wasm.__wbg_decryptedkeyed_free(ptr, 0);
|
|
607
678
|
}
|
|
608
679
|
/**
|
|
609
680
|
* The 32-byte application secret key used to decrypt this content.
|
|
681
|
+
* Treat as secret: do not log or persist unencrypted.
|
|
610
682
|
* @returns {Uint8Array}
|
|
611
683
|
*/
|
|
612
684
|
get applicationSecret() {
|
|
613
|
-
const ret = wasm.
|
|
685
|
+
const ret = wasm.decryptedkeyed_applicationSecret(this.__wbg_ptr);
|
|
614
686
|
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
615
687
|
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
616
688
|
return v1;
|
|
@@ -619,13 +691,13 @@ export class DecryptedWithKey {
|
|
|
619
691
|
* @returns {Uint8Array}
|
|
620
692
|
*/
|
|
621
693
|
get plaintext() {
|
|
622
|
-
const ret = wasm.
|
|
694
|
+
const ret = wasm.decryptedkeyed_plaintext(this.__wbg_ptr);
|
|
623
695
|
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
624
696
|
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
625
697
|
return v1;
|
|
626
698
|
}
|
|
627
699
|
}
|
|
628
|
-
if (Symbol.dispose)
|
|
700
|
+
if (Symbol.dispose) DecryptedKeyed.prototype[Symbol.dispose] = DecryptedKeyed.prototype.free;
|
|
629
701
|
|
|
630
702
|
export class Delegation {
|
|
631
703
|
static __wrap(ptr) {
|
|
@@ -908,8 +980,7 @@ export class Encrypted {
|
|
|
908
980
|
}
|
|
909
981
|
/**
|
|
910
982
|
* Decrypt this content with an explicit 32-byte application secret key,
|
|
911
|
-
* bypassing CGKA.
|
|
912
|
-
* predecessor-secret chain once it has recovered a blob's key.
|
|
983
|
+
* bypassing CGKA.
|
|
913
984
|
* @param {Uint8Array} key
|
|
914
985
|
* @returns {Uint8Array}
|
|
915
986
|
*/
|
|
@@ -1005,15 +1076,50 @@ export class EncryptedContentWithUpdate {
|
|
|
1005
1076
|
const ptr = this.__destroy_into_raw();
|
|
1006
1077
|
wasm.__wbg_encryptedcontentwithupdate_free(ptr, 0);
|
|
1007
1078
|
}
|
|
1079
|
+
/**
|
|
1080
|
+
* @returns {Encrypted}
|
|
1081
|
+
*/
|
|
1082
|
+
encrypted_content() {
|
|
1083
|
+
const ret = wasm.encryptedcontentwithupdate_encrypted_content(this.__wbg_ptr);
|
|
1084
|
+
return Encrypted.__wrap(ret);
|
|
1085
|
+
}
|
|
1086
|
+
/**
|
|
1087
|
+
* @returns {SignedCgkaOperation | undefined}
|
|
1088
|
+
*/
|
|
1089
|
+
update_op() {
|
|
1090
|
+
const ret = wasm.encryptedcontentwithupdate_update_op(this.__wbg_ptr);
|
|
1091
|
+
return ret === 0 ? undefined : SignedCgkaOperation.__wrap(ret);
|
|
1092
|
+
}
|
|
1093
|
+
}
|
|
1094
|
+
if (Symbol.dispose) EncryptedContentWithUpdate.prototype[Symbol.dispose] = EncryptedContentWithUpdate.prototype.free;
|
|
1095
|
+
|
|
1096
|
+
/**
|
|
1097
|
+
* Encrypted content plus the application secret key it was encrypted under.
|
|
1098
|
+
*/
|
|
1099
|
+
export class EncryptedKeyed {
|
|
1100
|
+
static __wrap(ptr) {
|
|
1101
|
+
const obj = Object.create(EncryptedKeyed.prototype);
|
|
1102
|
+
obj.__wbg_ptr = ptr;
|
|
1103
|
+
EncryptedKeyedFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1104
|
+
return obj;
|
|
1105
|
+
}
|
|
1106
|
+
__destroy_into_raw() {
|
|
1107
|
+
const ptr = this.__wbg_ptr;
|
|
1108
|
+
this.__wbg_ptr = 0;
|
|
1109
|
+
EncryptedKeyedFinalization.unregister(this);
|
|
1110
|
+
return ptr;
|
|
1111
|
+
}
|
|
1112
|
+
free() {
|
|
1113
|
+
const ptr = this.__destroy_into_raw();
|
|
1114
|
+
wasm.__wbg_encryptedkeyed_free(ptr, 0);
|
|
1115
|
+
}
|
|
1008
1116
|
/**
|
|
1009
1117
|
* The 32-byte application secret key used to encrypt this content.
|
|
1010
|
-
*
|
|
1011
|
-
* Lets the consumer build the external predecessor-secret chain and chain
|
|
1012
|
-
* further encryptions onto this blob.
|
|
1118
|
+
* Treat as secret: do not log or persist unencrypted.
|
|
1013
1119
|
* @returns {Uint8Array}
|
|
1014
1120
|
*/
|
|
1015
1121
|
get applicationSecret() {
|
|
1016
|
-
const ret = wasm.
|
|
1122
|
+
const ret = wasm.encryptedkeyed_applicationSecret(this.__wbg_ptr);
|
|
1017
1123
|
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
1018
1124
|
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
1019
1125
|
return v1;
|
|
@@ -1022,18 +1128,18 @@ export class EncryptedContentWithUpdate {
|
|
|
1022
1128
|
* @returns {Encrypted}
|
|
1023
1129
|
*/
|
|
1024
1130
|
encrypted_content() {
|
|
1025
|
-
const ret = wasm.
|
|
1131
|
+
const ret = wasm.encryptedkeyed_encrypted_content(this.__wbg_ptr);
|
|
1026
1132
|
return Encrypted.__wrap(ret);
|
|
1027
1133
|
}
|
|
1028
1134
|
/**
|
|
1029
1135
|
* @returns {SignedCgkaOperation | undefined}
|
|
1030
1136
|
*/
|
|
1031
1137
|
update_op() {
|
|
1032
|
-
const ret = wasm.
|
|
1138
|
+
const ret = wasm.encryptedkeyed_update_op(this.__wbg_ptr);
|
|
1033
1139
|
return ret === 0 ? undefined : SignedCgkaOperation.__wrap(ret);
|
|
1034
1140
|
}
|
|
1035
1141
|
}
|
|
1036
|
-
if (Symbol.dispose)
|
|
1142
|
+
if (Symbol.dispose) EncryptedKeyed.prototype[Symbol.dispose] = EncryptedKeyed.prototype.free;
|
|
1037
1143
|
|
|
1038
1144
|
export class Event {
|
|
1039
1145
|
static __wrap(ptr) {
|
|
@@ -1483,7 +1589,7 @@ export class Keyhive {
|
|
|
1483
1589
|
* @param {Membered} membered
|
|
1484
1590
|
* @param {Access} access
|
|
1485
1591
|
* @param {Document[]} other_relevant_docs
|
|
1486
|
-
* @returns {Promise<
|
|
1592
|
+
* @returns {Promise<SignedDelegation>}
|
|
1487
1593
|
*/
|
|
1488
1594
|
addMember(to_add, membered, access, other_relevant_docs) {
|
|
1489
1595
|
_assertClass(to_add, Agent);
|
|
@@ -1503,6 +1609,20 @@ export class Keyhive {
|
|
|
1503
1609
|
const ret = wasm.keyhive_allAgentEvents(this.__wbg_ptr);
|
|
1504
1610
|
return ret;
|
|
1505
1611
|
}
|
|
1612
|
+
/**
|
|
1613
|
+
* The most permissive of `id`'s direct access and the document's
|
|
1614
|
+
* public access. Returns undefined if neither grants access (or the
|
|
1615
|
+
* document is unknown).
|
|
1616
|
+
* @param {Identifier} id
|
|
1617
|
+
* @param {DocumentId} doc_id
|
|
1618
|
+
* @returns {Promise<Access | undefined>}
|
|
1619
|
+
*/
|
|
1620
|
+
bestAccessForDoc(id, doc_id) {
|
|
1621
|
+
_assertClass(id, Identifier);
|
|
1622
|
+
_assertClass(doc_id, DocumentId);
|
|
1623
|
+
const ret = wasm.keyhive_bestAccessForDoc(this.__wbg_ptr, id.__wbg_ptr, doc_id.__wbg_ptr);
|
|
1624
|
+
return ret;
|
|
1625
|
+
}
|
|
1506
1626
|
/**
|
|
1507
1627
|
* @returns {Promise<ContactCard>}
|
|
1508
1628
|
*/
|
|
@@ -1556,8 +1676,8 @@ export class Keyhive {
|
|
|
1556
1676
|
/**
|
|
1557
1677
|
* Force a PCS key rotation and return the new leaf secret, serialized as a
|
|
1558
1678
|
* one-entry `BTreeMap<ShareKey, ShareSecretKey>` (the exact format
|
|
1559
|
-
* `importPrekeySecrets` accepts).
|
|
1560
|
-
*
|
|
1679
|
+
* `importPrekeySecrets` accepts).
|
|
1680
|
+
* The returned bytes are secret key material: do not log or persist unencrypted.
|
|
1561
1681
|
* @param {Document} doc
|
|
1562
1682
|
* @returns {Promise<Uint8Array>}
|
|
1563
1683
|
*/
|
|
@@ -1567,8 +1687,6 @@ export class Keyhive {
|
|
|
1567
1687
|
return ret;
|
|
1568
1688
|
}
|
|
1569
1689
|
/**
|
|
1570
|
-
* Generate a document. Whether it provides forward secrecy is determined by
|
|
1571
|
-
* this peer's forward-secrecy policy (chosen at `Keyhive.init`).
|
|
1572
1690
|
* @param {Peer[]} coparents
|
|
1573
1691
|
* @param {ChangeId} initial_content_ref_head
|
|
1574
1692
|
* @param {ChangeId[]} more_initial_content_refs
|
|
@@ -1693,7 +1811,6 @@ export class Keyhive {
|
|
|
1693
1811
|
return ret;
|
|
1694
1812
|
}
|
|
1695
1813
|
/**
|
|
1696
|
-
* Initialize a peer.
|
|
1697
1814
|
* @param {Signer} signer
|
|
1698
1815
|
* @param {CiphertextStore} ciphertext_store
|
|
1699
1816
|
* @param {Function} event_handler
|
|
@@ -1802,17 +1919,14 @@ export class Keyhive {
|
|
|
1802
1919
|
}
|
|
1803
1920
|
/**
|
|
1804
1921
|
* Decrypt content and also return the 32-byte application secret key used.
|
|
1805
|
-
*
|
|
1806
|
-
* The consumer follows the external predecessor-secret chain from this key
|
|
1807
|
-
* with `Encrypted.decryptWithKey`, avoiding further CGKA dives.
|
|
1808
1922
|
* @param {Document} doc
|
|
1809
1923
|
* @param {Encrypted} encrypted
|
|
1810
|
-
* @returns {Promise<
|
|
1924
|
+
* @returns {Promise<DecryptedKeyed>}
|
|
1811
1925
|
*/
|
|
1812
|
-
|
|
1926
|
+
tryDecryptKeyed(doc, encrypted) {
|
|
1813
1927
|
_assertClass(doc, Document);
|
|
1814
1928
|
_assertClass(encrypted, Encrypted);
|
|
1815
|
-
const ret = wasm.
|
|
1929
|
+
const ret = wasm.keyhive_tryDecryptKeyed(this.__wbg_ptr, doc.__wbg_ptr, encrypted.__wbg_ptr);
|
|
1816
1930
|
return ret;
|
|
1817
1931
|
}
|
|
1818
1932
|
/**
|
|
@@ -1849,6 +1963,25 @@ export class Keyhive {
|
|
|
1849
1963
|
const ret = wasm.keyhive_tryEncryptArchive(this.__wbg_ptr, doc.__wbg_ptr, content_ref.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
1850
1964
|
return ret;
|
|
1851
1965
|
}
|
|
1966
|
+
/**
|
|
1967
|
+
* Encrypt content and also return the application secret key it was
|
|
1968
|
+
* encrypted under.
|
|
1969
|
+
* @param {Document} doc
|
|
1970
|
+
* @param {ChangeId} content_ref
|
|
1971
|
+
* @param {ChangeId[]} js_pred_refs
|
|
1972
|
+
* @param {Uint8Array} content
|
|
1973
|
+
* @returns {Promise<EncryptedKeyed>}
|
|
1974
|
+
*/
|
|
1975
|
+
tryEncryptKeyed(doc, content_ref, js_pred_refs, content) {
|
|
1976
|
+
_assertClass(doc, Document);
|
|
1977
|
+
_assertClass(content_ref, ChangeId);
|
|
1978
|
+
const ptr0 = passArrayJsValueToWasm0(js_pred_refs, wasm.__wbindgen_malloc);
|
|
1979
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1980
|
+
const ptr1 = passArray8ToWasm0(content, wasm.__wbindgen_malloc);
|
|
1981
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1982
|
+
const ret = wasm.keyhive_tryEncryptKeyed(this.__wbg_ptr, doc.__wbg_ptr, content_ref.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
1983
|
+
return ret;
|
|
1984
|
+
}
|
|
1852
1985
|
/**
|
|
1853
1986
|
* @param {Document} doc
|
|
1854
1987
|
* @returns {Promise<Uint8Array | undefined>}
|
|
@@ -2662,13 +2795,7 @@ export function symmetricDecrypt(key, blob) {
|
|
|
2662
2795
|
}
|
|
2663
2796
|
|
|
2664
2797
|
/**
|
|
2665
|
-
*
|
|
2666
|
-
*
|
|
2667
|
-
* `associated_data` flavors the synthetic nonce (e.g. the document or content
|
|
2668
|
-
* id) so identical plaintext under the same key in different contexts produces
|
|
2669
|
-
* distinct ciphertext. Returns `nonce(24) || ciphertext` (the ciphertext
|
|
2670
|
-
* includes the Poly1305 tag). The nonce is carried in the output, so
|
|
2671
|
-
* [`symmetric_decrypt`] does not need the associated data.
|
|
2798
|
+
* Encrypt `plaintext` under a 32-byte `key`, returning `nonce(24) || ciphertext`.
|
|
2672
2799
|
* @param {Uint8Array} key
|
|
2673
2800
|
* @param {Uint8Array} plaintext
|
|
2674
2801
|
* @param {Uint8Array} associated_data
|
|
@@ -2749,10 +2876,6 @@ export function __wbg_add_6c7b67a080be853e(arg0, arg1) {
|
|
|
2749
2876
|
const ret = arg0.add(arg1);
|
|
2750
2877
|
return ret;
|
|
2751
2878
|
}
|
|
2752
|
-
export function __wbg_addmemberupdate_new(arg0) {
|
|
2753
|
-
const ret = AddMemberUpdate.__wrap(arg0);
|
|
2754
|
-
return ret;
|
|
2755
|
-
}
|
|
2756
2879
|
export function __wbg_agent_new(arg0) {
|
|
2757
2880
|
const ret = Agent.__wrap(arg0);
|
|
2758
2881
|
return ret;
|
|
@@ -2819,8 +2942,8 @@ export function __wbg_debug_3003e89da631cad7(arg0, arg1) {
|
|
|
2819
2942
|
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
2820
2943
|
}
|
|
2821
2944
|
}
|
|
2822
|
-
export function
|
|
2823
|
-
const ret =
|
|
2945
|
+
export function __wbg_decryptedkeyed_new(arg0) {
|
|
2946
|
+
const ret = DecryptedKeyed.__wrap(arg0);
|
|
2824
2947
|
return ret;
|
|
2825
2948
|
}
|
|
2826
2949
|
export function __wbg_doccontentrefs_new(arg0) {
|
|
@@ -2835,6 +2958,10 @@ export function __wbg_encryptedcontentwithupdate_new(arg0) {
|
|
|
2835
2958
|
const ret = EncryptedContentWithUpdate.__wrap(arg0);
|
|
2836
2959
|
return ret;
|
|
2837
2960
|
}
|
|
2961
|
+
export function __wbg_encryptedkeyed_new(arg0) {
|
|
2962
|
+
const ret = EncryptedKeyed.__wrap(arg0);
|
|
2963
|
+
return ret;
|
|
2964
|
+
}
|
|
2838
2965
|
export function __wbg_error_8b62d3db440cf4a8(arg0, arg1) {
|
|
2839
2966
|
let deferred0_0;
|
|
2840
2967
|
let deferred0_1;
|
|
@@ -3017,7 +3144,7 @@ export function __wbg_new_typed_1824d93f294193e5(arg0, arg1) {
|
|
|
3017
3144
|
const a = state0.a;
|
|
3018
3145
|
state0.a = 0;
|
|
3019
3146
|
try {
|
|
3020
|
-
return
|
|
3147
|
+
return wasm_bindgen__convert__closures_____invoke__h3240482818b7fa6b(a, state0.b, arg0, arg1);
|
|
3021
3148
|
} finally {
|
|
3022
3149
|
state0.a = a;
|
|
3023
3150
|
}
|
|
@@ -3170,8 +3297,8 @@ export function __wbg_warn_9d7408e9659996aa(arg0, arg1, arg2, arg3, arg4, arg5,
|
|
|
3170
3297
|
}
|
|
3171
3298
|
}
|
|
3172
3299
|
export function __wbindgen_cast_0000000000000001(arg0, arg1) {
|
|
3173
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx:
|
|
3174
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
3300
|
+
// 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`.
|
|
3301
|
+
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h264249ebd10d2c4e);
|
|
3175
3302
|
return ret;
|
|
3176
3303
|
}
|
|
3177
3304
|
export function __wbindgen_cast_0000000000000002(arg0, arg1) {
|
|
@@ -3249,23 +3376,20 @@ export function __wbindgen_init_externref_table() {
|
|
|
3249
3376
|
table.set(offset + 2, true);
|
|
3250
3377
|
table.set(offset + 3, false);
|
|
3251
3378
|
}
|
|
3252
|
-
function
|
|
3253
|
-
const ret = wasm.
|
|
3379
|
+
function wasm_bindgen__convert__closures_____invoke__h264249ebd10d2c4e(arg0, arg1, arg2) {
|
|
3380
|
+
const ret = wasm.wasm_bindgen__convert__closures_____invoke__h264249ebd10d2c4e(arg0, arg1, arg2);
|
|
3254
3381
|
if (ret[1]) {
|
|
3255
3382
|
throw takeFromExternrefTable0(ret[0]);
|
|
3256
3383
|
}
|
|
3257
3384
|
}
|
|
3258
3385
|
|
|
3259
|
-
function
|
|
3260
|
-
wasm.
|
|
3386
|
+
function wasm_bindgen__convert__closures_____invoke__h3240482818b7fa6b(arg0, arg1, arg2, arg3) {
|
|
3387
|
+
wasm.wasm_bindgen__convert__closures_____invoke__h3240482818b7fa6b(arg0, arg1, arg2, arg3);
|
|
3261
3388
|
}
|
|
3262
3389
|
|
|
3263
3390
|
const AccessFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
3264
3391
|
? { register: () => {}, unregister: () => {} }
|
|
3265
3392
|
: new FinalizationRegistry(ptr => wasm.__wbg_access_free(ptr, 1));
|
|
3266
|
-
const AddMemberUpdateFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
3267
|
-
? { register: () => {}, unregister: () => {} }
|
|
3268
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_addmemberupdate_free(ptr, 1));
|
|
3269
3393
|
const AgentFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
3270
3394
|
? { register: () => {}, unregister: () => {} }
|
|
3271
3395
|
: new FinalizationRegistry(ptr => wasm.__wbg_agent_free(ptr, 1));
|
|
@@ -3296,9 +3420,9 @@ const CiphertextStoreFinalization = (typeof FinalizationRegistry === 'undefined'
|
|
|
3296
3420
|
const ContactCardFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
3297
3421
|
? { register: () => {}, unregister: () => {} }
|
|
3298
3422
|
: new FinalizationRegistry(ptr => wasm.__wbg_contactcard_free(ptr, 1));
|
|
3299
|
-
const
|
|
3423
|
+
const DecryptedKeyedFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
3300
3424
|
? { register: () => {}, unregister: () => {} }
|
|
3301
|
-
: new FinalizationRegistry(ptr => wasm.
|
|
3425
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_decryptedkeyed_free(ptr, 1));
|
|
3302
3426
|
const DelegationFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
3303
3427
|
? { register: () => {}, unregister: () => {} }
|
|
3304
3428
|
: new FinalizationRegistry(ptr => wasm.__wbg_delegation_free(ptr, 1));
|
|
@@ -3317,6 +3441,9 @@ const EncryptedFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
|
3317
3441
|
const EncryptedContentWithUpdateFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
3318
3442
|
? { register: () => {}, unregister: () => {} }
|
|
3319
3443
|
: new FinalizationRegistry(ptr => wasm.__wbg_encryptedcontentwithupdate_free(ptr, 1));
|
|
3444
|
+
const EncryptedKeyedFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
3445
|
+
? { register: () => {}, unregister: () => {} }
|
|
3446
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_encryptedkeyed_free(ptr, 1));
|
|
3320
3447
|
const EventFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
3321
3448
|
? { register: () => {}, unregister: () => {} }
|
|
3322
3449
|
: new FinalizationRegistry(ptr => wasm.__wbg_event_free(ptr, 1));
|
package/pkg/keyhive_wasm_bg.wasm
CHANGED
|
Binary file
|