@keyhive/keyhive 0.0.0-alpha.4 → 0.0.0-alpha.40
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/README.md +1 -6
- package/package.json +7 -4
- package/pkg/README.md +1 -6
- package/pkg/keyhive_wasm.d.ts +51 -96
- package/pkg/keyhive_wasm_bg.js +561 -690
- package/pkg/keyhive_wasm_bg.wasm +0 -0
- package/pkg/keyhive_wasm_bg.wasm.d.ts +146 -147
- package/pkg/package.json +1 -1
- package/pkg-node/README.md +1 -6
- package/pkg-node/keyhive_wasm.d.ts +51 -96
- package/pkg-node/keyhive_wasm.js +564 -717
- package/pkg-node/keyhive_wasm_bg.wasm +0 -0
- package/pkg-node/keyhive_wasm_bg.wasm.d.ts +146 -147
- package/pkg-node/package.json +1 -1
- package/pkg-slim/README.md +1 -6
- package/pkg-slim/keyhive_wasm.d.ts +197 -243
- package/pkg-slim/keyhive_wasm.js +525 -670
- 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 +146 -147
- package/pkg-slim/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,12 +3,7 @@
|
|
|
3
3
|
## Build package
|
|
4
4
|
|
|
5
5
|
```
|
|
6
|
-
|
|
7
|
-
```
|
|
8
|
-
|
|
9
|
-
To build with the `ingest_static` feature:
|
|
10
|
-
```
|
|
11
|
-
wasm-pack build --target web --out-dir pkg -- --features web-sys,ingest_static
|
|
6
|
+
pnpm install && pnpm build
|
|
12
7
|
```
|
|
13
8
|
|
|
14
9
|
## Run tests
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@keyhive/keyhive",
|
|
3
|
-
"version": "0.0.0-alpha.
|
|
3
|
+
"version": "0.0.0-alpha.40",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "pkg/keyhive_wasm.js",
|
|
6
6
|
"keywords": [],
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
"@playwright/test": "^1.55.0",
|
|
40
40
|
"@types/node": "^22.17.2",
|
|
41
41
|
"html-webpack-plugin": "^5.6.4",
|
|
42
|
+
"http-server": "^14.1.1",
|
|
42
43
|
"ts-loader": "^9.5.2",
|
|
43
44
|
"typescript": "^5.9.2",
|
|
44
45
|
"vite": "^5.4.19",
|
|
@@ -50,8 +51,10 @@
|
|
|
50
51
|
},
|
|
51
52
|
"scripts": {
|
|
52
53
|
"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
|
|
54
|
-
"build-bundler": "wasm-pack build --out-dir pkg --target bundler --release
|
|
55
|
-
"build-
|
|
54
|
+
"build-node": "wasm-pack build --out-dir pkg-node --target nodejs --release",
|
|
55
|
+
"build-bundler": "wasm-pack build --out-dir pkg --target bundler --release",
|
|
56
|
+
"build-web": "wasm-pack build --out-dir pkg-web --target web --release",
|
|
57
|
+
"build-slim": "node build_slim.js",
|
|
58
|
+
"copy-e2e": "cp -r pkg-slim/* e2e/server/pkg/"
|
|
56
59
|
}
|
|
57
60
|
}
|
package/pkg/README.md
CHANGED
|
@@ -3,12 +3,7 @@
|
|
|
3
3
|
## Build package
|
|
4
4
|
|
|
5
5
|
```
|
|
6
|
-
|
|
7
|
-
```
|
|
8
|
-
|
|
9
|
-
To build with the `ingest_static` feature:
|
|
10
|
-
```
|
|
11
|
-
wasm-pack build --target web --out-dir pkg -- --features web-sys,ingest_static
|
|
6
|
+
pnpm install && pnpm build
|
|
12
7
|
```
|
|
13
8
|
|
|
14
9
|
## Run tests
|
package/pkg/keyhive_wasm.d.ts
CHANGED
|
@@ -14,12 +14,6 @@ export class Access {
|
|
|
14
14
|
static tryFromString(s: string): Access | undefined;
|
|
15
15
|
toString(): string;
|
|
16
16
|
}
|
|
17
|
-
export class AddMemberError {
|
|
18
|
-
private constructor();
|
|
19
|
-
free(): void;
|
|
20
|
-
[Symbol.dispose](): void;
|
|
21
|
-
message(): string;
|
|
22
|
-
}
|
|
23
17
|
export class Agent {
|
|
24
18
|
private constructor();
|
|
25
19
|
free(): void;
|
|
@@ -35,7 +29,7 @@ export class Archive {
|
|
|
35
29
|
[Symbol.dispose](): void;
|
|
36
30
|
constructor(bytes: Uint8Array);
|
|
37
31
|
toBytes(): Uint8Array;
|
|
38
|
-
tryToKeyhive(ciphertext_store: CiphertextStore, signer: Signer, event_handler: Function): Keyhive
|
|
32
|
+
tryToKeyhive(ciphertext_store: CiphertextStore, signer: Signer, event_handler: Function): Promise<Keyhive>;
|
|
39
33
|
}
|
|
40
34
|
export class CannotParseEd25519SigningKey {
|
|
41
35
|
private constructor();
|
|
@@ -61,10 +55,11 @@ export class CgkaOperation {
|
|
|
61
55
|
[Symbol.dispose](): void;
|
|
62
56
|
readonly variant: string;
|
|
63
57
|
}
|
|
64
|
-
export class
|
|
58
|
+
export class ChangeId {
|
|
65
59
|
free(): void;
|
|
66
60
|
[Symbol.dispose](): void;
|
|
67
61
|
constructor(bytes: Uint8Array);
|
|
62
|
+
__wasm_refgen_toChangeId(): ChangeId;
|
|
68
63
|
readonly bytes: Uint8Array;
|
|
69
64
|
}
|
|
70
65
|
export class CiphertextStore {
|
|
@@ -79,6 +74,7 @@ export class ContactCard {
|
|
|
79
74
|
free(): void;
|
|
80
75
|
[Symbol.dispose](): void;
|
|
81
76
|
signature(): Uint8Array;
|
|
77
|
+
toAgent(): Agent;
|
|
82
78
|
static fromJson(json: string): ContactCard;
|
|
83
79
|
toJson(): string;
|
|
84
80
|
readonly id: IndividualId;
|
|
@@ -93,18 +89,13 @@ export class Delegation {
|
|
|
93
89
|
readonly proof: SignedDelegation | undefined;
|
|
94
90
|
readonly after: History;
|
|
95
91
|
}
|
|
96
|
-
export class DelegationError {
|
|
97
|
-
private constructor();
|
|
98
|
-
free(): void;
|
|
99
|
-
[Symbol.dispose](): void;
|
|
100
|
-
}
|
|
101
92
|
export class DocContentRefs {
|
|
102
93
|
free(): void;
|
|
103
94
|
[Symbol.dispose](): void;
|
|
104
|
-
constructor(doc_id: DocumentId, change_hashes:
|
|
105
|
-
|
|
95
|
+
constructor(doc_id: DocumentId, change_hashes: ChangeId[]);
|
|
96
|
+
addChangeId(hash: ChangeId): Promise<void>;
|
|
106
97
|
readonly docId: DocumentId;
|
|
107
|
-
readonly change_hashes:
|
|
98
|
+
readonly change_hashes: Promise<ChangeId[]>;
|
|
108
99
|
}
|
|
109
100
|
export class Document {
|
|
110
101
|
private constructor();
|
|
@@ -112,6 +103,8 @@ export class Document {
|
|
|
112
103
|
[Symbol.dispose](): void;
|
|
113
104
|
toPeer(): Peer;
|
|
114
105
|
toAgent(): Agent;
|
|
106
|
+
toMembered(): Membered;
|
|
107
|
+
__wasm_refgen_toDocument(): Document;
|
|
115
108
|
readonly id: Identifier;
|
|
116
109
|
readonly doc_id: DocumentId;
|
|
117
110
|
}
|
|
@@ -119,7 +112,7 @@ export class DocumentId {
|
|
|
119
112
|
free(): void;
|
|
120
113
|
[Symbol.dispose](): void;
|
|
121
114
|
constructor(bytes: Uint8Array);
|
|
122
|
-
|
|
115
|
+
toString(): string;
|
|
123
116
|
toJsValue(): any;
|
|
124
117
|
toBytes(): Uint8Array;
|
|
125
118
|
}
|
|
@@ -147,38 +140,32 @@ export class Event {
|
|
|
147
140
|
[Symbol.dispose](): void;
|
|
148
141
|
tryIntoSignedDelegation(): SignedDelegation | undefined;
|
|
149
142
|
tryIntoSignedRevocation(): SignedRevocation | undefined;
|
|
143
|
+
/**
|
|
144
|
+
* Converts the underlying [`Event`] to a [`StaticEvent`] and then
|
|
145
|
+
* serializes it.
|
|
146
|
+
*/
|
|
147
|
+
toBytes(): Uint8Array;
|
|
150
148
|
readonly variant: string;
|
|
151
149
|
readonly isDelegated: boolean;
|
|
152
150
|
readonly isRevoked: boolean;
|
|
153
151
|
}
|
|
154
|
-
export class GenerateDocError {
|
|
155
|
-
private constructor();
|
|
156
|
-
free(): void;
|
|
157
|
-
[Symbol.dispose](): void;
|
|
158
|
-
message(): string;
|
|
159
|
-
}
|
|
160
152
|
export class GenerateWebCryptoError {
|
|
161
153
|
private constructor();
|
|
162
154
|
free(): void;
|
|
163
155
|
[Symbol.dispose](): void;
|
|
164
156
|
message(): string;
|
|
165
157
|
}
|
|
166
|
-
export class GetCiphertextError {
|
|
167
|
-
private constructor();
|
|
168
|
-
free(): void;
|
|
169
|
-
[Symbol.dispose](): void;
|
|
170
|
-
readonly message: string;
|
|
171
|
-
}
|
|
172
158
|
export class Group {
|
|
173
159
|
private constructor();
|
|
174
160
|
free(): void;
|
|
175
161
|
[Symbol.dispose](): void;
|
|
162
|
+
members(): Promise<Capability[]>;
|
|
176
163
|
toPeer(): Peer;
|
|
177
164
|
toAgent(): Agent;
|
|
178
165
|
toMembered(): Membered;
|
|
166
|
+
__wasm_refgen_toGroup(): Group;
|
|
179
167
|
readonly id: Identifier;
|
|
180
168
|
readonly groupId: GroupId;
|
|
181
|
-
readonly members: Capability[];
|
|
182
169
|
}
|
|
183
170
|
export class GroupId {
|
|
184
171
|
private constructor();
|
|
@@ -206,7 +193,7 @@ export class Individual {
|
|
|
206
193
|
[Symbol.dispose](): void;
|
|
207
194
|
toPeer(): Peer;
|
|
208
195
|
toAgent(): Agent;
|
|
209
|
-
pickPrekey(doc_id: DocumentId): ShareKey
|
|
196
|
+
pickPrekey(doc_id: DocumentId): Promise<ShareKey>;
|
|
210
197
|
readonly id: Identifier;
|
|
211
198
|
readonly individualId: IndividualId;
|
|
212
199
|
}
|
|
@@ -221,54 +208,38 @@ export class Invocation {
|
|
|
221
208
|
free(): void;
|
|
222
209
|
[Symbol.dispose](): void;
|
|
223
210
|
}
|
|
224
|
-
export class JsDecryptError {
|
|
225
|
-
private constructor();
|
|
226
|
-
free(): void;
|
|
227
|
-
[Symbol.dispose](): void;
|
|
228
|
-
}
|
|
229
|
-
export class JsEncryptError {
|
|
230
|
-
private constructor();
|
|
231
|
-
free(): void;
|
|
232
|
-
[Symbol.dispose](): void;
|
|
233
|
-
}
|
|
234
|
-
export class JsReceivePreKeyOpError {
|
|
235
|
-
private constructor();
|
|
236
|
-
free(): void;
|
|
237
|
-
[Symbol.dispose](): void;
|
|
238
|
-
}
|
|
239
|
-
export class JsReceiveStaticEventError {
|
|
240
|
-
private constructor();
|
|
241
|
-
free(): void;
|
|
242
|
-
[Symbol.dispose](): void;
|
|
243
|
-
}
|
|
244
211
|
export class Keyhive {
|
|
245
212
|
private constructor();
|
|
246
213
|
free(): void;
|
|
247
214
|
[Symbol.dispose](): void;
|
|
248
215
|
static init(signer: Signer, ciphertext_store: CiphertextStore, event_handler: Function): Promise<Keyhive>;
|
|
249
|
-
generateGroup(
|
|
250
|
-
generateDocument(coparents: Peer[], initial_content_ref_head:
|
|
216
|
+
generateGroup(js_coparents: Peer[]): Promise<Group>;
|
|
217
|
+
generateDocument(coparents: Peer[], initial_content_ref_head: ChangeId, more_initial_content_refs: ChangeId[]): Promise<Document>;
|
|
251
218
|
trySign(data: Uint8Array): Promise<Signed>;
|
|
252
|
-
tryEncrypt(doc: Document, content_ref:
|
|
253
|
-
tryEncryptArchive(doc: Document, content_ref:
|
|
254
|
-
tryDecrypt(doc: Document, encrypted: Encrypted): Uint8Array
|
|
219
|
+
tryEncrypt(doc: Document, content_ref: ChangeId, js_pred_refs: ChangeId[], content: Uint8Array): Promise<EncryptedContentWithUpdate>;
|
|
220
|
+
tryEncryptArchive(doc: Document, content_ref: ChangeId, pred_refs: ChangeId[], content: Uint8Array): Promise<EncryptedContentWithUpdate>;
|
|
221
|
+
tryDecrypt(doc: Document, encrypted: Encrypted): Promise<Uint8Array>;
|
|
255
222
|
addMember(to_add: Agent, membered: Membered, access: Access, other_relevant_docs: Document[]): Promise<SignedDelegation>;
|
|
256
223
|
revokeMember(to_revoke: Agent, retain_all_other_members: boolean, membered: Membered): Promise<SignedRevocation[]>;
|
|
257
|
-
reachableDocs(): Summary[]
|
|
224
|
+
reachableDocs(): Promise<Summary[]>;
|
|
258
225
|
forcePcsUpdate(doc: Document): Promise<void>;
|
|
259
226
|
rotatePrekey(prekey: ShareKey): Promise<ShareKey>;
|
|
260
227
|
expandPrekeys(): Promise<ShareKey>;
|
|
261
228
|
contactCard(): Promise<ContactCard>;
|
|
262
|
-
receiveContactCard(contact_card: ContactCard): Individual
|
|
263
|
-
getAgent(id: Identifier): Agent | undefined
|
|
264
|
-
getGroup(
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
229
|
+
receiveContactCard(contact_card: ContactCard): Promise<Individual>;
|
|
230
|
+
getAgent(id: Identifier): Promise<Agent | undefined>;
|
|
231
|
+
getGroup(group_id: GroupId): Promise<Group | undefined>;
|
|
232
|
+
getDocument(doc_id: DocumentId): Promise<Document | undefined>;
|
|
233
|
+
docMemberCapabilities(doc_id: DocumentId): Promise<Membership[]>;
|
|
234
|
+
accessForDoc(id: Identifier, doc_id: DocumentId): Promise<Access | undefined>;
|
|
235
|
+
intoArchive(): Promise<Archive>;
|
|
236
|
+
toArchive(): Promise<Archive>;
|
|
269
237
|
ingestArchive(archive: Archive): Promise<void>;
|
|
238
|
+
ingestEventsBytes(events_bytes_array: Array<any>): Promise<Array<any>>;
|
|
239
|
+
stats(): Promise<Stats>;
|
|
270
240
|
readonly id: IndividualId;
|
|
271
241
|
readonly whoami: IndividualId;
|
|
242
|
+
readonly individual: Promise<Individual>;
|
|
272
243
|
readonly idString: string;
|
|
273
244
|
}
|
|
274
245
|
export class Membered {
|
|
@@ -276,6 +247,13 @@ export class Membered {
|
|
|
276
247
|
free(): void;
|
|
277
248
|
[Symbol.dispose](): void;
|
|
278
249
|
}
|
|
250
|
+
export class Membership {
|
|
251
|
+
private constructor();
|
|
252
|
+
free(): void;
|
|
253
|
+
[Symbol.dispose](): void;
|
|
254
|
+
readonly who: Agent;
|
|
255
|
+
readonly can: Access;
|
|
256
|
+
}
|
|
279
257
|
export class Peer {
|
|
280
258
|
private constructor();
|
|
281
259
|
free(): void;
|
|
@@ -284,11 +262,8 @@ export class Peer {
|
|
|
284
262
|
isIndividual(): boolean;
|
|
285
263
|
isGroup(): boolean;
|
|
286
264
|
isDocument(): boolean;
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
private constructor();
|
|
290
|
-
free(): void;
|
|
291
|
-
[Symbol.dispose](): void;
|
|
265
|
+
__wasm_refgen_toPeer(): Peer;
|
|
266
|
+
readonly id: Identifier;
|
|
292
267
|
}
|
|
293
268
|
export class Revocation {
|
|
294
269
|
private constructor();
|
|
@@ -299,18 +274,6 @@ export class Revocation {
|
|
|
299
274
|
readonly proof: SignedDelegation | undefined;
|
|
300
275
|
readonly after: History;
|
|
301
276
|
}
|
|
302
|
-
export class RevokeMemberError {
|
|
303
|
-
private constructor();
|
|
304
|
-
free(): void;
|
|
305
|
-
[Symbol.dispose](): void;
|
|
306
|
-
readonly message: string;
|
|
307
|
-
}
|
|
308
|
-
export class SerializationError {
|
|
309
|
-
private constructor();
|
|
310
|
-
free(): void;
|
|
311
|
-
[Symbol.dispose](): void;
|
|
312
|
-
toError(): any;
|
|
313
|
-
}
|
|
314
277
|
export class ShareKey {
|
|
315
278
|
private constructor();
|
|
316
279
|
free(): void;
|
|
@@ -373,18 +336,16 @@ export class Signer {
|
|
|
373
336
|
readonly variant: string;
|
|
374
337
|
readonly verifyingKey: Uint8Array;
|
|
375
338
|
}
|
|
376
|
-
export class
|
|
339
|
+
export class Stats {
|
|
377
340
|
private constructor();
|
|
378
341
|
free(): void;
|
|
379
342
|
[Symbol.dispose](): void;
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
readonly who: Agent;
|
|
387
|
-
readonly can: Access;
|
|
343
|
+
toString(): string;
|
|
344
|
+
readonly individuals: bigint;
|
|
345
|
+
readonly groups: bigint;
|
|
346
|
+
readonly docs: bigint;
|
|
347
|
+
readonly delegations: bigint;
|
|
348
|
+
readonly revocations: bigint;
|
|
388
349
|
}
|
|
389
350
|
export class Summary {
|
|
390
351
|
private constructor();
|
|
@@ -393,9 +354,3 @@ export class Summary {
|
|
|
393
354
|
readonly doc: Document;
|
|
394
355
|
readonly access: Access;
|
|
395
356
|
}
|
|
396
|
-
export class TryFromArchiveError {
|
|
397
|
-
private constructor();
|
|
398
|
-
free(): void;
|
|
399
|
-
[Symbol.dispose](): void;
|
|
400
|
-
toError(): any;
|
|
401
|
-
}
|