@keyhive/keyhive 0.0.0-alpha.0 → 0.0.0-alpha.10
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 +18 -5
- package/pkg/README.md +1 -6
- package/pkg/keyhive_wasm.d.ts +56 -1
- package/pkg/keyhive_wasm_bg.js +213 -128
- package/pkg/keyhive_wasm_bg.wasm +0 -0
- package/pkg/keyhive_wasm_bg.wasm.d.ts +96 -92
- package/pkg-node/README.md +1 -6
- package/pkg-node/keyhive_wasm.d.ts +56 -1
- package/pkg-node/keyhive_wasm.js +364 -229
- package/pkg-node/keyhive_wasm_bg.wasm +0 -0
- package/pkg-node/keyhive_wasm_bg.wasm.d.ts +96 -92
- package/pkg-slim/.gitignore +1 -0
- package/pkg-slim/README.md +29 -0
- package/pkg-slim/index.d.ts +2 -0
- package/pkg-slim/index.js +12 -0
- package/pkg-slim/index.ts +15 -0
- package/pkg-slim/keyhive_wasm.d.ts +640 -0
- package/pkg-slim/keyhive_wasm.js +3554 -0
- package/pkg-slim/keyhive_wasm_bg.wasm +0 -0
- package/pkg-slim/keyhive_wasm_bg.wasm.base64.d.ts +4 -0
- package/pkg-slim/keyhive_wasm_bg.wasm.base64.js +2 -0
- package/pkg-slim/keyhive_wasm_bg.wasm.d.ts +212 -0
- package/pkg-slim/package.json +26 -0
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.10",
|
|
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,12 +24,22 @@
|
|
|
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
|
+
"types": "./pkg-slim/keyhive_wasm_bg.wasm.base64.d.ts"
|
|
26
36
|
}
|
|
27
37
|
},
|
|
28
38
|
"devDependencies": {
|
|
29
39
|
"@playwright/test": "^1.55.0",
|
|
30
40
|
"@types/node": "^22.17.2",
|
|
31
41
|
"html-webpack-plugin": "^5.6.4",
|
|
42
|
+
"http-server": "^14.1.1",
|
|
32
43
|
"ts-loader": "^9.5.2",
|
|
33
44
|
"typescript": "^5.9.2",
|
|
34
45
|
"vite": "^5.4.19",
|
|
@@ -39,8 +50,10 @@
|
|
|
39
50
|
"webpack-dev-server": "^5.2.2"
|
|
40
51
|
},
|
|
41
52
|
"scripts": {
|
|
42
|
-
"build": "
|
|
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"
|
|
53
|
+
"build": "pnpm run build-node && pnpm run build-bundler && pnpm run build-slim",
|
|
54
|
+
"build-node": "wasm-pack build --out-dir pkg-node --target nodejs --release -- --features ingest_static",
|
|
55
|
+
"build-bundler": "wasm-pack build --out-dir pkg --target bundler --release -- --features ingest_static",
|
|
56
|
+
"build-web": "wasm-pack build --out-dir pkg-web --target web --release -- --features ingest_static",
|
|
57
|
+
"build-slim": "node build_slim.js"
|
|
45
58
|
}
|
|
46
59
|
}
|
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
|
@@ -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,21 +109,25 @@ 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;
|
|
115
|
+
toMembered(): Membered;
|
|
100
116
|
readonly id: Identifier;
|
|
101
117
|
readonly doc_id: DocumentId;
|
|
102
118
|
}
|
|
103
119
|
export class DocumentId {
|
|
104
120
|
free(): void;
|
|
121
|
+
[Symbol.dispose](): void;
|
|
105
122
|
constructor(bytes: Uint8Array);
|
|
106
|
-
|
|
123
|
+
toString(): string;
|
|
107
124
|
toJsValue(): any;
|
|
108
125
|
toBytes(): Uint8Array;
|
|
109
126
|
}
|
|
110
127
|
export class Encrypted {
|
|
111
128
|
private constructor();
|
|
112
129
|
free(): void;
|
|
130
|
+
[Symbol.dispose](): void;
|
|
113
131
|
toBytes(): Uint8Array;
|
|
114
132
|
readonly ciphertext: Uint8Array;
|
|
115
133
|
readonly nonce: Uint8Array;
|
|
@@ -120,12 +138,14 @@ export class Encrypted {
|
|
|
120
138
|
export class EncryptedContentWithUpdate {
|
|
121
139
|
private constructor();
|
|
122
140
|
free(): void;
|
|
141
|
+
[Symbol.dispose](): void;
|
|
123
142
|
encrypted_content(): Encrypted;
|
|
124
143
|
update_op(): SignedCgkaOperation | undefined;
|
|
125
144
|
}
|
|
126
145
|
export class Event {
|
|
127
146
|
private constructor();
|
|
128
147
|
free(): void;
|
|
148
|
+
[Symbol.dispose](): void;
|
|
129
149
|
tryIntoSignedDelegation(): SignedDelegation | undefined;
|
|
130
150
|
tryIntoSignedRevocation(): SignedRevocation | undefined;
|
|
131
151
|
readonly variant: string;
|
|
@@ -135,21 +155,25 @@ export class Event {
|
|
|
135
155
|
export class GenerateDocError {
|
|
136
156
|
private constructor();
|
|
137
157
|
free(): void;
|
|
158
|
+
[Symbol.dispose](): void;
|
|
138
159
|
message(): string;
|
|
139
160
|
}
|
|
140
161
|
export class GenerateWebCryptoError {
|
|
141
162
|
private constructor();
|
|
142
163
|
free(): void;
|
|
164
|
+
[Symbol.dispose](): void;
|
|
143
165
|
message(): string;
|
|
144
166
|
}
|
|
145
167
|
export class GetCiphertextError {
|
|
146
168
|
private constructor();
|
|
147
169
|
free(): void;
|
|
170
|
+
[Symbol.dispose](): void;
|
|
148
171
|
readonly message: string;
|
|
149
172
|
}
|
|
150
173
|
export class Group {
|
|
151
174
|
private constructor();
|
|
152
175
|
free(): void;
|
|
176
|
+
[Symbol.dispose](): void;
|
|
153
177
|
toPeer(): Peer;
|
|
154
178
|
toAgent(): Agent;
|
|
155
179
|
toMembered(): Membered;
|
|
@@ -160,23 +184,27 @@ export class Group {
|
|
|
160
184
|
export class GroupId {
|
|
161
185
|
private constructor();
|
|
162
186
|
free(): void;
|
|
187
|
+
[Symbol.dispose](): void;
|
|
163
188
|
toString(): string;
|
|
164
189
|
}
|
|
165
190
|
export class History {
|
|
166
191
|
private constructor();
|
|
167
192
|
free(): void;
|
|
193
|
+
[Symbol.dispose](): void;
|
|
168
194
|
delegations(): SignedDelegation[];
|
|
169
195
|
revocations(): SignedRevocation[];
|
|
170
196
|
contentRefs(): DocContentRefs[];
|
|
171
197
|
}
|
|
172
198
|
export class Identifier {
|
|
173
199
|
free(): void;
|
|
200
|
+
[Symbol.dispose](): void;
|
|
174
201
|
constructor(bytes: Uint8Array);
|
|
175
202
|
toBytes(): Uint8Array;
|
|
176
203
|
}
|
|
177
204
|
export class Individual {
|
|
178
205
|
private constructor();
|
|
179
206
|
free(): void;
|
|
207
|
+
[Symbol.dispose](): void;
|
|
180
208
|
toPeer(): Peer;
|
|
181
209
|
toAgent(): Agent;
|
|
182
210
|
pickPrekey(doc_id: DocumentId): ShareKey;
|
|
@@ -186,31 +214,38 @@ export class Individual {
|
|
|
186
214
|
export class IndividualId {
|
|
187
215
|
private constructor();
|
|
188
216
|
free(): void;
|
|
217
|
+
[Symbol.dispose](): void;
|
|
189
218
|
readonly bytes: Uint8Array;
|
|
190
219
|
}
|
|
191
220
|
export class Invocation {
|
|
192
221
|
private constructor();
|
|
193
222
|
free(): void;
|
|
223
|
+
[Symbol.dispose](): void;
|
|
194
224
|
}
|
|
195
225
|
export class JsDecryptError {
|
|
196
226
|
private constructor();
|
|
197
227
|
free(): void;
|
|
228
|
+
[Symbol.dispose](): void;
|
|
198
229
|
}
|
|
199
230
|
export class JsEncryptError {
|
|
200
231
|
private constructor();
|
|
201
232
|
free(): void;
|
|
233
|
+
[Symbol.dispose](): void;
|
|
202
234
|
}
|
|
203
235
|
export class JsReceivePreKeyOpError {
|
|
204
236
|
private constructor();
|
|
205
237
|
free(): void;
|
|
238
|
+
[Symbol.dispose](): void;
|
|
206
239
|
}
|
|
207
240
|
export class JsReceiveStaticEventError {
|
|
208
241
|
private constructor();
|
|
209
242
|
free(): void;
|
|
243
|
+
[Symbol.dispose](): void;
|
|
210
244
|
}
|
|
211
245
|
export class Keyhive {
|
|
212
246
|
private constructor();
|
|
213
247
|
free(): void;
|
|
248
|
+
[Symbol.dispose](): void;
|
|
214
249
|
static init(signer: Signer, ciphertext_store: CiphertextStore, event_handler: Function): Promise<Keyhive>;
|
|
215
250
|
generateGroup(coparents: Peer[]): Promise<Group>;
|
|
216
251
|
generateDocument(coparents: Peer[], initial_content_ref_head: ChangeRef, more_initial_content_refs: ChangeRef[]): Promise<Document>;
|
|
@@ -228,21 +263,26 @@ export class Keyhive {
|
|
|
228
263
|
receiveContactCard(contact_card: ContactCard): Individual;
|
|
229
264
|
getAgent(id: Identifier): Agent | undefined;
|
|
230
265
|
getGroup(id: Identifier): Group | undefined;
|
|
266
|
+
getDocument(id: Identifier): Document | undefined;
|
|
231
267
|
docMemberCapabilities(doc_id: DocumentId): SimpleCapability[];
|
|
232
268
|
accessForDoc(id: Identifier, doc_id: DocumentId): Access | undefined;
|
|
233
269
|
intoArchive(): Archive;
|
|
234
270
|
toArchive(): Archive;
|
|
271
|
+
ingestArchive(archive: Archive): Promise<void>;
|
|
235
272
|
readonly id: IndividualId;
|
|
236
273
|
readonly whoami: IndividualId;
|
|
274
|
+
readonly individual: Individual;
|
|
237
275
|
readonly idString: string;
|
|
238
276
|
}
|
|
239
277
|
export class Membered {
|
|
240
278
|
private constructor();
|
|
241
279
|
free(): void;
|
|
280
|
+
[Symbol.dispose](): void;
|
|
242
281
|
}
|
|
243
282
|
export class Peer {
|
|
244
283
|
private constructor();
|
|
245
284
|
free(): void;
|
|
285
|
+
[Symbol.dispose](): void;
|
|
246
286
|
toString(): string;
|
|
247
287
|
isIndividual(): boolean;
|
|
248
288
|
isGroup(): boolean;
|
|
@@ -251,10 +291,12 @@ export class Peer {
|
|
|
251
291
|
export class RemoveCiphertextError {
|
|
252
292
|
private constructor();
|
|
253
293
|
free(): void;
|
|
294
|
+
[Symbol.dispose](): void;
|
|
254
295
|
}
|
|
255
296
|
export class Revocation {
|
|
256
297
|
private constructor();
|
|
257
298
|
free(): void;
|
|
299
|
+
[Symbol.dispose](): void;
|
|
258
300
|
readonly subject_id: Identifier;
|
|
259
301
|
readonly revoked: SignedDelegation;
|
|
260
302
|
readonly proof: SignedDelegation | undefined;
|
|
@@ -263,20 +305,24 @@ export class Revocation {
|
|
|
263
305
|
export class RevokeMemberError {
|
|
264
306
|
private constructor();
|
|
265
307
|
free(): void;
|
|
308
|
+
[Symbol.dispose](): void;
|
|
266
309
|
readonly message: string;
|
|
267
310
|
}
|
|
268
311
|
export class SerializationError {
|
|
269
312
|
private constructor();
|
|
270
313
|
free(): void;
|
|
314
|
+
[Symbol.dispose](): void;
|
|
271
315
|
toError(): any;
|
|
272
316
|
}
|
|
273
317
|
export class ShareKey {
|
|
274
318
|
private constructor();
|
|
275
319
|
free(): void;
|
|
320
|
+
[Symbol.dispose](): void;
|
|
276
321
|
}
|
|
277
322
|
export class Signed {
|
|
278
323
|
private constructor();
|
|
279
324
|
free(): void;
|
|
325
|
+
[Symbol.dispose](): void;
|
|
280
326
|
static fromBytes(bytes: Uint8Array): Signed;
|
|
281
327
|
toBytes(): Uint8Array;
|
|
282
328
|
verify(): boolean;
|
|
@@ -287,6 +333,7 @@ export class Signed {
|
|
|
287
333
|
export class SignedCgkaOperation {
|
|
288
334
|
private constructor();
|
|
289
335
|
free(): void;
|
|
336
|
+
[Symbol.dispose](): void;
|
|
290
337
|
verify(): boolean;
|
|
291
338
|
readonly delegation: CgkaOperation;
|
|
292
339
|
readonly verifyingKey: Uint8Array;
|
|
@@ -295,6 +342,7 @@ export class SignedCgkaOperation {
|
|
|
295
342
|
export class SignedDelegation {
|
|
296
343
|
private constructor();
|
|
297
344
|
free(): void;
|
|
345
|
+
[Symbol.dispose](): void;
|
|
298
346
|
verify(): boolean;
|
|
299
347
|
readonly delegation: Delegation;
|
|
300
348
|
readonly verifyingKey: Uint8Array;
|
|
@@ -303,10 +351,12 @@ export class SignedDelegation {
|
|
|
303
351
|
export class SignedInvocation {
|
|
304
352
|
private constructor();
|
|
305
353
|
free(): void;
|
|
354
|
+
[Symbol.dispose](): void;
|
|
306
355
|
}
|
|
307
356
|
export class SignedRevocation {
|
|
308
357
|
private constructor();
|
|
309
358
|
free(): void;
|
|
359
|
+
[Symbol.dispose](): void;
|
|
310
360
|
verify(): boolean;
|
|
311
361
|
readonly delegation: Revocation;
|
|
312
362
|
readonly verifyingKey: Uint8Array;
|
|
@@ -315,6 +365,7 @@ export class SignedRevocation {
|
|
|
315
365
|
export class Signer {
|
|
316
366
|
private constructor();
|
|
317
367
|
free(): void;
|
|
368
|
+
[Symbol.dispose](): void;
|
|
318
369
|
static generate(): Promise<Signer>;
|
|
319
370
|
static generateMemory(): Signer;
|
|
320
371
|
static generateWebCrypto(): Promise<Signer>;
|
|
@@ -328,22 +379,26 @@ export class Signer {
|
|
|
328
379
|
export class SigningError {
|
|
329
380
|
private constructor();
|
|
330
381
|
free(): void;
|
|
382
|
+
[Symbol.dispose](): void;
|
|
331
383
|
message(): string;
|
|
332
384
|
}
|
|
333
385
|
export class SimpleCapability {
|
|
334
386
|
private constructor();
|
|
335
387
|
free(): void;
|
|
388
|
+
[Symbol.dispose](): void;
|
|
336
389
|
readonly who: Agent;
|
|
337
390
|
readonly can: Access;
|
|
338
391
|
}
|
|
339
392
|
export class Summary {
|
|
340
393
|
private constructor();
|
|
341
394
|
free(): void;
|
|
395
|
+
[Symbol.dispose](): void;
|
|
342
396
|
readonly doc: Document;
|
|
343
397
|
readonly access: Access;
|
|
344
398
|
}
|
|
345
399
|
export class TryFromArchiveError {
|
|
346
400
|
private constructor();
|
|
347
401
|
free(): void;
|
|
402
|
+
[Symbol.dispose](): void;
|
|
348
403
|
toError(): any;
|
|
349
404
|
}
|