@keyhive/keyhive 0.0.0-alpha.9 → 0.1.0-alpha.2
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 +6 -5
- package/pkg/keyhive_wasm.d.ts +464 -352
- package/pkg/keyhive_wasm.js +5 -1
- package/pkg/keyhive_wasm_bg.js +1805 -1814
- package/pkg/keyhive_wasm_bg.wasm +0 -0
- package/pkg/keyhive_wasm_bg.wasm.d.ts +214 -173
- package/pkg/package.json +3 -3
- package/pkg-node/keyhive_wasm.d.ts +464 -352
- package/pkg-node/keyhive_wasm.js +2056 -2117
- package/pkg-node/keyhive_wasm_bg.wasm +0 -0
- package/pkg-node/keyhive_wasm_bg.wasm.d.ts +214 -173
- package/pkg-node/package.json +3 -3
- package/pkg-slim/keyhive_wasm.d.ts +706 -552
- package/pkg-slim/keyhive_wasm.js +2079 -2013
- 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 +214 -173
- package/pkg-slim/package.json +3 -3
package/pkg/keyhive_wasm.d.ts
CHANGED
|
@@ -1,404 +1,516 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
-
|
|
4
|
-
* Panic hook lets us get better error messages if our Rust code ever panics.
|
|
5
|
-
*
|
|
6
|
-
* This function needs to be called at least once during initialisation.
|
|
7
|
-
* https://rustwasm.github.io/docs/wasm-pack/tutorials/npm-browser-packages/template-deep-dive/src-utils-rs.html#2-what-is-console_error_panic_hook
|
|
8
|
-
*/
|
|
9
|
-
export function setPanicHook(): void;
|
|
3
|
+
|
|
10
4
|
export class Access {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
export class AddMemberError {
|
|
18
|
-
private constructor();
|
|
19
|
-
free(): void;
|
|
20
|
-
[Symbol.dispose](): void;
|
|
21
|
-
message(): string;
|
|
5
|
+
private constructor();
|
|
6
|
+
free(): void;
|
|
7
|
+
[Symbol.dispose](): void;
|
|
8
|
+
toString(): string;
|
|
9
|
+
static tryFromString(s: string): Access | undefined;
|
|
22
10
|
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* The result of adding a member: the membership delegation, plus any new leaf
|
|
14
|
+
* secrets produced by auto-rekeying a non-forward-secret document on add.
|
|
15
|
+
*/
|
|
16
|
+
export class AddMemberUpdate {
|
|
17
|
+
private constructor();
|
|
18
|
+
free(): void;
|
|
19
|
+
[Symbol.dispose](): void;
|
|
20
|
+
readonly delegation: SignedDelegation;
|
|
21
|
+
/**
|
|
22
|
+
* New leaf secret keypairs from auto-rekeying a non-forward-secret document
|
|
23
|
+
* when this reader was added, serialized as a
|
|
24
|
+
* `BTreeMap<ShareKey, ShareSecretKey>` (the format `importPrekeySecrets`
|
|
25
|
+
* accepts). A sibling instance of this identity (e.g. a tab and its
|
|
26
|
+
* SharedWorker) installs them to derive the rotated key. `undefined` when
|
|
27
|
+
* no rotation occurred (a forward-secret document).
|
|
28
|
+
*/
|
|
29
|
+
readonly leafSecrets: Uint8Array | undefined;
|
|
30
|
+
}
|
|
31
|
+
|
|
23
32
|
export class Agent {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
+
private constructor();
|
|
34
|
+
free(): void;
|
|
35
|
+
[Symbol.dispose](): void;
|
|
36
|
+
isDocument(): boolean;
|
|
37
|
+
isGroup(): boolean;
|
|
38
|
+
isIndividual(): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Returns prekey operation hashes for this [`Agent`] as an array of hash bytes.
|
|
41
|
+
*/
|
|
42
|
+
keyOpHashes(): Promise<Uint8Array[]>;
|
|
43
|
+
/**
|
|
44
|
+
* Returns prekey operations for this agent as a Map of hash -> serialized bytes for [`StaticEvent`]
|
|
45
|
+
*/
|
|
46
|
+
keyOps(): Promise<Map<any, any>>;
|
|
47
|
+
toString(): string;
|
|
48
|
+
readonly id: Identifier;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Result of [`JsKeyhive::all_agent_events`], containing all events for all agents
|
|
53
|
+
* with deduplicated storage and two-tier indirection for membership, prekey, and CGKA ops.
|
|
54
|
+
*
|
|
55
|
+
* The consumer follows: agent -> source IDs -> hashes -> event bytes.
|
|
56
|
+
*/
|
|
57
|
+
export class AllAgentEvents {
|
|
58
|
+
private constructor();
|
|
59
|
+
free(): void;
|
|
60
|
+
[Symbol.dispose](): void;
|
|
61
|
+
readonly agentCgkaSources: Map<any, any>;
|
|
62
|
+
readonly agentMembershipSources: Map<any, any>;
|
|
63
|
+
readonly agentPrekeySources: Map<any, any>;
|
|
64
|
+
readonly cgkaSources: Map<any, any>;
|
|
65
|
+
readonly events: Map<any, any>;
|
|
66
|
+
readonly membershipSources: Map<any, any>;
|
|
67
|
+
readonly prekeySources: Map<any, any>;
|
|
68
|
+
}
|
|
69
|
+
|
|
33
70
|
export class Archive {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
71
|
+
free(): void;
|
|
72
|
+
[Symbol.dispose](): void;
|
|
73
|
+
toBytes(): Uint8Array;
|
|
74
|
+
tryToKeyhive(ciphertext_store: CiphertextStore, signer: Signer, event_handler: Function): Promise<Keyhive>;
|
|
75
|
+
constructor(bytes: Uint8Array);
|
|
39
76
|
}
|
|
77
|
+
|
|
40
78
|
export class CannotParseEd25519SigningKey {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
79
|
+
private constructor();
|
|
80
|
+
free(): void;
|
|
81
|
+
[Symbol.dispose](): void;
|
|
44
82
|
}
|
|
83
|
+
|
|
45
84
|
export class CannotParseIdentifier {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
85
|
+
private constructor();
|
|
86
|
+
free(): void;
|
|
87
|
+
[Symbol.dispose](): void;
|
|
49
88
|
}
|
|
89
|
+
|
|
50
90
|
export class Capability {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
91
|
+
private constructor();
|
|
92
|
+
free(): void;
|
|
93
|
+
[Symbol.dispose](): void;
|
|
94
|
+
readonly can: Access;
|
|
95
|
+
readonly proof: SignedDelegation;
|
|
96
|
+
readonly who: Agent;
|
|
97
|
+
}
|
|
98
|
+
|
|
58
99
|
export class CgkaOperation {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
100
|
+
private constructor();
|
|
101
|
+
free(): void;
|
|
102
|
+
[Symbol.dispose](): void;
|
|
103
|
+
readonly variant: string;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export class ChangeId {
|
|
107
|
+
free(): void;
|
|
108
|
+
[Symbol.dispose](): void;
|
|
109
|
+
/**
|
|
110
|
+
* Upcasts; to the JS-import type for [`JsChangeId`].
|
|
111
|
+
*/
|
|
112
|
+
__wasm_refgen_toJsChangeId(): ChangeId;
|
|
113
|
+
constructor(bytes: Uint8Array);
|
|
114
|
+
readonly bytes: Uint8Array;
|
|
115
|
+
}
|
|
116
|
+
|
|
70
117
|
export class CiphertextStore {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
118
|
+
private constructor();
|
|
119
|
+
free(): void;
|
|
120
|
+
[Symbol.dispose](): void;
|
|
121
|
+
static newFromWebStorage(storage: Storage): CiphertextStore;
|
|
122
|
+
static newInMemory(): CiphertextStore;
|
|
76
123
|
}
|
|
124
|
+
|
|
77
125
|
export class ContactCard {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
126
|
+
private constructor();
|
|
127
|
+
free(): void;
|
|
128
|
+
[Symbol.dispose](): void;
|
|
129
|
+
static fromJson(json: string): ContactCard;
|
|
130
|
+
signature(): Uint8Array;
|
|
131
|
+
toJson(): string;
|
|
132
|
+
readonly id: Identifier;
|
|
133
|
+
readonly individualId: IndividualId;
|
|
134
|
+
readonly op: Event;
|
|
135
|
+
readonly shareKey: ShareKey;
|
|
136
|
+
}
|
|
137
|
+
|
|
87
138
|
export class Delegation {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
private constructor();
|
|
98
|
-
free(): void;
|
|
99
|
-
[Symbol.dispose](): void;
|
|
100
|
-
}
|
|
139
|
+
private constructor();
|
|
140
|
+
free(): void;
|
|
141
|
+
[Symbol.dispose](): void;
|
|
142
|
+
readonly after: History;
|
|
143
|
+
readonly can: Access;
|
|
144
|
+
readonly delegate: Agent;
|
|
145
|
+
readonly proof: SignedDelegation | undefined;
|
|
146
|
+
}
|
|
147
|
+
|
|
101
148
|
export class DocContentRefs {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
}
|
|
149
|
+
free(): void;
|
|
150
|
+
[Symbol.dispose](): void;
|
|
151
|
+
addChangeId(hash: ChangeId): Promise<void>;
|
|
152
|
+
constructor(doc_id: DocumentId, change_hashes: ChangeId[]);
|
|
153
|
+
readonly change_hashes: Promise<ChangeId[]>;
|
|
154
|
+
readonly docId: DocumentId;
|
|
155
|
+
}
|
|
156
|
+
|
|
109
157
|
export class Document {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
158
|
+
private constructor();
|
|
159
|
+
free(): void;
|
|
160
|
+
[Symbol.dispose](): void;
|
|
161
|
+
/**
|
|
162
|
+
* Upcasts; to the JS-import type for [`JsDocument`].
|
|
163
|
+
*/
|
|
164
|
+
__wasm_refgen_toJsDocument(): Document;
|
|
165
|
+
members(): Promise<Capability[]>;
|
|
166
|
+
toAgent(): Agent;
|
|
167
|
+
toMembered(): Membered;
|
|
168
|
+
toPeer(): Peer;
|
|
169
|
+
readonly doc_id: DocumentId;
|
|
170
|
+
readonly id: Identifier;
|
|
171
|
+
}
|
|
172
|
+
|
|
119
173
|
export class DocumentId {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
}
|
|
174
|
+
free(): void;
|
|
175
|
+
[Symbol.dispose](): void;
|
|
176
|
+
constructor(bytes: Uint8Array);
|
|
177
|
+
toBytes(): Uint8Array;
|
|
178
|
+
toJsValue(): any;
|
|
179
|
+
toString(): string;
|
|
180
|
+
}
|
|
181
|
+
|
|
127
182
|
export class Encrypted {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
183
|
+
private constructor();
|
|
184
|
+
free(): void;
|
|
185
|
+
[Symbol.dispose](): void;
|
|
186
|
+
static fromBytes(bytes: Uint8Array): Encrypted;
|
|
187
|
+
serialize(): Uint8Array;
|
|
188
|
+
toBytes(): Uint8Array;
|
|
189
|
+
readonly ciphertext: Uint8Array;
|
|
190
|
+
readonly content_ref: Uint8Array;
|
|
191
|
+
readonly nonce: Uint8Array;
|
|
192
|
+
readonly pcs_key_hash: Uint8Array;
|
|
193
|
+
readonly pred_refs: Uint8Array;
|
|
194
|
+
}
|
|
195
|
+
|
|
138
196
|
export class EncryptedContentWithUpdate {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
197
|
+
private constructor();
|
|
198
|
+
free(): void;
|
|
199
|
+
[Symbol.dispose](): void;
|
|
200
|
+
encrypted_content(): Encrypted;
|
|
201
|
+
update_op(): SignedCgkaOperation | undefined;
|
|
144
202
|
}
|
|
203
|
+
|
|
145
204
|
export class Event {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
205
|
+
private constructor();
|
|
206
|
+
free(): void;
|
|
207
|
+
[Symbol.dispose](): void;
|
|
208
|
+
/**
|
|
209
|
+
* Converts the underlying [`Event`] to a [`StaticEvent`] and then
|
|
210
|
+
* serializes it.
|
|
211
|
+
*/
|
|
212
|
+
toBytes(): Uint8Array;
|
|
213
|
+
tryIntoSignedDelegation(): SignedDelegation | undefined;
|
|
214
|
+
tryIntoSignedRevocation(): SignedRevocation | undefined;
|
|
215
|
+
readonly isDelegated: boolean;
|
|
216
|
+
readonly isRevoked: boolean;
|
|
217
|
+
readonly variant: string;
|
|
218
|
+
}
|
|
219
|
+
|
|
161
220
|
export class GenerateWebCryptoError {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
}
|
|
167
|
-
export class GetCiphertextError {
|
|
168
|
-
private constructor();
|
|
169
|
-
free(): void;
|
|
170
|
-
[Symbol.dispose](): void;
|
|
171
|
-
readonly message: string;
|
|
221
|
+
private constructor();
|
|
222
|
+
free(): void;
|
|
223
|
+
[Symbol.dispose](): void;
|
|
224
|
+
message(): string;
|
|
172
225
|
}
|
|
226
|
+
|
|
173
227
|
export class Group {
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
228
|
+
private constructor();
|
|
229
|
+
free(): void;
|
|
230
|
+
[Symbol.dispose](): void;
|
|
231
|
+
/**
|
|
232
|
+
* Upcasts; to the JS-import type for [`JsGroup`].
|
|
233
|
+
*/
|
|
234
|
+
__wasm_refgen_toJsGroup(): Group;
|
|
235
|
+
members(): Promise<Capability[]>;
|
|
236
|
+
toAgent(): Agent;
|
|
237
|
+
toMembered(): Membered;
|
|
238
|
+
toPeer(): Peer;
|
|
239
|
+
readonly groupId: GroupId;
|
|
240
|
+
readonly id: Identifier;
|
|
241
|
+
}
|
|
242
|
+
|
|
184
243
|
export class GroupId {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
244
|
+
private constructor();
|
|
245
|
+
free(): void;
|
|
246
|
+
[Symbol.dispose](): void;
|
|
247
|
+
toString(): string;
|
|
189
248
|
}
|
|
249
|
+
|
|
190
250
|
export class History {
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
}
|
|
251
|
+
private constructor();
|
|
252
|
+
free(): void;
|
|
253
|
+
[Symbol.dispose](): void;
|
|
254
|
+
contentRefs(): DocContentRefs[];
|
|
255
|
+
delegations(): SignedDelegation[];
|
|
256
|
+
revocations(): SignedRevocation[];
|
|
257
|
+
}
|
|
258
|
+
|
|
198
259
|
export class Identifier {
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
260
|
+
free(): void;
|
|
261
|
+
[Symbol.dispose](): void;
|
|
262
|
+
constructor(bytes: Uint8Array);
|
|
263
|
+
static publicId(): Identifier;
|
|
264
|
+
toBytes(): Uint8Array;
|
|
203
265
|
}
|
|
266
|
+
|
|
204
267
|
export class Individual {
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
}
|
|
268
|
+
private constructor();
|
|
269
|
+
free(): void;
|
|
270
|
+
[Symbol.dispose](): void;
|
|
271
|
+
pickPrekey(doc_id: DocumentId): Promise<ShareKey>;
|
|
272
|
+
toAgent(): Agent;
|
|
273
|
+
toPeer(): Peer;
|
|
274
|
+
readonly id: Identifier;
|
|
275
|
+
readonly individualId: IndividualId;
|
|
276
|
+
}
|
|
277
|
+
|
|
214
278
|
export class IndividualId {
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
279
|
+
private constructor();
|
|
280
|
+
free(): void;
|
|
281
|
+
[Symbol.dispose](): void;
|
|
282
|
+
readonly bytes: Uint8Array;
|
|
219
283
|
}
|
|
284
|
+
|
|
220
285
|
export class Invocation {
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
}
|
|
225
|
-
export class JsDecryptError {
|
|
226
|
-
private constructor();
|
|
227
|
-
free(): void;
|
|
228
|
-
[Symbol.dispose](): void;
|
|
229
|
-
}
|
|
230
|
-
export class JsEncryptError {
|
|
231
|
-
private constructor();
|
|
232
|
-
free(): void;
|
|
233
|
-
[Symbol.dispose](): void;
|
|
234
|
-
}
|
|
235
|
-
export class JsReceivePreKeyOpError {
|
|
236
|
-
private constructor();
|
|
237
|
-
free(): void;
|
|
238
|
-
[Symbol.dispose](): void;
|
|
239
|
-
}
|
|
240
|
-
export class JsReceiveStaticEventError {
|
|
241
|
-
private constructor();
|
|
242
|
-
free(): void;
|
|
243
|
-
[Symbol.dispose](): void;
|
|
286
|
+
private constructor();
|
|
287
|
+
free(): void;
|
|
288
|
+
[Symbol.dispose](): void;
|
|
244
289
|
}
|
|
290
|
+
|
|
245
291
|
export class Keyhive {
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
292
|
+
private constructor();
|
|
293
|
+
free(): void;
|
|
294
|
+
[Symbol.dispose](): void;
|
|
295
|
+
accessForDoc(id: Identifier, doc_id: DocumentId): Promise<Access | undefined>;
|
|
296
|
+
addMember(to_add: Agent, membered: Membered, access: Access, other_relevant_docs: Document[]): Promise<AddMemberUpdate>;
|
|
297
|
+
/**
|
|
298
|
+
* Returns all agent events with deduplicated storage and two-tier indirection
|
|
299
|
+
* for membership, prekey, and CGKA ops.
|
|
300
|
+
*/
|
|
301
|
+
allAgentEvents(): Promise<AllAgentEvents>;
|
|
302
|
+
contactCard(): Promise<ContactCard>;
|
|
303
|
+
docMemberCapabilities(doc_id: DocumentId): Promise<Membership[]>;
|
|
304
|
+
/**
|
|
305
|
+
* Returns event hashes for provided [`JsAgent`] as an array of hash bytes.
|
|
306
|
+
*/
|
|
307
|
+
eventHashesForAgent(agent: Agent): Promise<Array<any>>;
|
|
308
|
+
/**
|
|
309
|
+
* Returns events for provided [`Agent`] as a map from hash to serialized [`StaticEvent`] bytes.
|
|
310
|
+
*/
|
|
311
|
+
eventsForAgent(agent: Agent): Promise<Map<any, any>>;
|
|
312
|
+
expandPrekeys(): Promise<ShareKey>;
|
|
313
|
+
exportPrekeySecrets(): Promise<Uint8Array>;
|
|
314
|
+
/**
|
|
315
|
+
* Force a PCS key rotation and return the new leaf secret, serialized as a
|
|
316
|
+
* one-entry `BTreeMap<ShareKey, ShareSecretKey>` (the exact format
|
|
317
|
+
* `importPrekeySecrets` accepts). A sibling instance of this identity can
|
|
318
|
+
* install it to derive the rotated key without re-importing the whole bundle.
|
|
319
|
+
*/
|
|
320
|
+
forcePcsUpdate(doc: Document): Promise<Uint8Array>;
|
|
321
|
+
/**
|
|
322
|
+
* Generate a document. Whether it provides forward secrecy is determined by
|
|
323
|
+
* this peer's forward-secrecy policy (chosen at `Keyhive.init`).
|
|
324
|
+
*/
|
|
325
|
+
generateDocument(coparents: Peer[], initial_content_ref_head: ChangeId, more_initial_content_refs: ChangeId[]): Promise<Document>;
|
|
326
|
+
generateGroup(js_coparents: Peer[]): Promise<Group>;
|
|
327
|
+
getAgent(id: Identifier): Promise<Agent | undefined>;
|
|
328
|
+
getDocument(doc_id: DocumentId): Promise<Document | undefined>;
|
|
329
|
+
getExistingContactCard(): Promise<ContactCard>;
|
|
330
|
+
getGroup(group_id: GroupId): Promise<Group | undefined>;
|
|
331
|
+
getIndividual(id: IndividualId): Promise<Individual | undefined>;
|
|
332
|
+
importPrekeySecrets(bytes: Uint8Array): Promise<void>;
|
|
333
|
+
ingestArchive(archive: Archive): Promise<void>;
|
|
334
|
+
ingestEventsBytes(events_bytes_array: Array<any>): Promise<Array<any>>;
|
|
335
|
+
/**
|
|
336
|
+
* Initialize a peer.
|
|
337
|
+
*
|
|
338
|
+
* `forward_secrecy` is this peer's policy for all documents it creates or
|
|
339
|
+
* receives. When `false`, documents carry the CGKA predecessor key chain
|
|
340
|
+
* (a member added later reads the whole prior history) and adding a reader
|
|
341
|
+
* auto-rekeys (see `addMember`'s `leafSecrets`). When `true`, a member
|
|
342
|
+
* added later cannot read content from before they joined.
|
|
343
|
+
*/
|
|
344
|
+
static init(signer: Signer, ciphertext_store: CiphertextStore, event_handler: Function, forward_secrecy: boolean): Promise<Keyhive>;
|
|
345
|
+
intoArchive(): Promise<Archive>;
|
|
346
|
+
membershipOpsForAgent(agent: Agent): Promise<Map<any, any>>;
|
|
347
|
+
pendingEventHashes(): Promise<Set<any>>;
|
|
348
|
+
reachableDocs(): Promise<Summary[]>;
|
|
349
|
+
receiveContactCard(contact_card: ContactCard): Promise<Individual>;
|
|
350
|
+
revokeMember(to_revoke: Agent, retain_all_other_members: boolean, membered: Membered): Promise<SignedRevocation[]>;
|
|
351
|
+
revokedMembersForDoc(doc_id: DocumentId): Promise<Membership[]>;
|
|
352
|
+
rotatePrekey(prekey: ShareKey): Promise<ShareKey>;
|
|
353
|
+
stats(): Promise<Stats>;
|
|
354
|
+
toArchive(): Promise<Archive>;
|
|
355
|
+
tryDecrypt(doc: Document, encrypted: Encrypted): Promise<Uint8Array>;
|
|
356
|
+
tryEncrypt(doc: Document, content_ref: ChangeId, js_pred_refs: ChangeId[], content: Uint8Array): Promise<EncryptedContentWithUpdate>;
|
|
357
|
+
tryEncryptArchive(doc: Document, content_ref: ChangeId, pred_refs: ChangeId[], content: Uint8Array): Promise<EncryptedContentWithUpdate>;
|
|
358
|
+
tryPcsKeyHash(doc: Document): Promise<Uint8Array | undefined>;
|
|
359
|
+
trySign(data: Uint8Array): Promise<Signed>;
|
|
360
|
+
readonly id: IndividualId;
|
|
361
|
+
readonly idString: string;
|
|
362
|
+
readonly individual: Promise<Individual>;
|
|
363
|
+
readonly whoami: IndividualId;
|
|
364
|
+
}
|
|
365
|
+
|
|
277
366
|
export class Membered {
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
}
|
|
367
|
+
private constructor();
|
|
368
|
+
free(): void;
|
|
369
|
+
[Symbol.dispose](): void;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
export class Membership {
|
|
373
|
+
private constructor();
|
|
374
|
+
free(): void;
|
|
375
|
+
[Symbol.dispose](): void;
|
|
376
|
+
readonly can: Access;
|
|
377
|
+
readonly who: Agent;
|
|
378
|
+
}
|
|
379
|
+
|
|
282
380
|
export class Peer {
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
}
|
|
381
|
+
private constructor();
|
|
382
|
+
free(): void;
|
|
383
|
+
[Symbol.dispose](): void;
|
|
384
|
+
/**
|
|
385
|
+
* Upcasts; to the JS-import type for [`JsPeer`].
|
|
386
|
+
*/
|
|
387
|
+
__wasm_refgen_toJsPeer(): Peer;
|
|
388
|
+
isDocument(): boolean;
|
|
389
|
+
isGroup(): boolean;
|
|
390
|
+
isIndividual(): boolean;
|
|
391
|
+
toString(): string;
|
|
392
|
+
readonly id: Identifier;
|
|
393
|
+
}
|
|
394
|
+
|
|
296
395
|
export class Revocation {
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
private constructor();
|
|
307
|
-
free(): void;
|
|
308
|
-
[Symbol.dispose](): void;
|
|
309
|
-
readonly message: string;
|
|
310
|
-
}
|
|
311
|
-
export class SerializationError {
|
|
312
|
-
private constructor();
|
|
313
|
-
free(): void;
|
|
314
|
-
[Symbol.dispose](): void;
|
|
315
|
-
toError(): any;
|
|
316
|
-
}
|
|
396
|
+
private constructor();
|
|
397
|
+
free(): void;
|
|
398
|
+
[Symbol.dispose](): void;
|
|
399
|
+
readonly after: History;
|
|
400
|
+
readonly proof: SignedDelegation | undefined;
|
|
401
|
+
readonly revoked: SignedDelegation;
|
|
402
|
+
readonly subject_id: Identifier;
|
|
403
|
+
}
|
|
404
|
+
|
|
317
405
|
export class ShareKey {
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
406
|
+
private constructor();
|
|
407
|
+
free(): void;
|
|
408
|
+
[Symbol.dispose](): void;
|
|
321
409
|
}
|
|
410
|
+
|
|
322
411
|
export class Signed {
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
}
|
|
412
|
+
private constructor();
|
|
413
|
+
free(): void;
|
|
414
|
+
[Symbol.dispose](): void;
|
|
415
|
+
static fromBytes(bytes: Uint8Array): Signed;
|
|
416
|
+
toBytes(): Uint8Array;
|
|
417
|
+
verify(): boolean;
|
|
418
|
+
readonly payload: Uint8Array;
|
|
419
|
+
readonly signature: Uint8Array;
|
|
420
|
+
readonly verifyingKey: Uint8Array;
|
|
421
|
+
}
|
|
422
|
+
|
|
333
423
|
export class SignedCgkaOperation {
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
}
|
|
424
|
+
private constructor();
|
|
425
|
+
free(): void;
|
|
426
|
+
[Symbol.dispose](): void;
|
|
427
|
+
verify(): boolean;
|
|
428
|
+
readonly delegation: CgkaOperation;
|
|
429
|
+
readonly signature: Uint8Array;
|
|
430
|
+
readonly verifyingKey: Uint8Array;
|
|
431
|
+
}
|
|
432
|
+
|
|
342
433
|
export class SignedDelegation {
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
434
|
+
private constructor();
|
|
435
|
+
free(): void;
|
|
436
|
+
[Symbol.dispose](): void;
|
|
437
|
+
verify(): boolean;
|
|
438
|
+
readonly delegation: Delegation;
|
|
439
|
+
readonly signature: Uint8Array;
|
|
440
|
+
readonly subjectId: Identifier;
|
|
441
|
+
readonly verifyingKey: Uint8Array;
|
|
442
|
+
}
|
|
443
|
+
|
|
351
444
|
export class SignedInvocation {
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
445
|
+
private constructor();
|
|
446
|
+
free(): void;
|
|
447
|
+
[Symbol.dispose](): void;
|
|
355
448
|
}
|
|
449
|
+
|
|
356
450
|
export class SignedRevocation {
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
}
|
|
451
|
+
private constructor();
|
|
452
|
+
free(): void;
|
|
453
|
+
[Symbol.dispose](): void;
|
|
454
|
+
verify(): boolean;
|
|
455
|
+
readonly delegation: Revocation;
|
|
456
|
+
readonly signature: Uint8Array;
|
|
457
|
+
readonly verifyingKey: Uint8Array;
|
|
458
|
+
}
|
|
459
|
+
|
|
365
460
|
export class Signer {
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
461
|
+
private constructor();
|
|
462
|
+
free(): void;
|
|
463
|
+
[Symbol.dispose](): void;
|
|
464
|
+
clone(): Signer;
|
|
465
|
+
static generate(): Promise<Signer>;
|
|
466
|
+
static generateMemory(): Signer;
|
|
467
|
+
static generateWebCrypto(): Promise<Signer>;
|
|
468
|
+
static memorySignerFromBytes(bytes: Uint8Array): Signer;
|
|
469
|
+
trySign(bytes: Uint8Array): Promise<Signed>;
|
|
470
|
+
static webCryptoSigner(keypair: any): Promise<Signer>;
|
|
471
|
+
readonly variant: string;
|
|
472
|
+
readonly verifyingKey: Uint8Array;
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
export class Stats {
|
|
476
|
+
private constructor();
|
|
477
|
+
free(): void;
|
|
478
|
+
[Symbol.dispose](): void;
|
|
479
|
+
readonly activePrekeyCount: bigint;
|
|
480
|
+
readonly cgkaOperations: bigint;
|
|
481
|
+
readonly delegations: bigint;
|
|
482
|
+
readonly docs: bigint;
|
|
483
|
+
readonly groups: bigint;
|
|
484
|
+
readonly individuals: bigint;
|
|
485
|
+
readonly pendingCgkaOperation: bigint;
|
|
486
|
+
readonly pendingCgkaOperationByActive: bigint;
|
|
487
|
+
readonly pendingDelegated: bigint;
|
|
488
|
+
readonly pendingDelegatedByActive: bigint;
|
|
489
|
+
readonly pendingPrekeyRotated: bigint;
|
|
490
|
+
readonly pendingPrekeyRotatedByActive: bigint;
|
|
491
|
+
readonly pendingPrekeysExpanded: bigint;
|
|
492
|
+
readonly pendingPrekeysExpandedByActive: bigint;
|
|
493
|
+
readonly pendingRevoked: bigint;
|
|
494
|
+
readonly pendingRevokedByActive: bigint;
|
|
495
|
+
readonly prekeyRotations: bigint;
|
|
496
|
+
readonly prekeysExpanded: bigint;
|
|
497
|
+
readonly revocations: bigint;
|
|
498
|
+
readonly totalOps: bigint;
|
|
499
|
+
readonly totalPendingOps: bigint;
|
|
500
|
+
}
|
|
501
|
+
|
|
392
502
|
export class Summary {
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
}
|
|
399
|
-
export class TryFromArchiveError {
|
|
400
|
-
private constructor();
|
|
401
|
-
free(): void;
|
|
402
|
-
[Symbol.dispose](): void;
|
|
403
|
-
toError(): any;
|
|
503
|
+
private constructor();
|
|
504
|
+
free(): void;
|
|
505
|
+
[Symbol.dispose](): void;
|
|
506
|
+
readonly access: Access;
|
|
507
|
+
readonly doc: Document;
|
|
404
508
|
}
|
|
509
|
+
|
|
510
|
+
/**
|
|
511
|
+
* Panic hook lets us get better error messages if our Rust code ever panics.
|
|
512
|
+
*
|
|
513
|
+
* This function needs to be called at least once during initialisation.
|
|
514
|
+
* https://rustwasm.github.io/docs/wasm-pack/tutorials/npm-browser-packages/template-deep-dive/src-utils-rs.html#2-what-is-console_error_panic_hook
|
|
515
|
+
*/
|
|
516
|
+
export function setPanicHook(): void;
|