@keyhive/keyhive 0.0.0-alpha.0 → 0.0.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@keyhive/keyhive",
3
- "version": "0.0.0-alpha.0",
3
+ "version": "0.0.0-alpha.2",
4
4
  "description": "",
5
5
  "main": "pkg/keyhive_wasm.js",
6
6
  "keywords": [],
@@ -11,7 +11,8 @@
11
11
  "types": "pkg/keyhive_wasm.d.ts",
12
12
  "files": [
13
13
  "pkg/*",
14
- "pkg-node/*"
14
+ "pkg-node/*",
15
+ "pkg-slim/*"
15
16
  ],
16
17
  "exports": {
17
18
  ".": {
@@ -23,6 +24,15 @@
23
24
  "import": "./pkg/keyhive_wasm.js",
24
25
  "require": "./pkg/keyhive_wasm.js",
25
26
  "types": "./pkg/keyhive_wasm.d.ts"
27
+ },
28
+ "./slim": {
29
+ "types": "./pkg-slim/index.d.ts",
30
+ "import": "./pkg-slim/index.js"
31
+ },
32
+ "./keyhive_wasm.wasm": "./pkg-slim/keyhive_wasm_bg.wasm",
33
+ "./keyhive_wasm.base64.js": {
34
+ "import": "./pkg-slim/keyhive_wasm_bg.wasm.base64.js",
35
+ "type": "./pkg-slim/keyhive_wasm_bg.wasm.base64.d.ts"
26
36
  }
27
37
  },
28
38
  "devDependencies": {
@@ -39,8 +49,9 @@
39
49
  "webpack-dev-server": "^5.2.2"
40
50
  },
41
51
  "scripts": {
42
- "build": "npm run build-node && npm run build-bundler",
43
- "build-node": "wasm-pack build --out-dir pkg-node --target nodejs --release",
44
- "build-bundler": "wasm-pack build --out-dir pkg --target bundler --release"
52
+ "build": "pnpm run build-node && pnpm run build-bundler && pnpm run build-slim",
53
+ "build-node": "wasm-pack build --out-dir pkg-node --target nodejs --release -- --features ingest_static",
54
+ "build-bundler": "wasm-pack build --out-dir pkg --target bundler --release -- --features ingest_static",
55
+ "build-slim": "node build_slim.js"
45
56
  }
46
57
  }
@@ -10,17 +10,20 @@ export function setPanicHook(): void;
10
10
  export class Access {
11
11
  private constructor();
12
12
  free(): void;
13
+ [Symbol.dispose](): void;
13
14
  static tryFromString(s: string): Access | undefined;
14
15
  toString(): string;
15
16
  }
16
17
  export class AddMemberError {
17
18
  private constructor();
18
19
  free(): void;
20
+ [Symbol.dispose](): void;
19
21
  message(): string;
20
22
  }
21
23
  export class Agent {
22
24
  private constructor();
23
25
  free(): void;
26
+ [Symbol.dispose](): void;
24
27
  toString(): string;
25
28
  isIndividual(): boolean;
26
29
  isGroup(): boolean;
@@ -29,6 +32,7 @@ export class Agent {
29
32
  }
30
33
  export class Archive {
31
34
  free(): void;
35
+ [Symbol.dispose](): void;
32
36
  constructor(bytes: Uint8Array);
33
37
  toBytes(): Uint8Array;
34
38
  tryToKeyhive(ciphertext_store: CiphertextStore, signer: Signer, event_handler: Function): Keyhive;
@@ -36,14 +40,17 @@ export class Archive {
36
40
  export class CannotParseEd25519SigningKey {
37
41
  private constructor();
38
42
  free(): void;
43
+ [Symbol.dispose](): void;
39
44
  }
40
45
  export class CannotParseIdentifier {
41
46
  private constructor();
42
47
  free(): void;
48
+ [Symbol.dispose](): void;
43
49
  }
44
50
  export class Capability {
45
51
  private constructor();
46
52
  free(): void;
53
+ [Symbol.dispose](): void;
47
54
  readonly who: Agent;
48
55
  readonly can: Access;
49
56
  readonly proof: SignedDelegation;
@@ -51,22 +58,26 @@ export class Capability {
51
58
  export class CgkaOperation {
52
59
  private constructor();
53
60
  free(): void;
61
+ [Symbol.dispose](): void;
54
62
  readonly variant: string;
55
63
  }
56
64
  export class ChangeRef {
57
65
  free(): void;
66
+ [Symbol.dispose](): void;
58
67
  constructor(bytes: Uint8Array);
59
68
  readonly bytes: Uint8Array;
60
69
  }
61
70
  export class CiphertextStore {
62
71
  private constructor();
63
72
  free(): void;
73
+ [Symbol.dispose](): void;
64
74
  static newInMemory(): CiphertextStore;
65
75
  static newFromWebStorage(storage: Storage): CiphertextStore;
66
76
  }
67
77
  export class ContactCard {
68
78
  private constructor();
69
79
  free(): void;
80
+ [Symbol.dispose](): void;
70
81
  signature(): Uint8Array;
71
82
  static fromJson(json: string): ContactCard;
72
83
  toJson(): string;
@@ -76,6 +87,7 @@ export class ContactCard {
76
87
  export class Delegation {
77
88
  private constructor();
78
89
  free(): void;
90
+ [Symbol.dispose](): void;
79
91
  readonly delegate: Agent;
80
92
  readonly can: Access;
81
93
  readonly proof: SignedDelegation | undefined;
@@ -84,9 +96,11 @@ export class Delegation {
84
96
  export class DelegationError {
85
97
  private constructor();
86
98
  free(): void;
99
+ [Symbol.dispose](): void;
87
100
  }
88
101
  export class DocContentRefs {
89
102
  free(): void;
103
+ [Symbol.dispose](): void;
90
104
  constructor(doc_id: DocumentId, change_hashes: ChangeRef[]);
91
105
  addChangeRef(hash: ChangeRef): void;
92
106
  readonly docId: DocumentId;
@@ -95,6 +109,7 @@ export class DocContentRefs {
95
109
  export class Document {
96
110
  private constructor();
97
111
  free(): void;
112
+ [Symbol.dispose](): void;
98
113
  toPeer(): Peer;
99
114
  toAgent(): Agent;
100
115
  readonly id: Identifier;
@@ -102,6 +117,7 @@ export class Document {
102
117
  }
103
118
  export class DocumentId {
104
119
  free(): void;
120
+ [Symbol.dispose](): void;
105
121
  constructor(bytes: Uint8Array);
106
122
  fromString(): string;
107
123
  toJsValue(): any;
@@ -110,6 +126,7 @@ export class DocumentId {
110
126
  export class Encrypted {
111
127
  private constructor();
112
128
  free(): void;
129
+ [Symbol.dispose](): void;
113
130
  toBytes(): Uint8Array;
114
131
  readonly ciphertext: Uint8Array;
115
132
  readonly nonce: Uint8Array;
@@ -120,12 +137,14 @@ export class Encrypted {
120
137
  export class EncryptedContentWithUpdate {
121
138
  private constructor();
122
139
  free(): void;
140
+ [Symbol.dispose](): void;
123
141
  encrypted_content(): Encrypted;
124
142
  update_op(): SignedCgkaOperation | undefined;
125
143
  }
126
144
  export class Event {
127
145
  private constructor();
128
146
  free(): void;
147
+ [Symbol.dispose](): void;
129
148
  tryIntoSignedDelegation(): SignedDelegation | undefined;
130
149
  tryIntoSignedRevocation(): SignedRevocation | undefined;
131
150
  readonly variant: string;
@@ -135,21 +154,25 @@ export class Event {
135
154
  export class GenerateDocError {
136
155
  private constructor();
137
156
  free(): void;
157
+ [Symbol.dispose](): void;
138
158
  message(): string;
139
159
  }
140
160
  export class GenerateWebCryptoError {
141
161
  private constructor();
142
162
  free(): void;
163
+ [Symbol.dispose](): void;
143
164
  message(): string;
144
165
  }
145
166
  export class GetCiphertextError {
146
167
  private constructor();
147
168
  free(): void;
169
+ [Symbol.dispose](): void;
148
170
  readonly message: string;
149
171
  }
150
172
  export class Group {
151
173
  private constructor();
152
174
  free(): void;
175
+ [Symbol.dispose](): void;
153
176
  toPeer(): Peer;
154
177
  toAgent(): Agent;
155
178
  toMembered(): Membered;
@@ -160,23 +183,27 @@ export class Group {
160
183
  export class GroupId {
161
184
  private constructor();
162
185
  free(): void;
186
+ [Symbol.dispose](): void;
163
187
  toString(): string;
164
188
  }
165
189
  export class History {
166
190
  private constructor();
167
191
  free(): void;
192
+ [Symbol.dispose](): void;
168
193
  delegations(): SignedDelegation[];
169
194
  revocations(): SignedRevocation[];
170
195
  contentRefs(): DocContentRefs[];
171
196
  }
172
197
  export class Identifier {
173
198
  free(): void;
199
+ [Symbol.dispose](): void;
174
200
  constructor(bytes: Uint8Array);
175
201
  toBytes(): Uint8Array;
176
202
  }
177
203
  export class Individual {
178
204
  private constructor();
179
205
  free(): void;
206
+ [Symbol.dispose](): void;
180
207
  toPeer(): Peer;
181
208
  toAgent(): Agent;
182
209
  pickPrekey(doc_id: DocumentId): ShareKey;
@@ -186,31 +213,38 @@ export class Individual {
186
213
  export class IndividualId {
187
214
  private constructor();
188
215
  free(): void;
216
+ [Symbol.dispose](): void;
189
217
  readonly bytes: Uint8Array;
190
218
  }
191
219
  export class Invocation {
192
220
  private constructor();
193
221
  free(): void;
222
+ [Symbol.dispose](): void;
194
223
  }
195
224
  export class JsDecryptError {
196
225
  private constructor();
197
226
  free(): void;
227
+ [Symbol.dispose](): void;
198
228
  }
199
229
  export class JsEncryptError {
200
230
  private constructor();
201
231
  free(): void;
232
+ [Symbol.dispose](): void;
202
233
  }
203
234
  export class JsReceivePreKeyOpError {
204
235
  private constructor();
205
236
  free(): void;
237
+ [Symbol.dispose](): void;
206
238
  }
207
239
  export class JsReceiveStaticEventError {
208
240
  private constructor();
209
241
  free(): void;
242
+ [Symbol.dispose](): void;
210
243
  }
211
244
  export class Keyhive {
212
245
  private constructor();
213
246
  free(): void;
247
+ [Symbol.dispose](): void;
214
248
  static init(signer: Signer, ciphertext_store: CiphertextStore, event_handler: Function): Promise<Keyhive>;
215
249
  generateGroup(coparents: Peer[]): Promise<Group>;
216
250
  generateDocument(coparents: Peer[], initial_content_ref_head: ChangeRef, more_initial_content_refs: ChangeRef[]): Promise<Document>;
@@ -232,6 +266,7 @@ export class Keyhive {
232
266
  accessForDoc(id: Identifier, doc_id: DocumentId): Access | undefined;
233
267
  intoArchive(): Archive;
234
268
  toArchive(): Archive;
269
+ ingestArchive(archive: Archive): Promise<void>;
235
270
  readonly id: IndividualId;
236
271
  readonly whoami: IndividualId;
237
272
  readonly idString: string;
@@ -239,10 +274,12 @@ export class Keyhive {
239
274
  export class Membered {
240
275
  private constructor();
241
276
  free(): void;
277
+ [Symbol.dispose](): void;
242
278
  }
243
279
  export class Peer {
244
280
  private constructor();
245
281
  free(): void;
282
+ [Symbol.dispose](): void;
246
283
  toString(): string;
247
284
  isIndividual(): boolean;
248
285
  isGroup(): boolean;
@@ -251,10 +288,12 @@ export class Peer {
251
288
  export class RemoveCiphertextError {
252
289
  private constructor();
253
290
  free(): void;
291
+ [Symbol.dispose](): void;
254
292
  }
255
293
  export class Revocation {
256
294
  private constructor();
257
295
  free(): void;
296
+ [Symbol.dispose](): void;
258
297
  readonly subject_id: Identifier;
259
298
  readonly revoked: SignedDelegation;
260
299
  readonly proof: SignedDelegation | undefined;
@@ -263,20 +302,24 @@ export class Revocation {
263
302
  export class RevokeMemberError {
264
303
  private constructor();
265
304
  free(): void;
305
+ [Symbol.dispose](): void;
266
306
  readonly message: string;
267
307
  }
268
308
  export class SerializationError {
269
309
  private constructor();
270
310
  free(): void;
311
+ [Symbol.dispose](): void;
271
312
  toError(): any;
272
313
  }
273
314
  export class ShareKey {
274
315
  private constructor();
275
316
  free(): void;
317
+ [Symbol.dispose](): void;
276
318
  }
277
319
  export class Signed {
278
320
  private constructor();
279
321
  free(): void;
322
+ [Symbol.dispose](): void;
280
323
  static fromBytes(bytes: Uint8Array): Signed;
281
324
  toBytes(): Uint8Array;
282
325
  verify(): boolean;
@@ -287,6 +330,7 @@ export class Signed {
287
330
  export class SignedCgkaOperation {
288
331
  private constructor();
289
332
  free(): void;
333
+ [Symbol.dispose](): void;
290
334
  verify(): boolean;
291
335
  readonly delegation: CgkaOperation;
292
336
  readonly verifyingKey: Uint8Array;
@@ -295,6 +339,7 @@ export class SignedCgkaOperation {
295
339
  export class SignedDelegation {
296
340
  private constructor();
297
341
  free(): void;
342
+ [Symbol.dispose](): void;
298
343
  verify(): boolean;
299
344
  readonly delegation: Delegation;
300
345
  readonly verifyingKey: Uint8Array;
@@ -303,10 +348,12 @@ export class SignedDelegation {
303
348
  export class SignedInvocation {
304
349
  private constructor();
305
350
  free(): void;
351
+ [Symbol.dispose](): void;
306
352
  }
307
353
  export class SignedRevocation {
308
354
  private constructor();
309
355
  free(): void;
356
+ [Symbol.dispose](): void;
310
357
  verify(): boolean;
311
358
  readonly delegation: Revocation;
312
359
  readonly verifyingKey: Uint8Array;
@@ -315,6 +362,7 @@ export class SignedRevocation {
315
362
  export class Signer {
316
363
  private constructor();
317
364
  free(): void;
365
+ [Symbol.dispose](): void;
318
366
  static generate(): Promise<Signer>;
319
367
  static generateMemory(): Signer;
320
368
  static generateWebCrypto(): Promise<Signer>;
@@ -328,22 +376,26 @@ export class Signer {
328
376
  export class SigningError {
329
377
  private constructor();
330
378
  free(): void;
379
+ [Symbol.dispose](): void;
331
380
  message(): string;
332
381
  }
333
382
  export class SimpleCapability {
334
383
  private constructor();
335
384
  free(): void;
385
+ [Symbol.dispose](): void;
336
386
  readonly who: Agent;
337
387
  readonly can: Access;
338
388
  }
339
389
  export class Summary {
340
390
  private constructor();
341
391
  free(): void;
392
+ [Symbol.dispose](): void;
342
393
  readonly doc: Document;
343
394
  readonly access: Access;
344
395
  }
345
396
  export class TryFromArchiveError {
346
397
  private constructor();
347
398
  free(): void;
399
+ [Symbol.dispose](): void;
348
400
  toError(): any;
349
401
  }