@automerge/subduction 0.4.2-alpha.0
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 +40 -0
- package/dist/@automerge/subduction.wasm +0 -0
- package/dist/cjs/node.cjs +1 -0
- package/dist/cjs/slim.cjs +4297 -0
- package/dist/cjs/wasm-base64.cjs +1 -0
- package/dist/cjs/web.cjs +4248 -0
- package/dist/esm/bundler.js +1 -0
- package/dist/esm/node.js +1 -0
- package/dist/esm/slim.js +2 -0
- package/dist/esm/wasm-base64.js +1 -0
- package/dist/esm/web.js +5 -0
- package/dist/esm/workerd.js +5 -0
- package/dist/iife/index.js +4211 -0
- package/dist/index.d.ts +1344 -0
- package/dist/wasm_bindgen/bundler/snippets/sedimentree_wasm-02bbe03284226492/inline0.js +2 -0
- package/dist/wasm_bindgen/bundler/snippets/sedimentree_wasm-02bbe03284226492/inline1.js +2 -0
- package/dist/wasm_bindgen/bundler/snippets/sedimentree_wasm-02bbe03284226492/inline2.js +2 -0
- package/dist/wasm_bindgen/bundler/subduction_wasm.d.ts +1344 -0
- package/dist/wasm_bindgen/bundler/subduction_wasm.js +9 -0
- package/dist/wasm_bindgen/bundler/subduction_wasm_bg.js +4288 -0
- package/dist/wasm_bindgen/bundler/subduction_wasm_bg.wasm +0 -0
- package/dist/wasm_bindgen/bundler/subduction_wasm_bg.wasm.d.ts +213 -0
- package/dist/wasm_bindgen/nodejs/snippets/sedimentree_wasm-02bbe03284226492/inline0.js +2 -0
- package/dist/wasm_bindgen/nodejs/snippets/sedimentree_wasm-02bbe03284226492/inline1.js +2 -0
- package/dist/wasm_bindgen/nodejs/snippets/sedimentree_wasm-02bbe03284226492/inline2.js +2 -0
- package/dist/wasm_bindgen/nodejs/subduction_wasm.cjs +4326 -0
- package/dist/wasm_bindgen/nodejs/subduction_wasm.d.ts +1344 -0
- package/dist/wasm_bindgen/nodejs/subduction_wasm_bg.wasm +0 -0
- package/dist/wasm_bindgen/nodejs/subduction_wasm_bg.wasm.d.ts +213 -0
- package/dist/wasm_bindgen/web/snippets/sedimentree_wasm-02bbe03284226492/inline0.js +2 -0
- package/dist/wasm_bindgen/web/snippets/sedimentree_wasm-02bbe03284226492/inline1.js +2 -0
- package/dist/wasm_bindgen/web/snippets/sedimentree_wasm-02bbe03284226492/inline2.js +2 -0
- package/dist/wasm_bindgen/web/subduction_wasm.d.ts +1582 -0
- package/dist/wasm_bindgen/web/subduction_wasm.js +4386 -0
- package/dist/wasm_bindgen/web/subduction_wasm_bg.wasm +0 -0
- package/dist/wasm_bindgen/web/subduction_wasm_bg.wasm.d.ts +213 -0
- package/package.json +91 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,1344 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
export interface Connection {
|
|
5
|
+
peerId(): PeerId;
|
|
6
|
+
disconnect(): Promise<void>;
|
|
7
|
+
send(message: Message): Promise<void>;
|
|
8
|
+
recv(): Promise<Message>;
|
|
9
|
+
nextRequestId(): Promise<RequestId>;
|
|
10
|
+
call(request: BatchSyncRequest, timeoutMs: number | null): Promise<BatchSyncResponse>;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
export interface SedimentreeStorage {
|
|
16
|
+
saveSedimentreeId(sedimentreeId: SedimentreeId): Promise<void>;
|
|
17
|
+
deleteSedimentreeId(sedimentreeId: SedimentreeId): Promise<void>;
|
|
18
|
+
loadAllSedimentreeIds(): Promise<SedimentreeId[]>;
|
|
19
|
+
|
|
20
|
+
// Compound storage for commits (signed data + blob stored together)
|
|
21
|
+
saveCommit(sedimentreeId: SedimentreeId, digest: Digest, signedCommit: SignedLooseCommit, blob: Uint8Array): Promise<void>;
|
|
22
|
+
loadCommit(sedimentreeId: SedimentreeId, digest: Digest): Promise<CommitWithBlob | null>;
|
|
23
|
+
listCommitDigests(sedimentreeId: SedimentreeId): Promise<Digest[]>;
|
|
24
|
+
loadAllCommits(sedimentreeId: SedimentreeId): Promise<CommitWithBlob[]>;
|
|
25
|
+
deleteCommit(sedimentreeId: SedimentreeId, digest: Digest): Promise<void>;
|
|
26
|
+
deleteAllCommits(sedimentreeId: SedimentreeId): Promise<void>;
|
|
27
|
+
|
|
28
|
+
// Compound storage for fragments (signed data + blob stored together)
|
|
29
|
+
saveFragment(sedimentreeId: SedimentreeId, digest: Digest, signedFragment: SignedFragment, blob: Uint8Array): Promise<void>;
|
|
30
|
+
loadFragment(sedimentreeId: SedimentreeId, digest: Digest): Promise<FragmentWithBlob | null>;
|
|
31
|
+
listFragmentDigests(sedimentreeId: SedimentreeId): Promise<Digest[]>;
|
|
32
|
+
loadAllFragments(sedimentreeId: SedimentreeId): Promise<FragmentWithBlob[]>;
|
|
33
|
+
deleteFragment(sedimentreeId: SedimentreeId, digest: Digest): Promise<void>;
|
|
34
|
+
deleteAllFragments(sedimentreeId: SedimentreeId): Promise<void>;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* An authenticated HTTP long-poll connection.
|
|
41
|
+
*
|
|
42
|
+
* This wrapper proves that the connection has completed the Subduction handshake
|
|
43
|
+
* and the peer identity has been cryptographically verified.
|
|
44
|
+
*
|
|
45
|
+
* Obtain via [`SubductionLongPoll::tryConnect`] or [`SubductionLongPoll::tryDiscover`].
|
|
46
|
+
*/
|
|
47
|
+
export class AuthenticatedLongPoll {
|
|
48
|
+
private constructor();
|
|
49
|
+
free(): void;
|
|
50
|
+
[Symbol.dispose](): void;
|
|
51
|
+
/**
|
|
52
|
+
* The verified peer identity.
|
|
53
|
+
*/
|
|
54
|
+
readonly peerId: PeerId;
|
|
55
|
+
/**
|
|
56
|
+
* The session ID assigned by the server.
|
|
57
|
+
*/
|
|
58
|
+
readonly sessionId: string;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* An authenticated WebSocket connection.
|
|
63
|
+
*
|
|
64
|
+
* This wrapper proves that the connection has completed the Subduction handshake
|
|
65
|
+
* and the peer identity has been cryptographically verified.
|
|
66
|
+
*
|
|
67
|
+
* Obtain via [`SubductionWebSocket::setup`], [`SubductionWebSocket::tryConnect`],
|
|
68
|
+
* or [`SubductionWebSocket::tryDiscover`].
|
|
69
|
+
*/
|
|
70
|
+
export class AuthenticatedWebSocket {
|
|
71
|
+
private constructor();
|
|
72
|
+
free(): void;
|
|
73
|
+
[Symbol.dispose](): void;
|
|
74
|
+
/**
|
|
75
|
+
* The verified peer identity.
|
|
76
|
+
*/
|
|
77
|
+
readonly peerId: PeerId;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Wasm wrapper for [`BatchSyncRequest`].
|
|
82
|
+
*/
|
|
83
|
+
export class BatchSyncRequest {
|
|
84
|
+
private constructor();
|
|
85
|
+
free(): void;
|
|
86
|
+
[Symbol.dispose](): void;
|
|
87
|
+
/**
|
|
88
|
+
* The sedimentree ID this request corresponds to.
|
|
89
|
+
*/
|
|
90
|
+
id(): SedimentreeId;
|
|
91
|
+
/**
|
|
92
|
+
* The request ID for this request.
|
|
93
|
+
*/
|
|
94
|
+
request_id(): RequestId;
|
|
95
|
+
/**
|
|
96
|
+
* Whether this request subscribes to future updates.
|
|
97
|
+
*/
|
|
98
|
+
subscribe(): boolean;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Wasm wrapper for [`BatchSyncResponse`].
|
|
103
|
+
*/
|
|
104
|
+
export class BatchSyncResponse {
|
|
105
|
+
private constructor();
|
|
106
|
+
free(): void;
|
|
107
|
+
[Symbol.dispose](): void;
|
|
108
|
+
/**
|
|
109
|
+
* Upcasts; to the JS-import type for [`WasmBatchSyncResponse`].
|
|
110
|
+
*/
|
|
111
|
+
__wasm_refgen_toWasmBatchSyncResponse(): BatchSyncResponse;
|
|
112
|
+
/**
|
|
113
|
+
* The sedimentree ID this response corresponds to.
|
|
114
|
+
*/
|
|
115
|
+
id(): SedimentreeId;
|
|
116
|
+
/**
|
|
117
|
+
* The request ID this response corresponds to.
|
|
118
|
+
*/
|
|
119
|
+
request_id(): RequestId;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* A Wasm wrapper around the [`BlobMeta`] type.
|
|
124
|
+
*/
|
|
125
|
+
export class BlobMeta {
|
|
126
|
+
free(): void;
|
|
127
|
+
[Symbol.dispose](): void;
|
|
128
|
+
/**
|
|
129
|
+
* Get the digest of the blob.
|
|
130
|
+
*/
|
|
131
|
+
digest(): Digest;
|
|
132
|
+
/**
|
|
133
|
+
* Create a `BlobMeta` from a digest and size.
|
|
134
|
+
*
|
|
135
|
+
* This is useful for deserialization when the original blob is not available.
|
|
136
|
+
* Since this is manual, the caller must ensure the digest and size are correct.
|
|
137
|
+
*/
|
|
138
|
+
static fromDigestSize(digest: Digest, size_bytes: bigint): BlobMeta;
|
|
139
|
+
/**
|
|
140
|
+
* Create a new `BlobMeta` from the given blob contents.
|
|
141
|
+
*/
|
|
142
|
+
constructor(blob: Uint8Array);
|
|
143
|
+
/**
|
|
144
|
+
* Get the size of the blob in bytes.
|
|
145
|
+
*/
|
|
146
|
+
readonly sizeBytes: bigint;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Wasm wrapper for call errors from the unified transport.
|
|
151
|
+
*/
|
|
152
|
+
export class CallError {
|
|
153
|
+
private constructor();
|
|
154
|
+
free(): void;
|
|
155
|
+
[Symbol.dispose](): void;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* A commit stored with its associated blob.
|
|
160
|
+
*/
|
|
161
|
+
export class CommitWithBlob {
|
|
162
|
+
free(): void;
|
|
163
|
+
[Symbol.dispose](): void;
|
|
164
|
+
/**
|
|
165
|
+
* Upcasts; to the JS-import type for [`WasmCommitWithBlob`].
|
|
166
|
+
*/
|
|
167
|
+
__wasm_refgen_toWasmCommitWithBlob(): CommitWithBlob;
|
|
168
|
+
/**
|
|
169
|
+
* Create a new commit with blob.
|
|
170
|
+
*/
|
|
171
|
+
constructor(signed: SignedLooseCommit, blob: Uint8Array);
|
|
172
|
+
/**
|
|
173
|
+
* Get the blob.
|
|
174
|
+
*/
|
|
175
|
+
readonly blob: Uint8Array;
|
|
176
|
+
/**
|
|
177
|
+
* Get the signed commit.
|
|
178
|
+
*/
|
|
179
|
+
readonly signed: SignedLooseCommit;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* A pair of a connection and an error that occurred during a call.
|
|
184
|
+
*/
|
|
185
|
+
export class ConnErrorPair {
|
|
186
|
+
private constructor();
|
|
187
|
+
free(): void;
|
|
188
|
+
[Symbol.dispose](): void;
|
|
189
|
+
/**
|
|
190
|
+
* The connection that encountered the error.
|
|
191
|
+
*/
|
|
192
|
+
readonly conn: Connection;
|
|
193
|
+
/**
|
|
194
|
+
* The error that occurred during the call.
|
|
195
|
+
*/
|
|
196
|
+
readonly err: Error;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* A Wasm wrapper around the Rust `ConnectionId` type.
|
|
201
|
+
*/
|
|
202
|
+
export class ConnectionId {
|
|
203
|
+
private constructor();
|
|
204
|
+
free(): void;
|
|
205
|
+
[Symbol.dispose](): void;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* A JavaScript wrapper around `Depth`.
|
|
210
|
+
*/
|
|
211
|
+
export class Depth {
|
|
212
|
+
free(): void;
|
|
213
|
+
[Symbol.dispose](): void;
|
|
214
|
+
/**
|
|
215
|
+
* Internal method for a hack crossing the JS boundary.
|
|
216
|
+
*/
|
|
217
|
+
__subduction_castToDepth(): Depth;
|
|
218
|
+
/**
|
|
219
|
+
* Upcasts; to the JS-import type for [`WasmDepth`].
|
|
220
|
+
*/
|
|
221
|
+
__wasm_refgen_toWasmDepth(): Depth;
|
|
222
|
+
/**
|
|
223
|
+
* Creates a new `WasmDepth` from a JavaScript value.
|
|
224
|
+
*
|
|
225
|
+
* # Errors
|
|
226
|
+
*
|
|
227
|
+
* Returns a `NotU32Error` if the JS value is not safely coercible to `u32`.
|
|
228
|
+
*/
|
|
229
|
+
constructor(js_value: any);
|
|
230
|
+
/**
|
|
231
|
+
* The depth value as an integer.
|
|
232
|
+
*/
|
|
233
|
+
readonly value: number;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* A wrapper around digest bytes for use in JavaScript via wasm-bindgen.
|
|
238
|
+
*
|
|
239
|
+
* Since JavaScript doesn't have Rust's type system, this stores raw bytes
|
|
240
|
+
* and converts to/from typed `Digest<T>` at the Rust boundary.
|
|
241
|
+
*/
|
|
242
|
+
export class Digest {
|
|
243
|
+
free(): void;
|
|
244
|
+
[Symbol.dispose](): void;
|
|
245
|
+
/**
|
|
246
|
+
* Upcasts; to the JS-import type for [`WasmDigest`].
|
|
247
|
+
*/
|
|
248
|
+
__wasm_refgen_toWasmDigest(): Digest;
|
|
249
|
+
/**
|
|
250
|
+
* Creates a new digest from its Base58 string representation.
|
|
251
|
+
*
|
|
252
|
+
* # Errors
|
|
253
|
+
*
|
|
254
|
+
* Returns a `WasmInvalidDigest` error if the string cannot be decoded or is not a valid digest.
|
|
255
|
+
*/
|
|
256
|
+
static fromBase58(s: string): Digest;
|
|
257
|
+
/**
|
|
258
|
+
* Creates a new digest from its byte representation.
|
|
259
|
+
*
|
|
260
|
+
* # Errors
|
|
261
|
+
*
|
|
262
|
+
* Returns a `WasmValue` error if the byte slice is not a valid digest.
|
|
263
|
+
*/
|
|
264
|
+
static fromBytes(bytes: Uint8Array): Digest;
|
|
265
|
+
/**
|
|
266
|
+
* Creates a new digest from its hexadecimal string representation.
|
|
267
|
+
*
|
|
268
|
+
* # Errors
|
|
269
|
+
*
|
|
270
|
+
* Returns a [`WasmInvalidDigest`] if the string is not a valid digest.
|
|
271
|
+
*/
|
|
272
|
+
static fromHexString(s: string): Digest;
|
|
273
|
+
/**
|
|
274
|
+
* Creates a new digest from its byte representation.
|
|
275
|
+
*
|
|
276
|
+
* # Errors
|
|
277
|
+
*
|
|
278
|
+
* Returns a `WasmValue` error if the byte slice is not a valid digest.
|
|
279
|
+
*/
|
|
280
|
+
constructor(bytes: Uint8Array);
|
|
281
|
+
/**
|
|
282
|
+
* Returns the byte representation of the digest.
|
|
283
|
+
*/
|
|
284
|
+
toBytes(): Uint8Array;
|
|
285
|
+
/**
|
|
286
|
+
* Returns the hexadecimal string representation of the digest.
|
|
287
|
+
*/
|
|
288
|
+
toHexString(): string;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* A data fragment used in the Sedimentree system.
|
|
293
|
+
*/
|
|
294
|
+
export class Fragment {
|
|
295
|
+
free(): void;
|
|
296
|
+
[Symbol.dispose](): void;
|
|
297
|
+
/**
|
|
298
|
+
* Upcasts; to the JS-import type for [`WasmFragment`].
|
|
299
|
+
*/
|
|
300
|
+
__wasm_refgen_toWasmFragment(): Fragment;
|
|
301
|
+
/**
|
|
302
|
+
* Create a new fragment from the given sedimentree ID, head, boundary, checkpoints, and blob metadata.
|
|
303
|
+
*/
|
|
304
|
+
constructor(sedimentree_id: SedimentreeId, head: Digest, boundary: Digest[], checkpoints: Digest[], blob_meta: BlobMeta);
|
|
305
|
+
/**
|
|
306
|
+
* Get the blob metadata of the fragment.
|
|
307
|
+
*/
|
|
308
|
+
readonly blobMeta: BlobMeta;
|
|
309
|
+
/**
|
|
310
|
+
* Get the boundary digests of the fragment.
|
|
311
|
+
*/
|
|
312
|
+
readonly boundary: Digest[];
|
|
313
|
+
/**
|
|
314
|
+
* Get the head digest of the fragment.
|
|
315
|
+
*/
|
|
316
|
+
readonly head: Digest;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* A request for a specific fragment in the Sedimentree system.
|
|
321
|
+
*/
|
|
322
|
+
export class FragmentRequested {
|
|
323
|
+
free(): void;
|
|
324
|
+
[Symbol.dispose](): void;
|
|
325
|
+
/**
|
|
326
|
+
* Create a new fragment request from the given digest.
|
|
327
|
+
*/
|
|
328
|
+
constructor(digest: Digest, depth: Depth);
|
|
329
|
+
/**
|
|
330
|
+
* Get the depth of the requested fragment.
|
|
331
|
+
*/
|
|
332
|
+
readonly depth: Depth;
|
|
333
|
+
/**
|
|
334
|
+
* Get the digest of the requested fragment.
|
|
335
|
+
*/
|
|
336
|
+
readonly head: Digest;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
/**
|
|
340
|
+
* A fragment stored with its associated blob.
|
|
341
|
+
*/
|
|
342
|
+
export class FragmentWithBlob {
|
|
343
|
+
free(): void;
|
|
344
|
+
[Symbol.dispose](): void;
|
|
345
|
+
/**
|
|
346
|
+
* Upcasts; to the JS-import type for [`WasmFragmentWithBlob`].
|
|
347
|
+
*/
|
|
348
|
+
__wasm_refgen_toWasmFragmentWithBlob(): FragmentWithBlob;
|
|
349
|
+
/**
|
|
350
|
+
* Create a new fragment with blob.
|
|
351
|
+
*/
|
|
352
|
+
constructor(signed: SignedFragment, blob: Uint8Array);
|
|
353
|
+
/**
|
|
354
|
+
* Get the blob.
|
|
355
|
+
*/
|
|
356
|
+
readonly blob: Uint8Array;
|
|
357
|
+
/**
|
|
358
|
+
* Get the signed fragment.
|
|
359
|
+
*/
|
|
360
|
+
readonly signed: SignedFragment;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
export class FragmentsArray {
|
|
364
|
+
private constructor();
|
|
365
|
+
free(): void;
|
|
366
|
+
[Symbol.dispose](): void;
|
|
367
|
+
/**
|
|
368
|
+
* Upcasts; to the JS-import type for [`WasmFragmentsArray`].
|
|
369
|
+
*/
|
|
370
|
+
__wasm_refgen_toWasmFragmentsArray(): FragmentsArray;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
/**
|
|
374
|
+
* An overridable hash metric.
|
|
375
|
+
*/
|
|
376
|
+
export class HashMetric {
|
|
377
|
+
free(): void;
|
|
378
|
+
[Symbol.dispose](): void;
|
|
379
|
+
/**
|
|
380
|
+
* Create a new `WasmHashMetric` with an optional JavaScript function.
|
|
381
|
+
*
|
|
382
|
+
* Defaults to counting leading zero bytes if no function is provided.
|
|
383
|
+
*/
|
|
384
|
+
constructor(func?: Function | null);
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* A Wasm wrapper around the [`LooseCommit`] type.
|
|
389
|
+
*/
|
|
390
|
+
export class LooseCommit {
|
|
391
|
+
free(): void;
|
|
392
|
+
[Symbol.dispose](): void;
|
|
393
|
+
/**
|
|
394
|
+
* Upcasts; to the JS-import type for [`WasmLooseCommit`].
|
|
395
|
+
*/
|
|
396
|
+
__wasm_refgen_toWasmLooseCommit(): LooseCommit;
|
|
397
|
+
/**
|
|
398
|
+
* Create a new `LooseCommit` from the given sedimentree ID, parents, and blob metadata.
|
|
399
|
+
*/
|
|
400
|
+
constructor(sedimentree_id: SedimentreeId, parents: Digest[], blob_meta: BlobMeta);
|
|
401
|
+
/**
|
|
402
|
+
* Get the blob metadata of the commit.
|
|
403
|
+
*/
|
|
404
|
+
readonly blobMeta: BlobMeta;
|
|
405
|
+
/**
|
|
406
|
+
* Get the digest of the commit.
|
|
407
|
+
*/
|
|
408
|
+
readonly digest: Digest;
|
|
409
|
+
/**
|
|
410
|
+
* Get the parent digests of the commit.
|
|
411
|
+
*/
|
|
412
|
+
readonly parents: Digest[];
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
/**
|
|
416
|
+
* An in-memory storage implementation for use in tests and development.
|
|
417
|
+
*
|
|
418
|
+
* This wraps the core `MemoryStorage` and exposes it via the `SedimentreeStorage` interface.
|
|
419
|
+
*/
|
|
420
|
+
export class MemoryStorage {
|
|
421
|
+
free(): void;
|
|
422
|
+
[Symbol.dispose](): void;
|
|
423
|
+
/**
|
|
424
|
+
* Delete all commits for a sedimentree.
|
|
425
|
+
*/
|
|
426
|
+
deleteAllCommits(sedimentree_id: SedimentreeId): Promise<any>;
|
|
427
|
+
/**
|
|
428
|
+
* Delete all fragments for a sedimentree.
|
|
429
|
+
*/
|
|
430
|
+
deleteAllFragments(sedimentree_id: SedimentreeId): Promise<any>;
|
|
431
|
+
/**
|
|
432
|
+
* Delete a commit by digest.
|
|
433
|
+
*/
|
|
434
|
+
deleteCommit(sedimentree_id: SedimentreeId, digest: Digest): Promise<any>;
|
|
435
|
+
/**
|
|
436
|
+
* Delete a fragment by digest.
|
|
437
|
+
*/
|
|
438
|
+
deleteFragment(sedimentree_id: SedimentreeId, digest: Digest): Promise<any>;
|
|
439
|
+
/**
|
|
440
|
+
* Delete a sedimentree ID.
|
|
441
|
+
*/
|
|
442
|
+
deleteSedimentreeId(sedimentree_id: SedimentreeId): Promise<any>;
|
|
443
|
+
/**
|
|
444
|
+
* List all commit digests for a sedimentree.
|
|
445
|
+
*/
|
|
446
|
+
listCommitDigests(sedimentree_id: SedimentreeId): Promise<any>;
|
|
447
|
+
/**
|
|
448
|
+
* List all fragment digests for a sedimentree.
|
|
449
|
+
*/
|
|
450
|
+
listFragmentDigests(sedimentree_id: SedimentreeId): Promise<any>;
|
|
451
|
+
/**
|
|
452
|
+
* Load all commits for a sedimentree, returning `CommitWithBlob[]`.
|
|
453
|
+
*/
|
|
454
|
+
loadAllCommits(sedimentree_id: SedimentreeId): Promise<any>;
|
|
455
|
+
/**
|
|
456
|
+
* Load all fragments for a sedimentree, returning `FragmentWithBlob[]`.
|
|
457
|
+
*/
|
|
458
|
+
loadAllFragments(sedimentree_id: SedimentreeId): Promise<any>;
|
|
459
|
+
/**
|
|
460
|
+
* Load all sedimentree IDs.
|
|
461
|
+
*/
|
|
462
|
+
loadAllSedimentreeIds(): Promise<any>;
|
|
463
|
+
/**
|
|
464
|
+
* Load a commit by digest, returning `CommitWithBlob` or null.
|
|
465
|
+
*/
|
|
466
|
+
loadCommit(sedimentree_id: SedimentreeId, digest: Digest): Promise<any>;
|
|
467
|
+
/**
|
|
468
|
+
* Load a fragment by digest, returning `FragmentWithBlob` or null.
|
|
469
|
+
*/
|
|
470
|
+
loadFragment(sedimentree_id: SedimentreeId, digest: Digest): Promise<any>;
|
|
471
|
+
/**
|
|
472
|
+
* Create a new in-memory storage instance.
|
|
473
|
+
*/
|
|
474
|
+
constructor();
|
|
475
|
+
/**
|
|
476
|
+
* Save a commit with its blob.
|
|
477
|
+
*/
|
|
478
|
+
saveCommit(sedimentree_id: SedimentreeId, _digest: Digest, signed_commit: SignedLooseCommit, blob: Uint8Array): Promise<any>;
|
|
479
|
+
/**
|
|
480
|
+
* Save a fragment with its blob.
|
|
481
|
+
*/
|
|
482
|
+
saveFragment(sedimentree_id: SedimentreeId, _digest: Digest, signed_fragment: SignedFragment, blob: Uint8Array): Promise<any>;
|
|
483
|
+
/**
|
|
484
|
+
* Save a sedimentree ID.
|
|
485
|
+
*/
|
|
486
|
+
saveSedimentreeId(sedimentree_id: SedimentreeId): Promise<any>;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
/**
|
|
490
|
+
* Wasm wrapper for [`Message`].
|
|
491
|
+
*/
|
|
492
|
+
export class Message {
|
|
493
|
+
private constructor();
|
|
494
|
+
free(): void;
|
|
495
|
+
[Symbol.dispose](): void;
|
|
496
|
+
/**
|
|
497
|
+
* Upcasts; to the JS-import type for [`WasmMessage`].
|
|
498
|
+
*/
|
|
499
|
+
__wasm_refgen_toWasmMessage(): Message;
|
|
500
|
+
/**
|
|
501
|
+
* Create a [`Message::BatchSyncRequest`] message.
|
|
502
|
+
*/
|
|
503
|
+
static batchSyncRequest(request: BatchSyncRequest): Message;
|
|
504
|
+
/**
|
|
505
|
+
* Create a [`Message::BatchSyncResponse`] message.
|
|
506
|
+
*/
|
|
507
|
+
static batchSyncResponse(response: BatchSyncResponse): Message;
|
|
508
|
+
/**
|
|
509
|
+
* Create a [`Message::BlobsRequest`] message.
|
|
510
|
+
*/
|
|
511
|
+
static blobsRequest(id: SedimentreeId, digests: Digest[]): Message;
|
|
512
|
+
/**
|
|
513
|
+
* Create a [`Message::BlobsResponse`] message.
|
|
514
|
+
*/
|
|
515
|
+
static blobsResponse(id: SedimentreeId, blobs: Uint8Array[]): Message;
|
|
516
|
+
/**
|
|
517
|
+
* Deserialize a message from bytes.
|
|
518
|
+
*
|
|
519
|
+
* # Errors
|
|
520
|
+
*
|
|
521
|
+
* Returns a [`JsMessageDeserializationError`] if deserialization fails.
|
|
522
|
+
*/
|
|
523
|
+
static fromBytes(bytes: Uint8Array): Message;
|
|
524
|
+
/**
|
|
525
|
+
* Serialize the message to bytes.
|
|
526
|
+
*/
|
|
527
|
+
toBytes(): Uint8Array;
|
|
528
|
+
/**
|
|
529
|
+
* The [`Blob`] for commit or fragment messages, if applicable.
|
|
530
|
+
*/
|
|
531
|
+
readonly blob: Uint8Array | undefined;
|
|
532
|
+
/**
|
|
533
|
+
* The [`Blob`]s for a [`Message::BlobsResponse`], if applicable.
|
|
534
|
+
*/
|
|
535
|
+
readonly blobs: Uint8Array[] | undefined;
|
|
536
|
+
/**
|
|
537
|
+
* The [`LooseCommit`] for a [`Message::LooseCommit`], if applicable.
|
|
538
|
+
*
|
|
539
|
+
* Decodes the signed payload to extract the underlying commit.
|
|
540
|
+
*/
|
|
541
|
+
readonly commit: LooseCommit | undefined;
|
|
542
|
+
/**
|
|
543
|
+
* The requested [`Digest`]s for a [`Message::BlobsRequest`], if applicable.
|
|
544
|
+
*/
|
|
545
|
+
readonly digests: Digest[] | undefined;
|
|
546
|
+
/**
|
|
547
|
+
* The [`Fragment`] for a [`Message::Fragment`], if applicable.
|
|
548
|
+
*
|
|
549
|
+
* Decodes the signed payload to extract the underlying fragment.
|
|
550
|
+
*/
|
|
551
|
+
readonly fragment: Fragment | undefined;
|
|
552
|
+
/**
|
|
553
|
+
* The [`BatchSyncRequest`] for a [`Message::BatchSyncRequest`], if applicable.
|
|
554
|
+
*/
|
|
555
|
+
readonly request: BatchSyncRequest | undefined;
|
|
556
|
+
/**
|
|
557
|
+
* The [`BatchSyncResponse`] for a [`Message::BatchSyncResponse`], if applicable.
|
|
558
|
+
*/
|
|
559
|
+
readonly response: BatchSyncResponse | undefined;
|
|
560
|
+
/**
|
|
561
|
+
* The [`SedimentreeId`] associated with this message, if any.
|
|
562
|
+
*/
|
|
563
|
+
readonly sedimentreeId: SedimentreeId | undefined;
|
|
564
|
+
/**
|
|
565
|
+
* The message variant name.
|
|
566
|
+
*/
|
|
567
|
+
readonly type: string;
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
/**
|
|
571
|
+
* A 64-bit nonce represented as big-endian bytes.
|
|
572
|
+
*/
|
|
573
|
+
export class Nonce {
|
|
574
|
+
free(): void;
|
|
575
|
+
[Symbol.dispose](): void;
|
|
576
|
+
/**
|
|
577
|
+
* Create a new [`WasmNonce`] from exactly 8 big-endian bytes.
|
|
578
|
+
*
|
|
579
|
+
* # Errors
|
|
580
|
+
*
|
|
581
|
+
* Returns [`WasmNonceError`] if the input is not exactly 8 bytes.
|
|
582
|
+
*/
|
|
583
|
+
constructor(bytes: Uint8Array);
|
|
584
|
+
/**
|
|
585
|
+
* Generate a random nonce.
|
|
586
|
+
*
|
|
587
|
+
* # Panics
|
|
588
|
+
*
|
|
589
|
+
* Panics if the system random number generator fails.
|
|
590
|
+
*/
|
|
591
|
+
static random(): Nonce;
|
|
592
|
+
/**
|
|
593
|
+
* Get the nonce as big-endian bytes.
|
|
594
|
+
*/
|
|
595
|
+
readonly bytes: Uint8Array;
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
/**
|
|
599
|
+
* Result of a peer batch sync request.
|
|
600
|
+
*/
|
|
601
|
+
export class PeerBatchSyncResult {
|
|
602
|
+
private constructor();
|
|
603
|
+
free(): void;
|
|
604
|
+
[Symbol.dispose](): void;
|
|
605
|
+
/**
|
|
606
|
+
* List of connection errors that occurred during the batch sync.
|
|
607
|
+
*/
|
|
608
|
+
readonly connErrors: ConnErrorPair[];
|
|
609
|
+
/**
|
|
610
|
+
* Statistics about the sync operation.
|
|
611
|
+
*/
|
|
612
|
+
readonly stats: SyncStats;
|
|
613
|
+
/**
|
|
614
|
+
* Whether the batch sync was successful with at least one connection.
|
|
615
|
+
*/
|
|
616
|
+
readonly success: boolean;
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
/**
|
|
620
|
+
* A JavaScript-compatible wrapper around the Rust `PeerId` type.
|
|
621
|
+
*/
|
|
622
|
+
export class PeerId {
|
|
623
|
+
free(): void;
|
|
624
|
+
[Symbol.dispose](): void;
|
|
625
|
+
/**
|
|
626
|
+
* Creates a new `WasmPeerId` from a `PeerId`.
|
|
627
|
+
*
|
|
628
|
+
* # Errors
|
|
629
|
+
*
|
|
630
|
+
* Returns a `WasmInvalidPeerId` if the provided byte slice is not exactly 32 bytes long.
|
|
631
|
+
*/
|
|
632
|
+
constructor(bytes: Uint8Array);
|
|
633
|
+
/**
|
|
634
|
+
* Returns the byte representation of the `PeerId`.
|
|
635
|
+
*/
|
|
636
|
+
toBytes(): Uint8Array;
|
|
637
|
+
/**
|
|
638
|
+
* Returns the string representation of the `PeerId`.
|
|
639
|
+
*/
|
|
640
|
+
toString(): string;
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
/**
|
|
644
|
+
* Map of peer IDs to their batch sync results.
|
|
645
|
+
*/
|
|
646
|
+
export class PeerResultMap {
|
|
647
|
+
private constructor();
|
|
648
|
+
free(): void;
|
|
649
|
+
[Symbol.dispose](): void;
|
|
650
|
+
/**
|
|
651
|
+
* Get all entries in the peer result map.
|
|
652
|
+
*/
|
|
653
|
+
entries(): PeerBatchSyncResult[];
|
|
654
|
+
/**
|
|
655
|
+
* Get the result for a specific peer ID.
|
|
656
|
+
*/
|
|
657
|
+
getResult(peer_id: PeerId): PeerBatchSyncResult | undefined;
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
/**
|
|
661
|
+
* Wasm wrapper for [`RequestId`].
|
|
662
|
+
*/
|
|
663
|
+
export class RequestId {
|
|
664
|
+
free(): void;
|
|
665
|
+
[Symbol.dispose](): void;
|
|
666
|
+
/**
|
|
667
|
+
* Upcasts; to the JS-import type for [`WasmRequestId`].
|
|
668
|
+
*/
|
|
669
|
+
__wasm_refgen_toWasmRequestId(): RequestId;
|
|
670
|
+
/**
|
|
671
|
+
* Create a new [`RequestId`] from a requestor peer ID and nonce.
|
|
672
|
+
*/
|
|
673
|
+
constructor(requestor: PeerId, nonce: Nonce);
|
|
674
|
+
/**
|
|
675
|
+
* The request nonce.
|
|
676
|
+
*/
|
|
677
|
+
readonly nonce: Nonce;
|
|
678
|
+
/**
|
|
679
|
+
* The peer ID of the requestor.
|
|
680
|
+
*/
|
|
681
|
+
readonly requestor: PeerId;
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
/**
|
|
685
|
+
* The main Sedimentree data structure.
|
|
686
|
+
*/
|
|
687
|
+
export class Sedimentree {
|
|
688
|
+
free(): void;
|
|
689
|
+
[Symbol.dispose](): void;
|
|
690
|
+
/**
|
|
691
|
+
* Create an empty Sedimentree.
|
|
692
|
+
*/
|
|
693
|
+
static empty(): Sedimentree;
|
|
694
|
+
/**
|
|
695
|
+
* Create a new Sedimentree from fragments and loose commits.
|
|
696
|
+
*/
|
|
697
|
+
constructor(fragments: Fragment[], commits: LooseCommit[]);
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
/**
|
|
701
|
+
* A Wasm wrapper around the [`SedimentreeId`] type.
|
|
702
|
+
*/
|
|
703
|
+
export class SedimentreeId {
|
|
704
|
+
private constructor();
|
|
705
|
+
free(): void;
|
|
706
|
+
[Symbol.dispose](): void;
|
|
707
|
+
/**
|
|
708
|
+
* Upcasts; to the JS-import type for [`WasmSedimentreeId`].
|
|
709
|
+
*/
|
|
710
|
+
__wasm_refgen_toWasmSedimentreeId(): SedimentreeId;
|
|
711
|
+
/**
|
|
712
|
+
* Create an ID from a byte array.
|
|
713
|
+
*
|
|
714
|
+
* # Errors
|
|
715
|
+
*
|
|
716
|
+
* Returns `Not32Bytes` if the provided byte array is not exactly 32 bytes long.
|
|
717
|
+
*/
|
|
718
|
+
static fromBytes(bytes: Uint8Array): SedimentreeId;
|
|
719
|
+
/**
|
|
720
|
+
* Returns the raw bytes of this ID.
|
|
721
|
+
*/
|
|
722
|
+
toBytes(): Uint8Array;
|
|
723
|
+
/**
|
|
724
|
+
* Returns the string representation of the ID.
|
|
725
|
+
*/
|
|
726
|
+
toString(): string;
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
export class SedimentreeIdsArray {
|
|
730
|
+
private constructor();
|
|
731
|
+
free(): void;
|
|
732
|
+
[Symbol.dispose](): void;
|
|
733
|
+
/**
|
|
734
|
+
* Upcasts; to the JS-import type for [`WasmSedimentreeIdsArray`].
|
|
735
|
+
*/
|
|
736
|
+
__wasm_refgen_toWasmSedimentreeIdsArray(): SedimentreeIdsArray;
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
/**
|
|
740
|
+
* A Wasm wrapper around `Signed<Fragment>`.
|
|
741
|
+
*/
|
|
742
|
+
export class SignedFragment {
|
|
743
|
+
private constructor();
|
|
744
|
+
free(): void;
|
|
745
|
+
[Symbol.dispose](): void;
|
|
746
|
+
/**
|
|
747
|
+
* Upcasts; to the JS-import type for [`WasmSignedFragment`].
|
|
748
|
+
*/
|
|
749
|
+
__wasm_refgen_toWasmSignedFragment(): SignedFragment;
|
|
750
|
+
/**
|
|
751
|
+
* Encode this signed fragment to raw bytes.
|
|
752
|
+
*/
|
|
753
|
+
encode(): Uint8Array;
|
|
754
|
+
/**
|
|
755
|
+
* Decode a `SignedFragment` from raw bytes.
|
|
756
|
+
*
|
|
757
|
+
* # Errors
|
|
758
|
+
*
|
|
759
|
+
* Returns an error if the bytes are not a valid signed fragment.
|
|
760
|
+
*/
|
|
761
|
+
static tryDecode(bytes: Uint8Array): SignedFragment;
|
|
762
|
+
/**
|
|
763
|
+
* Get the unsigned payload without re-verifying the signature.
|
|
764
|
+
*
|
|
765
|
+
* # Errors
|
|
766
|
+
*
|
|
767
|
+
* Returns an error if the payload cannot be decoded.
|
|
768
|
+
*/
|
|
769
|
+
readonly payload: Fragment;
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
/**
|
|
773
|
+
* A Wasm wrapper around `Signed<LooseCommit>`.
|
|
774
|
+
*/
|
|
775
|
+
export class SignedLooseCommit {
|
|
776
|
+
private constructor();
|
|
777
|
+
free(): void;
|
|
778
|
+
[Symbol.dispose](): void;
|
|
779
|
+
/**
|
|
780
|
+
* Upcasts; to the JS-import type for [`WasmSignedLooseCommit`].
|
|
781
|
+
*/
|
|
782
|
+
__wasm_refgen_toWasmSignedLooseCommit(): SignedLooseCommit;
|
|
783
|
+
/**
|
|
784
|
+
* Encode this signed loose commit to raw bytes.
|
|
785
|
+
*/
|
|
786
|
+
encode(): Uint8Array;
|
|
787
|
+
/**
|
|
788
|
+
* Decode a `SignedLooseCommit` from raw bytes.
|
|
789
|
+
*
|
|
790
|
+
* # Errors
|
|
791
|
+
*
|
|
792
|
+
* Returns an error if the bytes are not a valid signed loose commit.
|
|
793
|
+
*/
|
|
794
|
+
static tryDecode(bytes: Uint8Array): SignedLooseCommit;
|
|
795
|
+
/**
|
|
796
|
+
* Get the unsigned payload without re-verifying the signature.
|
|
797
|
+
*
|
|
798
|
+
* # Errors
|
|
799
|
+
*
|
|
800
|
+
* Returns an error if the payload cannot be decoded.
|
|
801
|
+
*/
|
|
802
|
+
readonly payload: LooseCommit;
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
/**
|
|
806
|
+
* Wasm bindings for [`Subduction`](subduction_core::Subduction)
|
|
807
|
+
*/
|
|
808
|
+
export class Subduction {
|
|
809
|
+
free(): void;
|
|
810
|
+
[Symbol.dispose](): void;
|
|
811
|
+
/**
|
|
812
|
+
* Add a commit with its associated blob to the storage.
|
|
813
|
+
*
|
|
814
|
+
* The commit metadata (including `BlobMeta`) is computed internally from
|
|
815
|
+
* the provided blob, ensuring consistency by construction.
|
|
816
|
+
*
|
|
817
|
+
* # Errors
|
|
818
|
+
*
|
|
819
|
+
* Returns a [`WasmWriteError`] if storage, networking, or policy fail.
|
|
820
|
+
*/
|
|
821
|
+
addCommit(id: SedimentreeId, parents: Digest[], blob: Uint8Array): Promise<FragmentRequested | undefined>;
|
|
822
|
+
/**
|
|
823
|
+
* Add a fragment with its associated blob to the storage.
|
|
824
|
+
*
|
|
825
|
+
* The fragment metadata (including `BlobMeta`) is computed internally from
|
|
826
|
+
* the provided blob, ensuring consistency by construction.
|
|
827
|
+
*
|
|
828
|
+
* # Errors
|
|
829
|
+
*
|
|
830
|
+
* Returns a [`WasmWriteError`] if storage, networking, or policy fail.
|
|
831
|
+
*/
|
|
832
|
+
addFragment(id: SedimentreeId, head: Digest, boundary: Digest[], checkpoints: Digest[], blob: Uint8Array): Promise<void>;
|
|
833
|
+
/**
|
|
834
|
+
* Add a Sedimentree.
|
|
835
|
+
*
|
|
836
|
+
* # Errors
|
|
837
|
+
*
|
|
838
|
+
* Returns [`WasmWriteError`] if there is a problem with storage, networking, or policy.
|
|
839
|
+
*/
|
|
840
|
+
addSedimentree(id: SedimentreeId, sedimentree: Sedimentree, blobs: Uint8Array[]): Promise<void>;
|
|
841
|
+
/**
|
|
842
|
+
* Attach an authenticated WebSocket connection and sync all sedimentrees.
|
|
843
|
+
*
|
|
844
|
+
* The connection must have been authenticated via [`SubductionWebSocket::setup`],
|
|
845
|
+
* [`SubductionWebSocket::tryConnect`], or [`SubductionWebSocket::tryDiscover`].
|
|
846
|
+
*
|
|
847
|
+
* Returns `true` if this is a new peer, `false` if already connected.
|
|
848
|
+
*
|
|
849
|
+
* # Errors
|
|
850
|
+
*
|
|
851
|
+
* Returns an error if registration or sync fails.
|
|
852
|
+
*/
|
|
853
|
+
attach(conn: AuthenticatedWebSocket): Promise<boolean>;
|
|
854
|
+
/**
|
|
855
|
+
* Connect to a peer via WebSocket and register the connection.
|
|
856
|
+
*
|
|
857
|
+
* This performs the cryptographic handshake, verifies the server's identity,
|
|
858
|
+
* and registers the authenticated connection for syncing.
|
|
859
|
+
*
|
|
860
|
+
* Returns the verified peer ID on success.
|
|
861
|
+
*
|
|
862
|
+
* # Arguments
|
|
863
|
+
*
|
|
864
|
+
* * `address` - The WebSocket URL to connect to
|
|
865
|
+
* * `signer` - The client's signer for authentication
|
|
866
|
+
* * `expected_peer_id` - The expected server peer ID (verified during handshake)
|
|
867
|
+
* * `timeout_milliseconds` - Request timeout in milliseconds
|
|
868
|
+
*
|
|
869
|
+
* # Errors
|
|
870
|
+
*
|
|
871
|
+
* Returns an error if connection, handshake, or registration fails.
|
|
872
|
+
*/
|
|
873
|
+
connect(address: URL, signer: any, expected_peer_id: PeerId, timeout_milliseconds: number): Promise<PeerId>;
|
|
874
|
+
/**
|
|
875
|
+
* Connect to a peer via WebSocket using discovery mode and register the connection.
|
|
876
|
+
*
|
|
877
|
+
* Returns the discovered and verified peer ID on success.
|
|
878
|
+
*
|
|
879
|
+
* # Arguments
|
|
880
|
+
*
|
|
881
|
+
* * `address` - The WebSocket URL to connect to
|
|
882
|
+
* * `signer` - The client's signer for authentication
|
|
883
|
+
* * `timeout_milliseconds` - Request timeout in milliseconds (defaults to 30000)
|
|
884
|
+
* * `service_name` - The service name for discovery (defaults to URL host)
|
|
885
|
+
*
|
|
886
|
+
* # Errors
|
|
887
|
+
*
|
|
888
|
+
* Returns an error if connection, handshake, or registration fails.
|
|
889
|
+
*/
|
|
890
|
+
connectDiscover(address: URL, signer: any, timeout_milliseconds?: number | null, service_name?: string | null): Promise<PeerId>;
|
|
891
|
+
/**
|
|
892
|
+
* Connect to a peer via HTTP long-poll using discovery mode.
|
|
893
|
+
*
|
|
894
|
+
* Returns the discovered and verified peer ID on success.
|
|
895
|
+
*
|
|
896
|
+
* # Arguments
|
|
897
|
+
*
|
|
898
|
+
* * `base_url` - The server's HTTP base URL (e.g., `http://localhost:8080`)
|
|
899
|
+
* * `signer` - The client's signer for authentication
|
|
900
|
+
* * `timeout_milliseconds` - Request timeout in milliseconds (default: 30000)
|
|
901
|
+
* * `service_name` - The service name for discovery (defaults to `base_url`)
|
|
902
|
+
*
|
|
903
|
+
* # Errors
|
|
904
|
+
*
|
|
905
|
+
* Returns an error if connection, handshake, or registration fails.
|
|
906
|
+
*/
|
|
907
|
+
connectDiscoverLongPoll(base_url: string, signer: any, timeout_milliseconds?: number | null, service_name?: string | null): Promise<PeerId>;
|
|
908
|
+
/**
|
|
909
|
+
* Connect to a peer via HTTP long-poll and register the connection.
|
|
910
|
+
*
|
|
911
|
+
* Returns the verified peer ID on success.
|
|
912
|
+
*
|
|
913
|
+
* # Arguments
|
|
914
|
+
*
|
|
915
|
+
* * `base_url` - The server's HTTP base URL (e.g., `http://localhost:8080`)
|
|
916
|
+
* * `signer` - The client's signer for authentication
|
|
917
|
+
* * `expected_peer_id` - The expected server peer ID (verified during handshake)
|
|
918
|
+
* * `timeout_milliseconds` - Request timeout in milliseconds (default: 30000)
|
|
919
|
+
*
|
|
920
|
+
* # Errors
|
|
921
|
+
*
|
|
922
|
+
* Returns an error if connection, handshake, or registration fails.
|
|
923
|
+
*/
|
|
924
|
+
connectLongPoll(base_url: string, signer: any, expected_peer_id: PeerId, timeout_milliseconds?: number | null): Promise<PeerId>;
|
|
925
|
+
/**
|
|
926
|
+
* Disconnect from all peers.
|
|
927
|
+
*
|
|
928
|
+
* # Errors
|
|
929
|
+
*
|
|
930
|
+
* Returns a [`WasmDisconnectionError`] if disconnection was not graceful.
|
|
931
|
+
*/
|
|
932
|
+
disconnectAll(): Promise<void>;
|
|
933
|
+
/**
|
|
934
|
+
* Disconnect from a peer by its ID.
|
|
935
|
+
*
|
|
936
|
+
* # Errors
|
|
937
|
+
*
|
|
938
|
+
* Returns a `WasmDisconnectionError` if disconnection fails.
|
|
939
|
+
*/
|
|
940
|
+
disconnectFromPeer(peer_id: PeerId): Promise<boolean>;
|
|
941
|
+
/**
|
|
942
|
+
* Fetch blobs by their digests, with an optional timeout in milliseconds.
|
|
943
|
+
*
|
|
944
|
+
* # Errors
|
|
945
|
+
*
|
|
946
|
+
* Returns a [`WasmIoError`] if storage or networking fail.
|
|
947
|
+
*/
|
|
948
|
+
fetchBlobs(id: SedimentreeId, timeout_milliseconds?: bigint | null): Promise<Uint8Array[] | undefined>;
|
|
949
|
+
/**
|
|
950
|
+
* Request batch sync for all known Sedimentree IDs from all connected peers.
|
|
951
|
+
*/
|
|
952
|
+
fullSync(timeout_milliseconds?: bigint | null): Promise<PeerBatchSyncResult>;
|
|
953
|
+
/**
|
|
954
|
+
* Get a local blob by its digest.
|
|
955
|
+
*
|
|
956
|
+
* # Errors
|
|
957
|
+
*
|
|
958
|
+
* Returns a [`JsStorageError`] if JS storage fails.
|
|
959
|
+
*/
|
|
960
|
+
getBlob(id: SedimentreeId, digest: Digest): Promise<Uint8Array | undefined>;
|
|
961
|
+
/**
|
|
962
|
+
* Get all local blobs for a given Sedimentree ID.
|
|
963
|
+
*
|
|
964
|
+
* # Errors
|
|
965
|
+
*
|
|
966
|
+
* Returns a [`JsStorageError`] if JS storage fails.
|
|
967
|
+
*/
|
|
968
|
+
getBlobs(id: SedimentreeId): Promise<Uint8Array[]>;
|
|
969
|
+
/**
|
|
970
|
+
* Get all commits for a given Sedimentree ID
|
|
971
|
+
*/
|
|
972
|
+
getCommits(id: SedimentreeId): Promise<LooseCommit[] | undefined>;
|
|
973
|
+
/**
|
|
974
|
+
* Get the peer IDs of all connected peers.
|
|
975
|
+
*/
|
|
976
|
+
getConnectedPeerIds(): Promise<PeerId[]>;
|
|
977
|
+
/**
|
|
978
|
+
* Get all fragments for a given Sedimentree ID
|
|
979
|
+
*/
|
|
980
|
+
getFragments(id: SedimentreeId): Promise<Fragment[] | undefined>;
|
|
981
|
+
/**
|
|
982
|
+
* Hydrate a [`Subduction`] instance from external storage.
|
|
983
|
+
*
|
|
984
|
+
* # Arguments
|
|
985
|
+
*
|
|
986
|
+
* * `signer` - The cryptographic signer for this node's identity
|
|
987
|
+
* * `storage` - Storage backend for persisting data
|
|
988
|
+
* * `service_name` - Optional service identifier for discovery mode (e.g., `sync.example.com`).
|
|
989
|
+
* When set, clients can connect without knowing the server's peer ID.
|
|
990
|
+
* * `hash_metric_override` - Optional custom depth metric function
|
|
991
|
+
* * `max_pending_blob_requests` - Optional maximum number of pending blob requests (default: 10,000)
|
|
992
|
+
*
|
|
993
|
+
* # Errors
|
|
994
|
+
*
|
|
995
|
+
* Returns [`WasmHydrationError`] if hydration fails.
|
|
996
|
+
*/
|
|
997
|
+
static hydrate(signer: any, storage: SedimentreeStorage, service_name?: string | null, hash_metric_override?: (digest: Digest) => Depth | null, max_pending_blob_requests?: number | null): Promise<Subduction>;
|
|
998
|
+
/**
|
|
999
|
+
* Create a new [`Subduction`] instance.
|
|
1000
|
+
*
|
|
1001
|
+
* # Arguments
|
|
1002
|
+
*
|
|
1003
|
+
* * `signer` - The cryptographic signer for this node's identity
|
|
1004
|
+
* * `storage` - Storage backend for persisting data
|
|
1005
|
+
* * `service_name` - Optional service identifier for discovery mode (e.g., `sync.example.com`).
|
|
1006
|
+
* When set, clients can connect without knowing the server's peer ID.
|
|
1007
|
+
* * `hash_metric_override` - Optional custom depth metric function
|
|
1008
|
+
* * `max_pending_blob_requests` - Optional maximum number of pending blob requests (default: 10,000)
|
|
1009
|
+
*/
|
|
1010
|
+
constructor(signer: any, storage: SedimentreeStorage, service_name?: string | null, hash_metric_override?: (digest: Digest) => Depth | null, max_pending_blob_requests?: number | null);
|
|
1011
|
+
/**
|
|
1012
|
+
* Remove a Sedimentree and all associated data.
|
|
1013
|
+
*
|
|
1014
|
+
* # Errors
|
|
1015
|
+
*
|
|
1016
|
+
* Returns a [`WasmIoError`] if storage or networking fail.
|
|
1017
|
+
*/
|
|
1018
|
+
removeSedimentree(id: SedimentreeId): Promise<void>;
|
|
1019
|
+
/**
|
|
1020
|
+
* Request blobs by their digests from connected peers for a specific sedimentree.
|
|
1021
|
+
*/
|
|
1022
|
+
requestBlobs(id: SedimentreeId, digests: Digest[]): Promise<void>;
|
|
1023
|
+
/**
|
|
1024
|
+
* Get all known Sedimentree IDs
|
|
1025
|
+
*/
|
|
1026
|
+
sedimentreeIds(): Promise<SedimentreeId[]>;
|
|
1027
|
+
/**
|
|
1028
|
+
* Request batch sync for a given Sedimentree ID from all connected peers.
|
|
1029
|
+
*
|
|
1030
|
+
* # Arguments
|
|
1031
|
+
*
|
|
1032
|
+
* * `id` - The sedimentree ID to sync
|
|
1033
|
+
* * `subscribe` - Whether to subscribe for incremental updates
|
|
1034
|
+
* * `timeout_milliseconds` - Optional timeout in milliseconds
|
|
1035
|
+
*
|
|
1036
|
+
* # Errors
|
|
1037
|
+
*
|
|
1038
|
+
* Returns a [`WasmIoError`] if storage or networking fail.
|
|
1039
|
+
*/
|
|
1040
|
+
syncAll(id: SedimentreeId, subscribe: boolean, timeout_milliseconds?: bigint | null): Promise<PeerResultMap>;
|
|
1041
|
+
/**
|
|
1042
|
+
* Request batch sync for a given Sedimentree ID from a specific peer.
|
|
1043
|
+
*
|
|
1044
|
+
* # Arguments
|
|
1045
|
+
*
|
|
1046
|
+
* * `to_ask` - The peer ID to sync with
|
|
1047
|
+
* * `id` - The sedimentree ID to sync
|
|
1048
|
+
* * `subscribe` - Whether to subscribe for incremental updates
|
|
1049
|
+
* * `timeout_milliseconds` - Optional timeout in milliseconds
|
|
1050
|
+
*
|
|
1051
|
+
* # Errors
|
|
1052
|
+
*
|
|
1053
|
+
* Returns a [`WasmIoError`] if storage or networking fail.
|
|
1054
|
+
*/
|
|
1055
|
+
syncWithPeer(to_ask: PeerId, id: SedimentreeId, subscribe: boolean, timeout_milliseconds?: bigint | null): Promise<PeerBatchSyncResult>;
|
|
1056
|
+
/**
|
|
1057
|
+
* Get the backing storage.
|
|
1058
|
+
*/
|
|
1059
|
+
readonly storage: any;
|
|
1060
|
+
}
|
|
1061
|
+
|
|
1062
|
+
/**
|
|
1063
|
+
* HTTP long-poll connection factory for browser/worker environments.
|
|
1064
|
+
*
|
|
1065
|
+
* Analogous to [`SubductionWebSocket`] but uses HTTP long-poll instead of WebSocket.
|
|
1066
|
+
*/
|
|
1067
|
+
export class SubductionLongPoll {
|
|
1068
|
+
private constructor();
|
|
1069
|
+
free(): void;
|
|
1070
|
+
[Symbol.dispose](): void;
|
|
1071
|
+
/**
|
|
1072
|
+
* Connect to a server with a known peer ID.
|
|
1073
|
+
*
|
|
1074
|
+
* # Arguments
|
|
1075
|
+
*
|
|
1076
|
+
* * `base_url` - The server's HTTP base URL (e.g., `http://localhost:8080`)
|
|
1077
|
+
* * `signer` - The client's signer for authentication
|
|
1078
|
+
* * `expected_peer_id` - The expected server peer ID (verified during handshake)
|
|
1079
|
+
* * `timeout_milliseconds` - Request timeout in milliseconds (default: 30000)
|
|
1080
|
+
*
|
|
1081
|
+
* # Errors
|
|
1082
|
+
*
|
|
1083
|
+
* Returns [`LongPollConnectionError`] if connection or handshake fails.
|
|
1084
|
+
*/
|
|
1085
|
+
static tryConnect(base_url: string, signer: any, expected_peer_id: PeerId, timeout_milliseconds?: number | null): Promise<AuthenticatedLongPoll>;
|
|
1086
|
+
/**
|
|
1087
|
+
* Connect to a server using discovery mode.
|
|
1088
|
+
*
|
|
1089
|
+
* # Arguments
|
|
1090
|
+
*
|
|
1091
|
+
* * `base_url` - The server's HTTP base URL (e.g., `http://localhost:8080`)
|
|
1092
|
+
* * `signer` - The client's signer for authentication
|
|
1093
|
+
* * `timeout_milliseconds` - Request timeout in milliseconds (default: 30000)
|
|
1094
|
+
* * `service_name` - The service name for discovery. If omitted, the base URL is used.
|
|
1095
|
+
*
|
|
1096
|
+
* # Errors
|
|
1097
|
+
*
|
|
1098
|
+
* Returns [`LongPollConnectionError`] if connection or handshake fails.
|
|
1099
|
+
*/
|
|
1100
|
+
static tryDiscover(base_url: string, signer: any, timeout_milliseconds?: number | null, service_name?: string | null): Promise<AuthenticatedLongPoll>;
|
|
1101
|
+
}
|
|
1102
|
+
|
|
1103
|
+
/**
|
|
1104
|
+
* JS-facing wrapper around [`WasmLongPollConnection`] that exposes the
|
|
1105
|
+
* [`Connection`](super::JsConnection) interface so it can be used as a
|
|
1106
|
+
* duck-typed `JsConnection` from JavaScript.
|
|
1107
|
+
*/
|
|
1108
|
+
export class SubductionLongPollConnection {
|
|
1109
|
+
private constructor();
|
|
1110
|
+
free(): void;
|
|
1111
|
+
[Symbol.dispose](): void;
|
|
1112
|
+
/**
|
|
1113
|
+
* Make a synchronous call to the peer.
|
|
1114
|
+
*
|
|
1115
|
+
* # Errors
|
|
1116
|
+
*
|
|
1117
|
+
* Returns an error if the call fails or times out.
|
|
1118
|
+
*/
|
|
1119
|
+
call(request: BatchSyncRequest, timeout_ms?: number | null): Promise<BatchSyncResponse>;
|
|
1120
|
+
/**
|
|
1121
|
+
* Disconnect from the peer gracefully.
|
|
1122
|
+
*
|
|
1123
|
+
* # Errors
|
|
1124
|
+
*
|
|
1125
|
+
* Returns [`WasmLongPollConnError`] if the disconnect fails.
|
|
1126
|
+
*/
|
|
1127
|
+
disconnect(): Promise<void>;
|
|
1128
|
+
/**
|
|
1129
|
+
* Get the next request ID.
|
|
1130
|
+
*/
|
|
1131
|
+
nextRequestId(): Promise<RequestId>;
|
|
1132
|
+
/**
|
|
1133
|
+
* Get the peer ID of the remote peer.
|
|
1134
|
+
*/
|
|
1135
|
+
peerId(): PeerId;
|
|
1136
|
+
/**
|
|
1137
|
+
* Receive a message.
|
|
1138
|
+
*
|
|
1139
|
+
* # Errors
|
|
1140
|
+
*
|
|
1141
|
+
* Returns an error if the inbound channel is closed.
|
|
1142
|
+
*/
|
|
1143
|
+
recv(): Promise<Message>;
|
|
1144
|
+
/**
|
|
1145
|
+
* Send a message.
|
|
1146
|
+
*
|
|
1147
|
+
* # Errors
|
|
1148
|
+
*
|
|
1149
|
+
* Returns an error if the outbound channel is closed.
|
|
1150
|
+
*/
|
|
1151
|
+
send(message: Message): Promise<void>;
|
|
1152
|
+
}
|
|
1153
|
+
|
|
1154
|
+
/**
|
|
1155
|
+
* A WebSocket connection with internal wiring for [`Subduction`] message handling.
|
|
1156
|
+
*/
|
|
1157
|
+
export class SubductionWebSocket {
|
|
1158
|
+
private constructor();
|
|
1159
|
+
free(): void;
|
|
1160
|
+
[Symbol.dispose](): void;
|
|
1161
|
+
/**
|
|
1162
|
+
* Make a synchronous call to the peer.
|
|
1163
|
+
*
|
|
1164
|
+
* # Errors
|
|
1165
|
+
*
|
|
1166
|
+
* Returns [`WasmCallError`] if the call fails or times out.
|
|
1167
|
+
*/
|
|
1168
|
+
call(request: BatchSyncRequest, timeout_ms?: number | null): Promise<BatchSyncResponse>;
|
|
1169
|
+
/**
|
|
1170
|
+
* Disconnect from the peer gracefully.
|
|
1171
|
+
*/
|
|
1172
|
+
disconnect(): Promise<void>;
|
|
1173
|
+
/**
|
|
1174
|
+
* Get the next request ID.
|
|
1175
|
+
*/
|
|
1176
|
+
nextRequestId(): Promise<RequestId>;
|
|
1177
|
+
/**
|
|
1178
|
+
* Get the peer ID of the remote peer.
|
|
1179
|
+
*/
|
|
1180
|
+
peerId(): PeerId;
|
|
1181
|
+
/**
|
|
1182
|
+
* Receive a message.
|
|
1183
|
+
*
|
|
1184
|
+
* # Errors
|
|
1185
|
+
*
|
|
1186
|
+
* Returns [`ReadFromClosedChannel`] if the channel has been closed.
|
|
1187
|
+
*/
|
|
1188
|
+
recv(): Promise<Message>;
|
|
1189
|
+
/**
|
|
1190
|
+
* Send a message.
|
|
1191
|
+
*
|
|
1192
|
+
* # Errors
|
|
1193
|
+
*
|
|
1194
|
+
* Returns [`WasmSendError`] if the message could not be sent over the WebSocket.
|
|
1195
|
+
*/
|
|
1196
|
+
send(wasm_message: Message): Promise<void>;
|
|
1197
|
+
/**
|
|
1198
|
+
* Authenticate an existing WebSocket via handshake.
|
|
1199
|
+
*
|
|
1200
|
+
* This performs the Subduction handshake protocol over the provided WebSocket
|
|
1201
|
+
* to establish mutual identity. The WebSocket can be in CONNECTING or OPEN state.
|
|
1202
|
+
*
|
|
1203
|
+
* # Arguments
|
|
1204
|
+
*
|
|
1205
|
+
* * `ws` - An existing WebSocket (CONNECTING or OPEN)
|
|
1206
|
+
* * `signer` - The client's signer for authentication
|
|
1207
|
+
* * `expected_peer_id` - The expected server peer ID (verified during handshake)
|
|
1208
|
+
* * `timeout_milliseconds` - Request timeout in milliseconds
|
|
1209
|
+
*
|
|
1210
|
+
* # Errors
|
|
1211
|
+
*
|
|
1212
|
+
* Returns an error if the handshake fails (signature invalid, wrong peer, etc.)
|
|
1213
|
+
*/
|
|
1214
|
+
static setup(ws: WebSocket, signer: any, expected_peer_id: PeerId, timeout_milliseconds: number): Promise<AuthenticatedWebSocket>;
|
|
1215
|
+
/**
|
|
1216
|
+
* Connect to a WebSocket server with mutual authentication via handshake.
|
|
1217
|
+
*
|
|
1218
|
+
* # Arguments
|
|
1219
|
+
*
|
|
1220
|
+
* * `address` - The WebSocket URL to connect to
|
|
1221
|
+
* * `signer` - The client's signer for authentication
|
|
1222
|
+
* * `expected_peer_id` - The expected server peer ID (verified during handshake)
|
|
1223
|
+
* * `timeout_milliseconds` - Request timeout in milliseconds
|
|
1224
|
+
*
|
|
1225
|
+
* # Errors
|
|
1226
|
+
*
|
|
1227
|
+
* Returns an error if:
|
|
1228
|
+
* - The WebSocket connection could not be established
|
|
1229
|
+
* - The handshake fails (signature invalid, wrong server, clock drift, etc.)
|
|
1230
|
+
*/
|
|
1231
|
+
static tryConnect(address: URL, signer: any, expected_peer_id: PeerId, timeout_milliseconds: number): Promise<AuthenticatedWebSocket>;
|
|
1232
|
+
/**
|
|
1233
|
+
* Connect to a WebSocket server using discovery mode.
|
|
1234
|
+
*
|
|
1235
|
+
* This method performs a cryptographic handshake using a service name
|
|
1236
|
+
* instead of a known peer ID. The server's peer ID is discovered during
|
|
1237
|
+
* the handshake and returned.
|
|
1238
|
+
*
|
|
1239
|
+
* # Arguments
|
|
1240
|
+
*
|
|
1241
|
+
* * `address` - The WebSocket URL to connect to
|
|
1242
|
+
* * `signer` - The client's signer for authentication
|
|
1243
|
+
* * `timeout_milliseconds` - Request timeout in milliseconds. Defaults to 30000 (30s).
|
|
1244
|
+
* * `service_name` - The service name for discovery (e.g., `localhost:8080`).
|
|
1245
|
+
* If omitted, the host is extracted from the URL.
|
|
1246
|
+
*
|
|
1247
|
+
* # Errors
|
|
1248
|
+
*
|
|
1249
|
+
* Returns an error if:
|
|
1250
|
+
* - The WebSocket connection could not be established
|
|
1251
|
+
* - The handshake fails (signature invalid, clock drift, etc.)
|
|
1252
|
+
*/
|
|
1253
|
+
static tryDiscover(address: URL, signer: any, timeout_milliseconds?: number | null, service_name?: string | null): Promise<AuthenticatedWebSocket>;
|
|
1254
|
+
}
|
|
1255
|
+
|
|
1256
|
+
/**
|
|
1257
|
+
* Statistics from a sync operation.
|
|
1258
|
+
*
|
|
1259
|
+
* The "sent" counts reflect items that were _successfully_ sent over the wire,
|
|
1260
|
+
* not just items that were requested.
|
|
1261
|
+
*/
|
|
1262
|
+
export class SyncStats {
|
|
1263
|
+
private constructor();
|
|
1264
|
+
free(): void;
|
|
1265
|
+
[Symbol.dispose](): void;
|
|
1266
|
+
/**
|
|
1267
|
+
* Number of commits received from the peer.
|
|
1268
|
+
*/
|
|
1269
|
+
readonly commitsReceived: number;
|
|
1270
|
+
/**
|
|
1271
|
+
* Number of commits successfully sent to the peer.
|
|
1272
|
+
*/
|
|
1273
|
+
readonly commitsSent: number;
|
|
1274
|
+
/**
|
|
1275
|
+
* Number of fragments received from the peer.
|
|
1276
|
+
*/
|
|
1277
|
+
readonly fragmentsReceived: number;
|
|
1278
|
+
/**
|
|
1279
|
+
* Number of fragments successfully sent to the peer.
|
|
1280
|
+
*/
|
|
1281
|
+
readonly fragmentsSent: number;
|
|
1282
|
+
/**
|
|
1283
|
+
* Returns true if no data was exchanged.
|
|
1284
|
+
*/
|
|
1285
|
+
readonly isEmpty: boolean;
|
|
1286
|
+
/**
|
|
1287
|
+
* Total items received (commits + fragments).
|
|
1288
|
+
*/
|
|
1289
|
+
readonly totalReceived: number;
|
|
1290
|
+
/**
|
|
1291
|
+
* Total items sent (commits + fragments).
|
|
1292
|
+
*/
|
|
1293
|
+
readonly totalSent: number;
|
|
1294
|
+
}
|
|
1295
|
+
|
|
1296
|
+
/**
|
|
1297
|
+
* An Ed25519 signer using the browser's `WebCrypto` API.
|
|
1298
|
+
*
|
|
1299
|
+
* This signer generates and stores Ed25519 keys using `crypto.subtle`,
|
|
1300
|
+
* providing secure key generation and signing operations. The key is
|
|
1301
|
+
* persisted to `IndexedDB` so it survives page reloads.
|
|
1302
|
+
*
|
|
1303
|
+
* # Example
|
|
1304
|
+
*
|
|
1305
|
+
* ```javascript
|
|
1306
|
+
* import { WebCryptoSigner } from "@anthropic/subduction";
|
|
1307
|
+
*
|
|
1308
|
+
* const signer = await WebCryptoSigner.setup();
|
|
1309
|
+
* console.log("Peer ID:", signer.peerId().toString());
|
|
1310
|
+
* ```
|
|
1311
|
+
*/
|
|
1312
|
+
export class WebCryptoSigner {
|
|
1313
|
+
private constructor();
|
|
1314
|
+
free(): void;
|
|
1315
|
+
[Symbol.dispose](): void;
|
|
1316
|
+
/**
|
|
1317
|
+
* Get the peer ID derived from this signer's verifying key.
|
|
1318
|
+
*
|
|
1319
|
+
* # Panics
|
|
1320
|
+
*
|
|
1321
|
+
* Panics if the stored public key bytes are invalid (should never happen).
|
|
1322
|
+
*/
|
|
1323
|
+
peerId(): PeerId;
|
|
1324
|
+
/**
|
|
1325
|
+
* Set up the signer, loading an existing key from `IndexedDB` or generating a new one.
|
|
1326
|
+
*
|
|
1327
|
+
* # Errors
|
|
1328
|
+
*
|
|
1329
|
+
* Returns an error if `WebCrypto` or `IndexedDB` operations fail.
|
|
1330
|
+
*/
|
|
1331
|
+
static setup(): Promise<WebCryptoSigner>;
|
|
1332
|
+
/**
|
|
1333
|
+
* Sign a message and return the 64-byte Ed25519 signature.
|
|
1334
|
+
*
|
|
1335
|
+
* # Errors
|
|
1336
|
+
*
|
|
1337
|
+
* Returns an error if `WebCrypto` signing fails.
|
|
1338
|
+
*/
|
|
1339
|
+
sign(message: Uint8Array): Promise<Uint8Array>;
|
|
1340
|
+
/**
|
|
1341
|
+
* Get the 32-byte Ed25519 verifying (public) key.
|
|
1342
|
+
*/
|
|
1343
|
+
verifyingKey(): Uint8Array;
|
|
1344
|
+
}
|