@derec-alliance/nodejs 0.0.1-alpha.6 → 0.0.1-alpha.8
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 +401 -71
- package/derec_library.d.ts +369 -221
- package/derec_library.js +1376 -400
- package/derec_library_bg.wasm +0 -0
- package/derec_library_bg.wasm.d.ts +77 -11
- package/index.d.ts +1214 -0
- package/index.js +106 -0
- package/package.json +6 -4
package/derec_library.js
CHANGED
|
@@ -1,472 +1,1294 @@
|
|
|
1
1
|
/* @ts-self-types="./derec_library.d.ts" */
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Fluent builder for [`DeRecProtocolWasm`]. Mirrors the Rust
|
|
5
|
+
* [`crate::protocol::DeRecProtocolBuilder`] and the dotnet
|
|
6
|
+
* `DeRecProtocolBuilder` method-for-method so a developer who already
|
|
7
|
+
* knows one SDK can move between them without reaching for reference
|
|
8
|
+
* docs.
|
|
9
|
+
*
|
|
10
|
+
* Required setters: `withChannelStore`, `withShareStore`,
|
|
11
|
+
* `withSecretStore`, `withTransport`, `withOwnTransport`. Calling
|
|
12
|
+
* `build()` without all five throws.
|
|
13
|
+
*
|
|
14
|
+
* All optional setters carry the defaults documented on the Rust
|
|
15
|
+
* builder.
|
|
16
|
+
*/
|
|
17
|
+
class DeRecProtocolBuilder {
|
|
18
|
+
static __wrap(ptr) {
|
|
19
|
+
const obj = Object.create(DeRecProtocolBuilder.prototype);
|
|
20
|
+
obj.__wbg_ptr = ptr;
|
|
21
|
+
DeRecProtocolBuilderFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
22
|
+
return obj;
|
|
23
|
+
}
|
|
24
|
+
__destroy_into_raw() {
|
|
25
|
+
const ptr = this.__wbg_ptr;
|
|
26
|
+
this.__wbg_ptr = 0;
|
|
27
|
+
DeRecProtocolBuilderFinalization.unregister(this);
|
|
28
|
+
return ptr;
|
|
29
|
+
}
|
|
30
|
+
free() {
|
|
31
|
+
const ptr = this.__destroy_into_raw();
|
|
32
|
+
wasm.__wbg_derecprotocolbuilder_free(ptr, 0);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Finalize the configuration. Throws if any of the required
|
|
36
|
+
* setters was not called.
|
|
37
|
+
* @returns {DeRecProtocolWasm}
|
|
38
|
+
*/
|
|
39
|
+
build() {
|
|
40
|
+
const ptr = this.__destroy_into_raw();
|
|
41
|
+
const ret = wasm.derecprotocolbuilder_build(ptr);
|
|
42
|
+
if (ret[2]) {
|
|
43
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
44
|
+
}
|
|
45
|
+
return DeRecProtocolWasm.__wrap(ret[0]);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* `secretId` is a JS `bigint` or `number`. Identifies the single
|
|
49
|
+
* secret this protocol instance manages; apps that juggle multiple
|
|
50
|
+
* secrets instantiate one protocol per id.
|
|
51
|
+
* @param {any} secret_id
|
|
52
|
+
*/
|
|
53
|
+
constructor(secret_id) {
|
|
54
|
+
const ret = wasm.derecprotocolbuilder_new(secret_id);
|
|
55
|
+
if (ret[2]) {
|
|
56
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
57
|
+
}
|
|
58
|
+
this.__wbg_ptr = ret[0];
|
|
59
|
+
DeRecProtocolBuilderFinalization.register(this, this.__wbg_ptr, this);
|
|
60
|
+
return this;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Per-flow auto-accept policy.
|
|
64
|
+
*
|
|
65
|
+
* `policy` shape (all fields optional, default `false`):
|
|
66
|
+
* `{ pairing, prePair, storeShare, verifyShare, discovery, getShare, unpair, updateChannelInfo }`.
|
|
67
|
+
*
|
|
68
|
+
* When a field is `true`, `process()` internally accepts the
|
|
69
|
+
* matching incoming request and emits an `AutoAccepted` event in
|
|
70
|
+
* place of `ActionRequired`. See the Rust-side
|
|
71
|
+
* `AutoAcceptPolicy` rustdoc for the per-flow trade-offs.
|
|
72
|
+
* Default: every field `false`.
|
|
73
|
+
* @param {any} policy
|
|
74
|
+
* @returns {DeRecProtocolBuilder}
|
|
75
|
+
*/
|
|
76
|
+
withAutoAccept(policy) {
|
|
77
|
+
const ptr = this.__destroy_into_raw();
|
|
78
|
+
const ret = wasm.derecprotocolbuilder_withAutoAccept(ptr, policy);
|
|
79
|
+
if (ret[2]) {
|
|
80
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
81
|
+
}
|
|
82
|
+
return DeRecProtocolBuilder.__wrap(ret[0]);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Whether outbound requests stamp `replyTo = ownTransport`.
|
|
86
|
+
* Default: false.
|
|
87
|
+
* @param {boolean} enabled
|
|
88
|
+
* @returns {DeRecProtocolBuilder}
|
|
89
|
+
*/
|
|
90
|
+
withAutoReplyTo(enabled) {
|
|
91
|
+
const ptr = this.__destroy_into_raw();
|
|
92
|
+
const ret = wasm.derecprotocolbuilder_withAutoReplyTo(ptr, enabled);
|
|
93
|
+
return DeRecProtocolBuilder.__wrap(ret);
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Whether the protocol auto-replies on failed inbound processing.
|
|
97
|
+
* Default: false.
|
|
98
|
+
* @param {boolean} enabled
|
|
99
|
+
* @returns {DeRecProtocolBuilder}
|
|
100
|
+
*/
|
|
101
|
+
withAutoRespondOnFailure(enabled) {
|
|
102
|
+
const ptr = this.__destroy_into_raw();
|
|
103
|
+
const ret = wasm.derecprotocolbuilder_withAutoRespondOnFailure(ptr, enabled);
|
|
104
|
+
return DeRecProtocolBuilder.__wrap(ret);
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* @param {any} store
|
|
108
|
+
* @returns {DeRecProtocolBuilder}
|
|
109
|
+
*/
|
|
110
|
+
withChannelStore(store) {
|
|
111
|
+
const ptr = this.__destroy_into_raw();
|
|
112
|
+
const ret = wasm.derecprotocolbuilder_withChannelStore(ptr, store);
|
|
113
|
+
return DeRecProtocolBuilder.__wrap(ret);
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* `info` shape: `Record<string, string>`. Default: empty.
|
|
117
|
+
* @param {any} info
|
|
118
|
+
* @returns {DeRecProtocolBuilder}
|
|
119
|
+
*/
|
|
120
|
+
withCommunicationInfo(info) {
|
|
121
|
+
const ptr = this.__destroy_into_raw();
|
|
122
|
+
const ret = wasm.derecprotocolbuilder_withCommunicationInfo(ptr, info);
|
|
123
|
+
if (ret[2]) {
|
|
124
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
125
|
+
}
|
|
126
|
+
return DeRecProtocolBuilder.__wrap(ret[0]);
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Number of recent versions each helper must retain. Default: 3.
|
|
130
|
+
* @param {number} count
|
|
131
|
+
* @returns {DeRecProtocolBuilder}
|
|
132
|
+
*/
|
|
133
|
+
withKeepVersionsCount(count) {
|
|
134
|
+
const ptr = this.__destroy_into_raw();
|
|
135
|
+
const ret = wasm.derecprotocolbuilder_withKeepVersionsCount(ptr, count);
|
|
136
|
+
return DeRecProtocolBuilder.__wrap(ret);
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* `endpoint` shape: `{ uri: string, protocol: string }`.
|
|
140
|
+
* `protocol` must be `"https"` (the only protocol supported today).
|
|
141
|
+
* @param {any} endpoint
|
|
142
|
+
* @returns {DeRecProtocolBuilder}
|
|
143
|
+
*/
|
|
144
|
+
withOwnTransport(endpoint) {
|
|
145
|
+
const ptr = this.__destroy_into_raw();
|
|
146
|
+
const ret = wasm.derecprotocolbuilder_withOwnTransport(ptr, endpoint);
|
|
147
|
+
if (ret[2]) {
|
|
148
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
149
|
+
}
|
|
150
|
+
return DeRecProtocolBuilder.__wrap(ret[0]);
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Declare the local node's acceptable parameter range for pair
|
|
154
|
+
* negotiation. `range` is a JS object whose keys mirror the
|
|
155
|
+
* `ParameterRange` proto (`minShareSize`, `maxShareSize`,
|
|
156
|
+
* `minTimeBetweenVerifications`, ...). Each field is `i64` —
|
|
157
|
+
* accept either a number or a `BigInt` on the JS side. Default:
|
|
158
|
+
* unset (no constraints advertised, every peer range accepted).
|
|
159
|
+
* @param {any} range
|
|
160
|
+
* @returns {DeRecProtocolBuilder}
|
|
161
|
+
*/
|
|
162
|
+
withParameterRange(range) {
|
|
163
|
+
const ptr = this.__destroy_into_raw();
|
|
164
|
+
const ret = wasm.derecprotocolbuilder_withParameterRange(ptr, range);
|
|
165
|
+
if (ret[2]) {
|
|
166
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
167
|
+
}
|
|
168
|
+
return DeRecProtocolBuilder.__wrap(ret[0]);
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* `id` is a JS `bigint` or `number`. Default: unset.
|
|
172
|
+
* @param {any} id
|
|
173
|
+
* @returns {DeRecProtocolBuilder}
|
|
174
|
+
*/
|
|
175
|
+
withReplicaId(id) {
|
|
176
|
+
const ptr = this.__destroy_into_raw();
|
|
177
|
+
const ret = wasm.derecprotocolbuilder_withReplicaId(ptr, id);
|
|
178
|
+
if (ret[2]) {
|
|
179
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
180
|
+
}
|
|
181
|
+
return DeRecProtocolBuilder.__wrap(ret[0]);
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* @param {any} store
|
|
185
|
+
* @returns {DeRecProtocolBuilder}
|
|
186
|
+
*/
|
|
187
|
+
withSecretStore(store) {
|
|
188
|
+
const ptr = this.__destroy_into_raw();
|
|
189
|
+
const ret = wasm.derecprotocolbuilder_withSecretStore(ptr, store);
|
|
190
|
+
return DeRecProtocolBuilder.__wrap(ret);
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* @param {any} store
|
|
194
|
+
* @returns {DeRecProtocolBuilder}
|
|
195
|
+
*/
|
|
196
|
+
withShareStore(store) {
|
|
197
|
+
const ptr = this.__destroy_into_raw();
|
|
198
|
+
const ret = wasm.derecprotocolbuilder_withShareStore(ptr, store);
|
|
199
|
+
return DeRecProtocolBuilder.__wrap(ret);
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* @param {any} store
|
|
203
|
+
* @returns {DeRecProtocolBuilder}
|
|
204
|
+
*/
|
|
205
|
+
withStateStore(store) {
|
|
206
|
+
const ptr = this.__destroy_into_raw();
|
|
207
|
+
const ret = wasm.derecprotocolbuilder_withStateStore(ptr, store);
|
|
208
|
+
return DeRecProtocolBuilder.__wrap(ret);
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Minimum number of shares required to reconstruct the secret.
|
|
212
|
+
* Default: 3.
|
|
213
|
+
* @param {number} threshold
|
|
214
|
+
* @returns {DeRecProtocolBuilder}
|
|
215
|
+
*/
|
|
216
|
+
withThreshold(threshold) {
|
|
217
|
+
const ptr = this.__destroy_into_raw();
|
|
218
|
+
const ret = wasm.derecprotocolbuilder_withThreshold(ptr, threshold);
|
|
219
|
+
return DeRecProtocolBuilder.__wrap(ret);
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Protocol-wide staleness boundary (seconds). Clamped to at least
|
|
223
|
+
* 1. Default: 300.
|
|
224
|
+
* @param {number} timeout_in_secs
|
|
225
|
+
* @returns {DeRecProtocolBuilder}
|
|
226
|
+
*/
|
|
227
|
+
withTimeout(timeout_in_secs) {
|
|
228
|
+
const ptr = this.__destroy_into_raw();
|
|
229
|
+
const ret = wasm.derecprotocolbuilder_withTimeout(ptr, timeout_in_secs);
|
|
230
|
+
return DeRecProtocolBuilder.__wrap(ret);
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* @param {any} transport
|
|
234
|
+
* @returns {DeRecProtocolBuilder}
|
|
235
|
+
*/
|
|
236
|
+
withTransport(transport) {
|
|
237
|
+
const ptr = this.__destroy_into_raw();
|
|
238
|
+
const ret = wasm.derecprotocolbuilder_withTransport(ptr, transport);
|
|
239
|
+
return DeRecProtocolBuilder.__wrap(ret);
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* `ack` is `"required"` (default) or `"not_required"`.
|
|
243
|
+
* @param {string} ack
|
|
244
|
+
* @returns {DeRecProtocolBuilder}
|
|
245
|
+
*/
|
|
246
|
+
withUnpairAck(ack) {
|
|
247
|
+
const ptr = this.__destroy_into_raw();
|
|
248
|
+
const ptr0 = passStringToWasm0(ack, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
249
|
+
const len0 = WASM_VECTOR_LEN;
|
|
250
|
+
const ret = wasm.derecprotocolbuilder_withUnpairAck(ptr, ptr0, len0);
|
|
251
|
+
if (ret[2]) {
|
|
252
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
253
|
+
}
|
|
254
|
+
return DeRecProtocolBuilder.__wrap(ret[0]);
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* @param {any} store
|
|
258
|
+
* @returns {DeRecProtocolBuilder}
|
|
259
|
+
*/
|
|
260
|
+
withUserSecretStore(store) {
|
|
261
|
+
const ptr = this.__destroy_into_raw();
|
|
262
|
+
const ret = wasm.derecprotocolbuilder_withUserSecretStore(ptr, store);
|
|
263
|
+
return DeRecProtocolBuilder.__wrap(ret);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
if (Symbol.dispose) DeRecProtocolBuilder.prototype[Symbol.dispose] = DeRecProtocolBuilder.prototype.free;
|
|
267
|
+
exports.DeRecProtocolBuilder = DeRecProtocolBuilder;
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* Higher-level DeRec protocol orchestrator for TypeScript/JavaScript consumers.
|
|
271
|
+
*
|
|
272
|
+
* Wraps [`DeRecProtocol`](crate::protocol::DeRecProtocol) with JS-side store
|
|
273
|
+
* and transport adapters so that a TypeScript application can drive all five
|
|
274
|
+
* protocol flows without routing raw bytes manually.
|
|
275
|
+
*
|
|
276
|
+
* # Stores
|
|
5
277
|
*
|
|
6
|
-
*
|
|
278
|
+
* Pass four JS objects that implement the interfaces documented on each
|
|
279
|
+
* parameter. All store methods must return `Promise`s — synchronous
|
|
280
|
+
* implementations can wrap their result with `Promise.resolve(...)`.
|
|
7
281
|
*
|
|
8
|
-
*
|
|
9
|
-
* * `transport_uri` - Transport endpoint that the peer should use for subsequent traffic
|
|
282
|
+
* # Events
|
|
10
283
|
*
|
|
11
|
-
*
|
|
284
|
+
* [`process`](DeRecProtocolWasm::process) returns an `Array` of plain JS
|
|
285
|
+
* objects, each with a `type` discriminant field:
|
|
12
286
|
*
|
|
13
|
-
*
|
|
287
|
+
* | `type` | Additional fields |
|
|
288
|
+
* |--------------------|--------------------------------------------------------|
|
|
289
|
+
* | `PairingCompleted` | `channel_id: string`, `pairing_channel_id: string`, `kind: number` |
|
|
290
|
+
* | `ShareStored` | `channel_id: string`, `version: number` |
|
|
291
|
+
* | `ShareConfirmed` | `channel_id: string`, `version: number` |
|
|
292
|
+
* | `ShareVerified` | `channel_id: string`, `version: number` |
|
|
293
|
+
* | `SecretsDiscovered`| `channel_id: string`, `secrets: SecretVersionEntry[]` |
|
|
294
|
+
* | `SecretRecovered` | `secret: { helpers, secrets, replicas, owner_replica_id }` (same nested shape as `ReplicaSecretReceived.secret`) |
|
|
295
|
+
* | `NoOp` | _(none)_ |
|
|
14
296
|
*
|
|
15
|
-
*
|
|
16
|
-
|
|
297
|
+
* `SecretVersionEntry = { secret_id: bigint, versions: { version: number, description: string }[] }`
|
|
298
|
+
*/
|
|
299
|
+
class DeRecProtocolWasm {
|
|
300
|
+
static __wrap(ptr) {
|
|
301
|
+
const obj = Object.create(DeRecProtocolWasm.prototype);
|
|
302
|
+
obj.__wbg_ptr = ptr;
|
|
303
|
+
DeRecProtocolWasmFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
304
|
+
return obj;
|
|
305
|
+
}
|
|
306
|
+
__destroy_into_raw() {
|
|
307
|
+
const ptr = this.__wbg_ptr;
|
|
308
|
+
this.__wbg_ptr = 0;
|
|
309
|
+
DeRecProtocolWasmFinalization.unregister(this);
|
|
310
|
+
return ptr;
|
|
311
|
+
}
|
|
312
|
+
free() {
|
|
313
|
+
const ptr = this.__destroy_into_raw();
|
|
314
|
+
wasm.__wbg_derecprotocolwasm_free(ptr, 0);
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* Accept a pending action from an `ActionRequired` event.
|
|
318
|
+
*
|
|
319
|
+
* # Arguments
|
|
320
|
+
*
|
|
321
|
+
* * `action_bytes` — Opaque `Uint8Array` from the `action` field of an `ActionRequired` event.
|
|
322
|
+
*
|
|
323
|
+
* # Returns
|
|
324
|
+
*
|
|
325
|
+
* An `Array` of event objects (same format as `process()`).
|
|
326
|
+
* @param {Uint8Array} action_bytes
|
|
327
|
+
* @returns {Promise<any>}
|
|
328
|
+
*/
|
|
329
|
+
accept(action_bytes) {
|
|
330
|
+
const ptr0 = passArray8ToWasm0(action_bytes, wasm.__wbindgen_malloc);
|
|
331
|
+
const len0 = WASM_VECTOR_LEN;
|
|
332
|
+
const ret = wasm.derecprotocolwasm_accept(this.__wbg_ptr, ptr0, len0);
|
|
333
|
+
return ret;
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* Single entry point for all three contact modes (`InlineKeys`,
|
|
337
|
+
* `HashedKeys`, `NoKeys`).
|
|
338
|
+
*
|
|
339
|
+
* * `channel_id` — `null`/`undefined` lets the library mint a
|
|
340
|
+
* random id; otherwise `bigint` / `number` is used verbatim.
|
|
341
|
+
* * `contact_mode` — `0` (InlineKeys), `1` (HashedKeys), `2` (NoKeys).
|
|
342
|
+
* * `nonce` — `null`/`undefined` lets the library generate a fresh
|
|
343
|
+
* random `u64`; otherwise the supplied `bigint`/`number` is used.
|
|
344
|
+
* Required for `NoKeys` where callers typically pick a small
|
|
345
|
+
* human-typable value.
|
|
346
|
+
* @param {any} channel_id
|
|
347
|
+
* @param {number} contact_mode
|
|
348
|
+
* @param {any} nonce
|
|
349
|
+
* @returns {Promise<any>}
|
|
350
|
+
*/
|
|
351
|
+
createContact(channel_id, contact_mode, nonce) {
|
|
352
|
+
const ret = wasm.derecprotocolwasm_createContact(this.__wbg_ptr, channel_id, contact_mode, nonce);
|
|
353
|
+
return ret;
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* Derive the human-readable fingerprint for a paired channel. Both
|
|
357
|
+
* sides of a replica pair derive the same fingerprint from the
|
|
358
|
+
* shared key, enabling out-of-band confirmation before the channel
|
|
359
|
+
* transitions from `Pending` to `Paired`.
|
|
360
|
+
* @param {any} channel_id
|
|
361
|
+
* @returns {Promise<string>}
|
|
362
|
+
*/
|
|
363
|
+
getFingerprint(channel_id) {
|
|
364
|
+
const ret = wasm.derecprotocolwasm_getFingerprint(this.__wbg_ptr, channel_id);
|
|
365
|
+
return ret;
|
|
366
|
+
}
|
|
367
|
+
/**
|
|
368
|
+
* Feed any incoming wire bytes to the protocol.
|
|
369
|
+
*
|
|
370
|
+
* Returns an `Array` of plain JS event objects (see struct-level docs for shapes).
|
|
371
|
+
* All five flows (pairing, sharing, verification, discovery, recovery) are
|
|
372
|
+
* handled through this single entry point.
|
|
373
|
+
*
|
|
374
|
+
* # Arguments
|
|
375
|
+
*
|
|
376
|
+
* * `message` — Raw wire bytes of an incoming `DeRecMessage`.
|
|
377
|
+
* @param {Uint8Array} message
|
|
378
|
+
* @returns {Promise<any>}
|
|
379
|
+
*/
|
|
380
|
+
process(message) {
|
|
381
|
+
const ptr0 = passArray8ToWasm0(message, wasm.__wbindgen_malloc);
|
|
382
|
+
const len0 = WASM_VECTOR_LEN;
|
|
383
|
+
const ret = wasm.derecprotocolwasm_process(this.__wbg_ptr, ptr0, len0);
|
|
384
|
+
return ret;
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* Reject a pending action from an `ActionRequired` event.
|
|
388
|
+
*
|
|
389
|
+
* # Arguments
|
|
390
|
+
*
|
|
391
|
+
* * `action_bytes` — Opaque `Uint8Array` from the `action` field of an `ActionRequired` event.
|
|
392
|
+
* * `status` — Numeric status code from `StatusEnum` (e.g. 2 for FAIL, 10 for REJECTED).
|
|
393
|
+
* * `memo` — Human-readable rejection reason.
|
|
394
|
+
* @param {Uint8Array} action_bytes
|
|
395
|
+
* @param {number} status
|
|
396
|
+
* @param {string} memo
|
|
397
|
+
* @returns {Promise<void>}
|
|
398
|
+
*/
|
|
399
|
+
reject(action_bytes, status, memo) {
|
|
400
|
+
const ptr0 = passArray8ToWasm0(action_bytes, wasm.__wbindgen_malloc);
|
|
401
|
+
const len0 = WASM_VECTOR_LEN;
|
|
402
|
+
const ptr1 = passStringToWasm0(memo, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
403
|
+
const len1 = WASM_VECTOR_LEN;
|
|
404
|
+
const ret = wasm.derecprotocolwasm_reject(this.__wbg_ptr, ptr0, len0, status, ptr1, len1);
|
|
405
|
+
return ret;
|
|
406
|
+
}
|
|
407
|
+
/**
|
|
408
|
+
* Rebuild this protocol's `secret_id` namespace from a recovered
|
|
409
|
+
* `Secret`. Mirrors [`crate::protocol::DeRecProtocol::restore`] —
|
|
410
|
+
* see that method for the full contract.
|
|
411
|
+
*
|
|
412
|
+
* `recoveredSecret` is the typed `Secret` object carried by the
|
|
413
|
+
* `SecretRecovered` event; pass it verbatim.
|
|
414
|
+
*
|
|
415
|
+
* Errors surface as structured JS errors with a `code` field:
|
|
416
|
+
*
|
|
417
|
+
* | code | meaning |
|
|
418
|
+
* |--------------------|------------------------------------------------------------------|
|
|
419
|
+
* | `ALREADY_RESTORED` | A user-secret snapshot already exists for this `secret_id`. |
|
|
420
|
+
* | `CONFLICT` | Channels live at canonical helper / replica ids. The error |
|
|
421
|
+
* | | carries `channel_ids: string[]` listing the collisions. |
|
|
422
|
+
* | `INVARIANT` | The recovered `Secret` is internally inconsistent. |
|
|
423
|
+
* | `STORAGE` | A store I/O call failed mid-restore. |
|
|
424
|
+
* @param {any} recovered_secret
|
|
425
|
+
* @param {number} version
|
|
426
|
+
* @returns {Promise<any>}
|
|
427
|
+
*/
|
|
428
|
+
restore(recovered_secret, version) {
|
|
429
|
+
const ret = wasm.derecprotocolwasm_restore(this.__wbg_ptr, recovered_secret, version);
|
|
430
|
+
return ret;
|
|
431
|
+
}
|
|
432
|
+
/**
|
|
433
|
+
* Generate an out-of-band contact message (QR code payload, deep link, …).
|
|
434
|
+
*
|
|
435
|
+
* Returns a plain JS `ContactMessage` object. The `channel_id` field identifies
|
|
436
|
+
* the pairing session and will match the `channel_id` in the eventual
|
|
437
|
+
* `PairingCompleted` event — read it directly from the returned object.
|
|
438
|
+
*
|
|
439
|
+
* The caller is responsible for serializing the contact for out-of-band
|
|
440
|
+
* delivery (QR code, deep link, etc.). The peer passes the deserialized object
|
|
441
|
+
* to [`start`](Self::start) with `FlowKind::Pairing`.
|
|
442
|
+
*
|
|
443
|
+
* # Arguments
|
|
444
|
+
*
|
|
445
|
+
* * `channel_id` — Optional `BigInt` channel identifier. Pass `null` or
|
|
446
|
+
* `undefined` to have the library generate a random one.
|
|
447
|
+
* * `contact_mode` — `0` for `InlineKeys` (keys embedded directly), `1`
|
|
448
|
+
* for `HashedKeys` (contact carries only a SHA-384 binding hash; the
|
|
449
|
+
* scanner fetches keys via a `PrePair` round-trip). `HashedKeys`
|
|
450
|
+
* requires the protocol's `own_transport` to be ephemeral.
|
|
451
|
+
* The secret identifier this protocol instance is bound to.
|
|
452
|
+
* @returns {bigint}
|
|
453
|
+
*/
|
|
454
|
+
secretId() {
|
|
455
|
+
const ret = wasm.derecprotocolwasm_secretId(this.__wbg_ptr);
|
|
456
|
+
return BigInt.asUintN(64, ret);
|
|
457
|
+
}
|
|
458
|
+
/**
|
|
459
|
+
* Replace this node's local communication info. Does not contact peers —
|
|
460
|
+
* follow up with a `start(UpdateChannelInfo, ...)` to propagate.
|
|
461
|
+
* @param {any} info
|
|
462
|
+
*/
|
|
463
|
+
setCommunicationInfo(info) {
|
|
464
|
+
const ret = wasm.derecprotocolwasm_setCommunicationInfo(this.__wbg_ptr, info);
|
|
465
|
+
if (ret[1]) {
|
|
466
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
/**
|
|
470
|
+
* Replace this node's local transport endpoint. See
|
|
471
|
+
* `setCommunicationInfo` for the matching update-propagation flow.
|
|
472
|
+
* IMPORTANT: keep the old endpoint operational during the changeover —
|
|
473
|
+
* see the Rust docs on `set_own_transport` for the discipline.
|
|
474
|
+
* @param {string} uri
|
|
475
|
+
* @param {string} protocol
|
|
476
|
+
*/
|
|
477
|
+
setOwnTransport(uri, protocol) {
|
|
478
|
+
const ptr0 = passStringToWasm0(uri, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
479
|
+
const len0 = WASM_VECTOR_LEN;
|
|
480
|
+
const ptr1 = passStringToWasm0(protocol, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
481
|
+
const len1 = WASM_VECTOR_LEN;
|
|
482
|
+
const ret = wasm.derecprotocolwasm_setOwnTransport(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
483
|
+
if (ret[1]) {
|
|
484
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
/**
|
|
488
|
+
* Unified entry point for initiating any protocol flow.
|
|
489
|
+
*
|
|
490
|
+
* # Arguments
|
|
491
|
+
*
|
|
492
|
+
* * `flow_kind` — Flow discriminant:
|
|
493
|
+
* - `0` = Pairing (params: `{ kind: number, contact: ContactMessage, name?: string }`)
|
|
494
|
+
* - `1` = Discovery (params: `{ target: BigInt | BigInt[] | null }`)
|
|
495
|
+
* - `2` = ProtectSecret (params: `{ secrets: UserSecret[], description?: string }`)
|
|
496
|
+
* - `3` = VerifyShares (params: `{ version: number, target: BigInt | BigInt[] | null }`)
|
|
497
|
+
* - `4` = RecoverSecret (params: `{ secretId: Uint8Array, version: number }`)
|
|
498
|
+
*
|
|
499
|
+
* # Returns
|
|
500
|
+
*
|
|
501
|
+
* An `Array` of `*Started` / `*Failed` events describing the
|
|
502
|
+
* dispatched requests. Same shape as `process()`.
|
|
503
|
+
* @param {number} flow_kind
|
|
504
|
+
* @param {any} params
|
|
505
|
+
* @returns {Promise<any>}
|
|
506
|
+
*/
|
|
507
|
+
start(flow_kind, params) {
|
|
508
|
+
const ret = wasm.derecprotocolwasm_start(this.__wbg_ptr, flow_kind, params);
|
|
509
|
+
return ret;
|
|
510
|
+
}
|
|
511
|
+
/**
|
|
512
|
+
* Verify a fingerprint against the channel's locally-derived one. On
|
|
513
|
+
* match, the channel transitions from `Pending` to `Paired`. Returns
|
|
514
|
+
* `true` when the fingerprint matches and the channel is confirmed,
|
|
515
|
+
* `false` otherwise.
|
|
516
|
+
* @param {any} channel_id
|
|
517
|
+
* @param {string} fingerprint
|
|
518
|
+
* @returns {Promise<boolean>}
|
|
519
|
+
*/
|
|
520
|
+
verifyFingerprint(channel_id, fingerprint) {
|
|
521
|
+
const ptr0 = passStringToWasm0(fingerprint, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
522
|
+
const len0 = WASM_VECTOR_LEN;
|
|
523
|
+
const ret = wasm.derecprotocolwasm_verifyFingerprint(this.__wbg_ptr, channel_id, ptr0, len0);
|
|
524
|
+
return ret;
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
if (Symbol.dispose) DeRecProtocolWasm.prototype[Symbol.dispose] = DeRecProtocolWasm.prototype.free;
|
|
528
|
+
exports.DeRecProtocolWasm = DeRecProtocolWasm;
|
|
529
|
+
|
|
530
|
+
/**
|
|
531
|
+
* @param {Uint8Array} envelope_bytes
|
|
532
|
+
* @param {Uint8Array} shared_key
|
|
533
|
+
* @returns {any}
|
|
534
|
+
*/
|
|
535
|
+
function discovery_request_extract(envelope_bytes, shared_key) {
|
|
536
|
+
const ptr0 = passArray8ToWasm0(envelope_bytes, wasm.__wbindgen_malloc);
|
|
537
|
+
const len0 = WASM_VECTOR_LEN;
|
|
538
|
+
const ptr1 = passArray8ToWasm0(shared_key, wasm.__wbindgen_malloc);
|
|
539
|
+
const len1 = WASM_VECTOR_LEN;
|
|
540
|
+
const ret = wasm.discovery_request_extract(ptr0, len0, ptr1, len1);
|
|
541
|
+
if (ret[2]) {
|
|
542
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
543
|
+
}
|
|
544
|
+
return takeFromExternrefTable0(ret[0]);
|
|
545
|
+
}
|
|
546
|
+
exports.discovery_request_extract = discovery_request_extract;
|
|
547
|
+
|
|
548
|
+
/**
|
|
549
|
+
* @param {bigint} channel_id
|
|
550
|
+
* @param {Uint8Array} shared_key
|
|
551
|
+
* @param {any} reply_to
|
|
552
|
+
* @returns {any}
|
|
553
|
+
*/
|
|
554
|
+
function discovery_request_produce(channel_id, shared_key, reply_to) {
|
|
555
|
+
const ptr0 = passArray8ToWasm0(shared_key, wasm.__wbindgen_malloc);
|
|
556
|
+
const len0 = WASM_VECTOR_LEN;
|
|
557
|
+
const ret = wasm.discovery_request_produce(channel_id, ptr0, len0, reply_to);
|
|
558
|
+
if (ret[2]) {
|
|
559
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
560
|
+
}
|
|
561
|
+
return takeFromExternrefTable0(ret[0]);
|
|
562
|
+
}
|
|
563
|
+
exports.discovery_request_produce = discovery_request_produce;
|
|
564
|
+
|
|
565
|
+
/**
|
|
566
|
+
* @param {Uint8Array} envelope_bytes
|
|
567
|
+
* @param {Uint8Array} shared_key
|
|
568
|
+
* @returns {any}
|
|
569
|
+
*/
|
|
570
|
+
function discovery_response_extract(envelope_bytes, shared_key) {
|
|
571
|
+
const ptr0 = passArray8ToWasm0(envelope_bytes, wasm.__wbindgen_malloc);
|
|
572
|
+
const len0 = WASM_VECTOR_LEN;
|
|
573
|
+
const ptr1 = passArray8ToWasm0(shared_key, wasm.__wbindgen_malloc);
|
|
574
|
+
const len1 = WASM_VECTOR_LEN;
|
|
575
|
+
const ret = wasm.discovery_response_extract(ptr0, len0, ptr1, len1);
|
|
576
|
+
if (ret[2]) {
|
|
577
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
578
|
+
}
|
|
579
|
+
return takeFromExternrefTable0(ret[0]);
|
|
580
|
+
}
|
|
581
|
+
exports.discovery_response_extract = discovery_response_extract;
|
|
582
|
+
|
|
583
|
+
/**
|
|
584
|
+
* @param {any} response
|
|
585
|
+
* @returns {any}
|
|
586
|
+
*/
|
|
587
|
+
function discovery_response_process(response) {
|
|
588
|
+
const ret = wasm.discovery_response_process(response);
|
|
589
|
+
if (ret[2]) {
|
|
590
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
591
|
+
}
|
|
592
|
+
return takeFromExternrefTable0(ret[0]);
|
|
593
|
+
}
|
|
594
|
+
exports.discovery_response_process = discovery_response_process;
|
|
595
|
+
|
|
596
|
+
/**
|
|
17
597
|
* @param {bigint} channel_id
|
|
18
|
-
* @param {
|
|
598
|
+
* @param {any} secret_list
|
|
599
|
+
* @param {Uint8Array} shared_key
|
|
600
|
+
* @returns {any}
|
|
601
|
+
*/
|
|
602
|
+
function discovery_response_produce(channel_id, secret_list, shared_key) {
|
|
603
|
+
const ptr0 = passArray8ToWasm0(shared_key, wasm.__wbindgen_malloc);
|
|
604
|
+
const len0 = WASM_VECTOR_LEN;
|
|
605
|
+
const ret = wasm.discovery_response_produce(channel_id, secret_list, ptr0, len0);
|
|
606
|
+
if (ret[2]) {
|
|
607
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
608
|
+
}
|
|
609
|
+
return takeFromExternrefTable0(ret[0]);
|
|
610
|
+
}
|
|
611
|
+
exports.discovery_response_produce = discovery_response_produce;
|
|
612
|
+
|
|
613
|
+
/**
|
|
614
|
+
* Overwrite `trace_id` on a primitive-produced envelope and return the
|
|
615
|
+
* re-encoded bytes. The outer envelope is plaintext, so this does no
|
|
616
|
+
* crypto work.
|
|
617
|
+
*
|
|
618
|
+
* Useful for consumers driving the protocol through primitives directly
|
|
619
|
+
* (the orchestrator-level `DeRecProtocol` already handles trace_id
|
|
620
|
+
* end-to-end on its own).
|
|
621
|
+
* @param {Uint8Array} envelope_bytes
|
|
622
|
+
* @param {bigint} trace_id
|
|
623
|
+
* @returns {Uint8Array}
|
|
624
|
+
*/
|
|
625
|
+
function envelope_apply_trace_id(envelope_bytes, trace_id) {
|
|
626
|
+
const ptr0 = passArray8ToWasm0(envelope_bytes, wasm.__wbindgen_malloc);
|
|
627
|
+
const len0 = WASM_VECTOR_LEN;
|
|
628
|
+
const ret = wasm.envelope_apply_trace_id(ptr0, len0, trace_id);
|
|
629
|
+
if (ret[3]) {
|
|
630
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
631
|
+
}
|
|
632
|
+
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
633
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
634
|
+
return v2;
|
|
635
|
+
}
|
|
636
|
+
exports.envelope_apply_trace_id = envelope_apply_trace_id;
|
|
637
|
+
|
|
638
|
+
/**
|
|
639
|
+
* Read `trace_id` off an inbound envelope without touching the encrypted
|
|
640
|
+
* inner payload. Returns `0` when the sender didn't set one — the protobuf
|
|
641
|
+
* default is indistinguishable from an explicit zero.
|
|
642
|
+
* @param {Uint8Array} envelope_bytes
|
|
643
|
+
* @returns {bigint}
|
|
644
|
+
*/
|
|
645
|
+
function envelope_read_trace_id(envelope_bytes) {
|
|
646
|
+
const ptr0 = passArray8ToWasm0(envelope_bytes, wasm.__wbindgen_malloc);
|
|
647
|
+
const len0 = WASM_VECTOR_LEN;
|
|
648
|
+
const ret = wasm.envelope_read_trace_id(ptr0, len0);
|
|
649
|
+
if (ret[2]) {
|
|
650
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
651
|
+
}
|
|
652
|
+
return BigInt.asUintN(64, ret[0]);
|
|
653
|
+
}
|
|
654
|
+
exports.envelope_read_trace_id = envelope_read_trace_id;
|
|
655
|
+
|
|
656
|
+
/**
|
|
657
|
+
* Structurally validate a JS-side [`ContactMessage`]. Throws on any
|
|
658
|
+
* mode/field inconsistency (unknown `contact_mode`, mode/field mismatch,
|
|
659
|
+
* wrong binding-hash length).
|
|
660
|
+
* @param {any} contact_message
|
|
661
|
+
*/
|
|
662
|
+
function pairing_contact_message_validate(contact_message) {
|
|
663
|
+
const ret = wasm.pairing_contact_message_validate(contact_message);
|
|
664
|
+
if (ret[1]) {
|
|
665
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
exports.pairing_contact_message_validate = pairing_contact_message_validate;
|
|
669
|
+
|
|
670
|
+
/**
|
|
671
|
+
* @param {bigint} channel_id
|
|
672
|
+
* @param {number} contact_mode
|
|
673
|
+
* @param {any} transport_protocol
|
|
674
|
+
* @param {any} nonce
|
|
675
|
+
* @returns {any}
|
|
676
|
+
*/
|
|
677
|
+
function pairing_request_create_contact(channel_id, contact_mode, transport_protocol, nonce) {
|
|
678
|
+
const ret = wasm.pairing_request_create_contact(channel_id, contact_mode, transport_protocol, nonce);
|
|
679
|
+
if (ret[2]) {
|
|
680
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
681
|
+
}
|
|
682
|
+
return takeFromExternrefTable0(ret[0]);
|
|
683
|
+
}
|
|
684
|
+
exports.pairing_request_create_contact = pairing_request_create_contact;
|
|
685
|
+
|
|
686
|
+
/**
|
|
687
|
+
* Decodes a proto-encoded [`ContactMessage`]. Structurally validates the
|
|
688
|
+
* decoded value before returning it to application code so consumers can
|
|
689
|
+
* trust the mode/field invariants documented on the wire format.
|
|
690
|
+
* @param {Uint8Array} bytes
|
|
691
|
+
* @returns {any}
|
|
692
|
+
*/
|
|
693
|
+
function pairing_request_decode_contact(bytes) {
|
|
694
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
695
|
+
const len0 = WASM_VECTOR_LEN;
|
|
696
|
+
const ret = wasm.pairing_request_decode_contact(ptr0, len0);
|
|
697
|
+
if (ret[2]) {
|
|
698
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
699
|
+
}
|
|
700
|
+
return takeFromExternrefTable0(ret[0]);
|
|
701
|
+
}
|
|
702
|
+
exports.pairing_request_decode_contact = pairing_request_decode_contact;
|
|
703
|
+
|
|
704
|
+
/**
|
|
705
|
+
* Encodes a [`ContactMessage`] to proto wire bytes. Structurally validates
|
|
706
|
+
* the input first so a locally-constructed contact that violates the
|
|
707
|
+
* mode/field invariant is rejected at the boundary rather than silently
|
|
708
|
+
* serialized.
|
|
709
|
+
* @param {any} contact_message
|
|
710
|
+
* @returns {Uint8Array}
|
|
711
|
+
*/
|
|
712
|
+
function pairing_request_encode_contact(contact_message) {
|
|
713
|
+
const ret = wasm.pairing_request_encode_contact(contact_message);
|
|
714
|
+
if (ret[3]) {
|
|
715
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
716
|
+
}
|
|
717
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
718
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
719
|
+
return v1;
|
|
720
|
+
}
|
|
721
|
+
exports.pairing_request_encode_contact = pairing_request_encode_contact;
|
|
722
|
+
|
|
723
|
+
/**
|
|
724
|
+
* @param {Uint8Array} envelope_bytes
|
|
725
|
+
* @param {Uint8Array} secret_key
|
|
726
|
+
* @returns {any}
|
|
727
|
+
*/
|
|
728
|
+
function pairing_request_extract(envelope_bytes, secret_key) {
|
|
729
|
+
const ptr0 = passArray8ToWasm0(envelope_bytes, wasm.__wbindgen_malloc);
|
|
730
|
+
const len0 = WASM_VECTOR_LEN;
|
|
731
|
+
const ptr1 = passArray8ToWasm0(secret_key, wasm.__wbindgen_malloc);
|
|
732
|
+
const len1 = WASM_VECTOR_LEN;
|
|
733
|
+
const ret = wasm.pairing_request_extract(ptr0, len0, ptr1, len1);
|
|
734
|
+
if (ret[2]) {
|
|
735
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
736
|
+
}
|
|
737
|
+
return takeFromExternrefTable0(ret[0]);
|
|
738
|
+
}
|
|
739
|
+
exports.pairing_request_extract = pairing_request_extract;
|
|
740
|
+
|
|
741
|
+
/**
|
|
742
|
+
* Initiator-side: decode an inbound plaintext `PrePairRequest` envelope.
|
|
743
|
+
* @param {Uint8Array} envelope_bytes
|
|
744
|
+
* @returns {any}
|
|
745
|
+
*/
|
|
746
|
+
function pairing_request_extract_pre_pair(envelope_bytes) {
|
|
747
|
+
const ptr0 = passArray8ToWasm0(envelope_bytes, wasm.__wbindgen_malloc);
|
|
748
|
+
const len0 = WASM_VECTOR_LEN;
|
|
749
|
+
const ret = wasm.pairing_request_extract_pre_pair(ptr0, len0);
|
|
750
|
+
if (ret[2]) {
|
|
751
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
752
|
+
}
|
|
753
|
+
return takeFromExternrefTable0(ret[0]);
|
|
754
|
+
}
|
|
755
|
+
exports.pairing_request_extract_pre_pair = pairing_request_extract_pre_pair;
|
|
756
|
+
|
|
757
|
+
/**
|
|
758
|
+
* @param {number} kind
|
|
759
|
+
* @param {any} transport_protocol
|
|
760
|
+
* @param {any} contact_message
|
|
761
|
+
* @param {any} communication_info
|
|
762
|
+
* @param {any} parameter_range
|
|
763
|
+
* @returns {any}
|
|
764
|
+
*/
|
|
765
|
+
function pairing_request_produce(kind, transport_protocol, contact_message, communication_info, parameter_range) {
|
|
766
|
+
const ret = wasm.pairing_request_produce(kind, transport_protocol, contact_message, communication_info, parameter_range);
|
|
767
|
+
if (ret[2]) {
|
|
768
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
769
|
+
}
|
|
770
|
+
return takeFromExternrefTable0(ret[0]);
|
|
771
|
+
}
|
|
772
|
+
exports.pairing_request_produce = pairing_request_produce;
|
|
773
|
+
|
|
774
|
+
/**
|
|
775
|
+
* Scanner-side: build the plaintext `PrePairRequest` envelope for a
|
|
776
|
+
* `HASHED_KEYS` contact.
|
|
777
|
+
* @param {any} transport_protocol
|
|
778
|
+
* @param {any} contact_message
|
|
779
|
+
* @returns {any}
|
|
780
|
+
*/
|
|
781
|
+
function pairing_request_produce_pre_pair(transport_protocol, contact_message) {
|
|
782
|
+
const ret = wasm.pairing_request_produce_pre_pair(transport_protocol, contact_message);
|
|
783
|
+
if (ret[2]) {
|
|
784
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
785
|
+
}
|
|
786
|
+
return takeFromExternrefTable0(ret[0]);
|
|
787
|
+
}
|
|
788
|
+
exports.pairing_request_produce_pre_pair = pairing_request_produce_pre_pair;
|
|
789
|
+
|
|
790
|
+
/**
|
|
791
|
+
* @param {Uint8Array} envelope_bytes
|
|
792
|
+
* @param {Uint8Array} secret_key
|
|
793
|
+
* @returns {any}
|
|
794
|
+
*/
|
|
795
|
+
function pairing_response_extract(envelope_bytes, secret_key) {
|
|
796
|
+
const ptr0 = passArray8ToWasm0(envelope_bytes, wasm.__wbindgen_malloc);
|
|
797
|
+
const len0 = WASM_VECTOR_LEN;
|
|
798
|
+
const ptr1 = passArray8ToWasm0(secret_key, wasm.__wbindgen_malloc);
|
|
799
|
+
const len1 = WASM_VECTOR_LEN;
|
|
800
|
+
const ret = wasm.pairing_response_extract(ptr0, len0, ptr1, len1);
|
|
801
|
+
if (ret[2]) {
|
|
802
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
803
|
+
}
|
|
804
|
+
return takeFromExternrefTable0(ret[0]);
|
|
805
|
+
}
|
|
806
|
+
exports.pairing_response_extract = pairing_response_extract;
|
|
807
|
+
|
|
808
|
+
/**
|
|
809
|
+
* Scanner-side: decode the inbound plaintext `PrePairResponse` envelope.
|
|
810
|
+
* @param {Uint8Array} envelope_bytes
|
|
811
|
+
* @returns {any}
|
|
812
|
+
*/
|
|
813
|
+
function pairing_response_extract_pre_pair(envelope_bytes) {
|
|
814
|
+
const ptr0 = passArray8ToWasm0(envelope_bytes, wasm.__wbindgen_malloc);
|
|
815
|
+
const len0 = WASM_VECTOR_LEN;
|
|
816
|
+
const ret = wasm.pairing_response_extract_pre_pair(ptr0, len0);
|
|
817
|
+
if (ret[2]) {
|
|
818
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
819
|
+
}
|
|
820
|
+
return takeFromExternrefTable0(ret[0]);
|
|
821
|
+
}
|
|
822
|
+
exports.pairing_response_extract_pre_pair = pairing_response_extract_pre_pair;
|
|
823
|
+
|
|
824
|
+
/**
|
|
825
|
+
* @param {any} contact_message
|
|
826
|
+
* @param {any} response
|
|
827
|
+
* @param {Uint8Array} secret_key
|
|
828
|
+
* @returns {any}
|
|
829
|
+
*/
|
|
830
|
+
function pairing_response_process(contact_message, response, secret_key) {
|
|
831
|
+
const ptr0 = passArray8ToWasm0(secret_key, wasm.__wbindgen_malloc);
|
|
832
|
+
const len0 = WASM_VECTOR_LEN;
|
|
833
|
+
const ret = wasm.pairing_response_process(contact_message, response, ptr0, len0);
|
|
834
|
+
if (ret[2]) {
|
|
835
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
836
|
+
}
|
|
837
|
+
return takeFromExternrefTable0(ret[0]);
|
|
838
|
+
}
|
|
839
|
+
exports.pairing_response_process = pairing_response_process;
|
|
840
|
+
|
|
841
|
+
/**
|
|
842
|
+
* Scanner-side: validate the `PrePairResponse` against the contact's
|
|
843
|
+
* SHA-384 binding hash. Returns the validated keys + nonce on match.
|
|
844
|
+
* @param {any} contact_message
|
|
845
|
+
* @param {any} response
|
|
846
|
+
* @returns {any}
|
|
847
|
+
*/
|
|
848
|
+
function pairing_response_process_pre_pair(contact_message, response) {
|
|
849
|
+
const ret = wasm.pairing_response_process_pre_pair(contact_message, response);
|
|
850
|
+
if (ret[2]) {
|
|
851
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
852
|
+
}
|
|
853
|
+
return takeFromExternrefTable0(ret[0]);
|
|
854
|
+
}
|
|
855
|
+
exports.pairing_response_process_pre_pair = pairing_response_process_pre_pair;
|
|
856
|
+
|
|
857
|
+
/**
|
|
858
|
+
* @param {bigint} channel_id
|
|
859
|
+
* @param {any} request
|
|
860
|
+
* @param {Uint8Array} secret_key
|
|
861
|
+
* @param {any} communication_info
|
|
862
|
+
* @param {any} parameter_range
|
|
863
|
+
* @returns {any}
|
|
864
|
+
*/
|
|
865
|
+
function pairing_response_produce(channel_id, request, secret_key, communication_info, parameter_range) {
|
|
866
|
+
const ptr0 = passArray8ToWasm0(secret_key, wasm.__wbindgen_malloc);
|
|
867
|
+
const len0 = WASM_VECTOR_LEN;
|
|
868
|
+
const ret = wasm.pairing_response_produce(channel_id, request, ptr0, len0, communication_info, parameter_range);
|
|
869
|
+
if (ret[2]) {
|
|
870
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
871
|
+
}
|
|
872
|
+
return takeFromExternrefTable0(ret[0]);
|
|
873
|
+
}
|
|
874
|
+
exports.pairing_response_produce = pairing_response_produce;
|
|
875
|
+
|
|
876
|
+
/**
|
|
877
|
+
* Contact-creator side: publish the actual public keys back to the scanner.
|
|
878
|
+
* @param {bigint} channel_id
|
|
879
|
+
* @param {any} request
|
|
880
|
+
* @param {Uint8Array} secret_key
|
|
881
|
+
* @returns {any}
|
|
882
|
+
*/
|
|
883
|
+
function pairing_response_produce_pre_pair(channel_id, request, secret_key) {
|
|
884
|
+
const ptr0 = passArray8ToWasm0(secret_key, wasm.__wbindgen_malloc);
|
|
885
|
+
const len0 = WASM_VECTOR_LEN;
|
|
886
|
+
const ret = wasm.pairing_response_produce_pre_pair(channel_id, request, ptr0, len0);
|
|
887
|
+
if (ret[2]) {
|
|
888
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
889
|
+
}
|
|
890
|
+
return takeFromExternrefTable0(ret[0]);
|
|
891
|
+
}
|
|
892
|
+
exports.pairing_response_produce_pre_pair = pairing_response_produce_pre_pair;
|
|
893
|
+
|
|
894
|
+
/**
|
|
895
|
+
* @param {Uint8Array} envelope_bytes
|
|
896
|
+
* @param {Uint8Array} shared_key
|
|
897
|
+
* @returns {any}
|
|
898
|
+
*/
|
|
899
|
+
function recovery_request_extract(envelope_bytes, shared_key) {
|
|
900
|
+
const ptr0 = passArray8ToWasm0(envelope_bytes, wasm.__wbindgen_malloc);
|
|
901
|
+
const len0 = WASM_VECTOR_LEN;
|
|
902
|
+
const ptr1 = passArray8ToWasm0(shared_key, wasm.__wbindgen_malloc);
|
|
903
|
+
const len1 = WASM_VECTOR_LEN;
|
|
904
|
+
const ret = wasm.recovery_request_extract(ptr0, len0, ptr1, len1);
|
|
905
|
+
if (ret[2]) {
|
|
906
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
907
|
+
}
|
|
908
|
+
return takeFromExternrefTable0(ret[0]);
|
|
909
|
+
}
|
|
910
|
+
exports.recovery_request_extract = recovery_request_extract;
|
|
911
|
+
|
|
912
|
+
/**
|
|
913
|
+
* @param {bigint} channel_id
|
|
914
|
+
* @param {bigint} secret_id
|
|
915
|
+
* @param {number} version
|
|
916
|
+
* @param {Uint8Array} shared_key
|
|
917
|
+
* @param {any} reply_to
|
|
918
|
+
* @returns {any}
|
|
919
|
+
*/
|
|
920
|
+
function recovery_request_produce(channel_id, secret_id, version, shared_key, reply_to) {
|
|
921
|
+
const ptr0 = passArray8ToWasm0(shared_key, wasm.__wbindgen_malloc);
|
|
922
|
+
const len0 = WASM_VECTOR_LEN;
|
|
923
|
+
const ret = wasm.recovery_request_produce(channel_id, secret_id, version, ptr0, len0, reply_to);
|
|
924
|
+
if (ret[2]) {
|
|
925
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
926
|
+
}
|
|
927
|
+
return takeFromExternrefTable0(ret[0]);
|
|
928
|
+
}
|
|
929
|
+
exports.recovery_request_produce = recovery_request_produce;
|
|
930
|
+
|
|
931
|
+
/**
|
|
932
|
+
* @param {Uint8Array} envelope_bytes
|
|
933
|
+
* @param {Uint8Array} shared_key
|
|
934
|
+
* @returns {any}
|
|
935
|
+
*/
|
|
936
|
+
function recovery_response_extract(envelope_bytes, shared_key) {
|
|
937
|
+
const ptr0 = passArray8ToWasm0(envelope_bytes, wasm.__wbindgen_malloc);
|
|
938
|
+
const len0 = WASM_VECTOR_LEN;
|
|
939
|
+
const ptr1 = passArray8ToWasm0(shared_key, wasm.__wbindgen_malloc);
|
|
940
|
+
const len1 = WASM_VECTOR_LEN;
|
|
941
|
+
const ret = wasm.recovery_response_extract(ptr0, len0, ptr1, len1);
|
|
942
|
+
if (ret[2]) {
|
|
943
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
944
|
+
}
|
|
945
|
+
return takeFromExternrefTable0(ret[0]);
|
|
946
|
+
}
|
|
947
|
+
exports.recovery_response_extract = recovery_response_extract;
|
|
948
|
+
|
|
949
|
+
/**
|
|
950
|
+
* @param {bigint} channel_id
|
|
951
|
+
* @param {any} request
|
|
952
|
+
* @param {any} stored_share_request
|
|
953
|
+
* @param {Uint8Array} shared_key
|
|
954
|
+
* @returns {any}
|
|
955
|
+
*/
|
|
956
|
+
function recovery_response_produce(channel_id, request, stored_share_request, shared_key) {
|
|
957
|
+
const ptr0 = passArray8ToWasm0(shared_key, wasm.__wbindgen_malloc);
|
|
958
|
+
const len0 = WASM_VECTOR_LEN;
|
|
959
|
+
const ret = wasm.recovery_response_produce(channel_id, request, stored_share_request, ptr0, len0);
|
|
960
|
+
if (ret[2]) {
|
|
961
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
962
|
+
}
|
|
963
|
+
return takeFromExternrefTable0(ret[0]);
|
|
964
|
+
}
|
|
965
|
+
exports.recovery_response_produce = recovery_response_produce;
|
|
966
|
+
|
|
967
|
+
/**
|
|
968
|
+
* @param {bigint} secret_id
|
|
969
|
+
* @param {number} version
|
|
970
|
+
* @param {any} responses
|
|
971
|
+
* @returns {any}
|
|
972
|
+
*/
|
|
973
|
+
function recovery_response_recover(secret_id, version, responses) {
|
|
974
|
+
const ret = wasm.recovery_response_recover(secret_id, version, responses);
|
|
975
|
+
if (ret[2]) {
|
|
976
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
977
|
+
}
|
|
978
|
+
return takeFromExternrefTable0(ret[0]);
|
|
979
|
+
}
|
|
980
|
+
exports.recovery_response_recover = recovery_response_recover;
|
|
981
|
+
|
|
982
|
+
/**
|
|
983
|
+
* @param {Uint8Array} envelope_bytes
|
|
984
|
+
* @param {Uint8Array} shared_key
|
|
19
985
|
* @returns {any}
|
|
20
986
|
*/
|
|
21
|
-
function
|
|
22
|
-
const ptr0 =
|
|
987
|
+
function sharing_request_extract(envelope_bytes, shared_key) {
|
|
988
|
+
const ptr0 = passArray8ToWasm0(envelope_bytes, wasm.__wbindgen_malloc);
|
|
23
989
|
const len0 = WASM_VECTOR_LEN;
|
|
24
|
-
const
|
|
990
|
+
const ptr1 = passArray8ToWasm0(shared_key, wasm.__wbindgen_malloc);
|
|
991
|
+
const len1 = WASM_VECTOR_LEN;
|
|
992
|
+
const ret = wasm.sharing_request_extract(ptr0, len0, ptr1, len1);
|
|
25
993
|
if (ret[2]) {
|
|
26
994
|
throw takeFromExternrefTable0(ret[1]);
|
|
27
995
|
}
|
|
28
996
|
return takeFromExternrefTable0(ret[0]);
|
|
29
997
|
}
|
|
30
|
-
exports.
|
|
998
|
+
exports.sharing_request_extract = sharing_request_extract;
|
|
31
999
|
|
|
32
1000
|
/**
|
|
33
|
-
* Generates a recovery request envelope.
|
|
34
|
-
*
|
|
35
|
-
* # Arguments
|
|
36
|
-
*
|
|
37
|
-
* * `channel_id` - Helper channel identifier
|
|
38
|
-
* * `secret_id` - Secret identifier being recovered
|
|
39
|
-
* * `version` - Share version being requested
|
|
40
|
-
* * `shared_key` - 32-byte symmetric key established during pairing
|
|
41
|
-
*
|
|
42
|
-
* # Returns
|
|
43
|
-
*
|
|
44
|
-
* Serialized outer `DeRecMessage` bytes carrying an encrypted inner
|
|
45
|
-
* `GetShareRequestMessage`.
|
|
46
1001
|
* @param {bigint} channel_id
|
|
47
|
-
* @param {Uint8Array} secret_id
|
|
48
1002
|
* @param {number} version
|
|
1003
|
+
* @param {bigint} secret_id
|
|
1004
|
+
* @param {any} committed_share
|
|
1005
|
+
* @param {any} keep_list
|
|
1006
|
+
* @param {string} description
|
|
49
1007
|
* @param {Uint8Array} shared_key
|
|
50
|
-
* @
|
|
1008
|
+
* @param {any} reply_to
|
|
1009
|
+
* @param {any} replica_id
|
|
1010
|
+
* @returns {any}
|
|
51
1011
|
*/
|
|
52
|
-
function
|
|
53
|
-
const ptr0 =
|
|
1012
|
+
function sharing_request_produce(channel_id, version, secret_id, committed_share, keep_list, description, shared_key, reply_to, replica_id) {
|
|
1013
|
+
const ptr0 = passStringToWasm0(description, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
54
1014
|
const len0 = WASM_VECTOR_LEN;
|
|
55
1015
|
const ptr1 = passArray8ToWasm0(shared_key, wasm.__wbindgen_malloc);
|
|
56
1016
|
const len1 = WASM_VECTOR_LEN;
|
|
57
|
-
const ret = wasm.
|
|
58
|
-
if (ret[
|
|
59
|
-
throw takeFromExternrefTable0(ret[
|
|
1017
|
+
const ret = wasm.sharing_request_produce(channel_id, version, secret_id, committed_share, keep_list, ptr0, len0, ptr1, len1, reply_to, replica_id);
|
|
1018
|
+
if (ret[2]) {
|
|
1019
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
60
1020
|
}
|
|
61
|
-
|
|
62
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
63
|
-
return v3;
|
|
1021
|
+
return takeFromExternrefTable0(ret[0]);
|
|
64
1022
|
}
|
|
65
|
-
exports.
|
|
1023
|
+
exports.sharing_request_produce = sharing_request_produce;
|
|
66
1024
|
|
|
67
1025
|
/**
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
* @param {Uint8Array}
|
|
88
|
-
* @param {Uint8Array} request_wire_bytes
|
|
1026
|
+
* @param {any} channels
|
|
1027
|
+
* @param {bigint} secret_id
|
|
1028
|
+
* @param {number} version
|
|
1029
|
+
* @param {Uint8Array} secret_data
|
|
1030
|
+
* @param {number} threshold
|
|
1031
|
+
* @returns {any}
|
|
1032
|
+
*/
|
|
1033
|
+
function sharing_request_split(channels, secret_id, version, secret_data, threshold) {
|
|
1034
|
+
const ptr0 = passArray8ToWasm0(secret_data, wasm.__wbindgen_malloc);
|
|
1035
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1036
|
+
const ret = wasm.sharing_request_split(channels, secret_id, version, ptr0, len0, threshold);
|
|
1037
|
+
if (ret[2]) {
|
|
1038
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1039
|
+
}
|
|
1040
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1041
|
+
}
|
|
1042
|
+
exports.sharing_request_split = sharing_request_split;
|
|
1043
|
+
|
|
1044
|
+
/**
|
|
1045
|
+
* @param {Uint8Array} envelope_bytes
|
|
89
1046
|
* @param {Uint8Array} shared_key
|
|
90
|
-
* @returns {
|
|
1047
|
+
* @returns {any}
|
|
91
1048
|
*/
|
|
92
|
-
function
|
|
93
|
-
const ptr0 = passArray8ToWasm0(
|
|
1049
|
+
function sharing_response_extract(envelope_bytes, shared_key) {
|
|
1050
|
+
const ptr0 = passArray8ToWasm0(envelope_bytes, wasm.__wbindgen_malloc);
|
|
94
1051
|
const len0 = WASM_VECTOR_LEN;
|
|
95
|
-
const ptr1 = passArray8ToWasm0(
|
|
1052
|
+
const ptr1 = passArray8ToWasm0(shared_key, wasm.__wbindgen_malloc);
|
|
96
1053
|
const len1 = WASM_VECTOR_LEN;
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
const len3 = WASM_VECTOR_LEN;
|
|
101
|
-
const ret = wasm.generate_share_response(ptr0, len0, channel_id, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
102
|
-
if (ret[3]) {
|
|
103
|
-
throw takeFromExternrefTable0(ret[2]);
|
|
1054
|
+
const ret = wasm.sharing_response_extract(ptr0, len0, ptr1, len1);
|
|
1055
|
+
if (ret[2]) {
|
|
1056
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
104
1057
|
}
|
|
105
|
-
|
|
106
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
107
|
-
return v5;
|
|
1058
|
+
return takeFromExternrefTable0(ret[0]);
|
|
108
1059
|
}
|
|
109
|
-
exports.
|
|
1060
|
+
exports.sharing_response_extract = sharing_response_extract;
|
|
110
1061
|
|
|
111
1062
|
/**
|
|
112
|
-
* Generates a verification request envelope.
|
|
113
|
-
*
|
|
114
|
-
* # Arguments
|
|
115
|
-
*
|
|
116
|
-
* * `secret_id` - Secret identifier
|
|
117
|
-
* * `channel_id` - Helper channel identifier
|
|
118
|
-
* * `version` - Share-distribution version being verified
|
|
119
|
-
* * `shared_key` - 32-byte symmetric key established during pairing
|
|
120
|
-
*
|
|
121
|
-
* # Returns
|
|
122
|
-
*
|
|
123
|
-
* A JS object with:
|
|
124
|
-
*
|
|
125
|
-
* - `wire_bytes`: serialized outer `DeRecMessage` bytes carrying an encrypted
|
|
126
|
-
* inner `VerifyShareRequestMessage`
|
|
127
|
-
* @param {Uint8Array} secret_id
|
|
128
|
-
* @param {bigint} channel_id
|
|
129
1063
|
* @param {number} version
|
|
1064
|
+
* @param {any} response
|
|
1065
|
+
*/
|
|
1066
|
+
function sharing_response_process(version, response) {
|
|
1067
|
+
const ret = wasm.sharing_response_process(version, response);
|
|
1068
|
+
if (ret[1]) {
|
|
1069
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
1070
|
+
}
|
|
1071
|
+
}
|
|
1072
|
+
exports.sharing_response_process = sharing_response_process;
|
|
1073
|
+
|
|
1074
|
+
/**
|
|
1075
|
+
* @param {bigint} channel_id
|
|
1076
|
+
* @param {any} request
|
|
1077
|
+
* @param {Uint8Array} shared_key
|
|
1078
|
+
* @returns {any}
|
|
1079
|
+
*/
|
|
1080
|
+
function sharing_response_produce(channel_id, request, shared_key) {
|
|
1081
|
+
const ptr0 = passArray8ToWasm0(shared_key, wasm.__wbindgen_malloc);
|
|
1082
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1083
|
+
const ret = wasm.sharing_response_produce(channel_id, request, ptr0, len0);
|
|
1084
|
+
if (ret[2]) {
|
|
1085
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1086
|
+
}
|
|
1087
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1088
|
+
}
|
|
1089
|
+
exports.sharing_response_produce = sharing_response_produce;
|
|
1090
|
+
|
|
1091
|
+
/**
|
|
1092
|
+
* @param {Uint8Array} envelope_bytes
|
|
130
1093
|
* @param {Uint8Array} shared_key
|
|
131
1094
|
* @returns {any}
|
|
132
1095
|
*/
|
|
133
|
-
function
|
|
134
|
-
const ptr0 = passArray8ToWasm0(
|
|
1096
|
+
function unpairing_request_extract(envelope_bytes, shared_key) {
|
|
1097
|
+
const ptr0 = passArray8ToWasm0(envelope_bytes, wasm.__wbindgen_malloc);
|
|
135
1098
|
const len0 = WASM_VECTOR_LEN;
|
|
136
1099
|
const ptr1 = passArray8ToWasm0(shared_key, wasm.__wbindgen_malloc);
|
|
137
1100
|
const len1 = WASM_VECTOR_LEN;
|
|
138
|
-
const ret = wasm.
|
|
1101
|
+
const ret = wasm.unpairing_request_extract(ptr0, len0, ptr1, len1);
|
|
139
1102
|
if (ret[2]) {
|
|
140
1103
|
throw takeFromExternrefTable0(ret[1]);
|
|
141
1104
|
}
|
|
142
1105
|
return takeFromExternrefTable0(ret[0]);
|
|
143
1106
|
}
|
|
144
|
-
exports.
|
|
1107
|
+
exports.unpairing_request_extract = unpairing_request_extract;
|
|
145
1108
|
|
|
146
1109
|
/**
|
|
147
|
-
* Generates a verification response envelope.
|
|
148
|
-
*
|
|
149
|
-
* # Arguments
|
|
150
|
-
*
|
|
151
|
-
* * `secret_id` - Secret identifier
|
|
152
|
-
* * `channel_id` - Helper channel identifier
|
|
153
|
-
* * `shared_key` - 32-byte symmetric key established during pairing
|
|
154
|
-
* * `share_content` - Share bytes whose possession is being proven
|
|
155
|
-
* * `request_bytes` - Serialized outer `DeRecMessage` bytes carrying encrypted
|
|
156
|
-
* inner `VerifyShareRequestMessage`
|
|
157
|
-
*
|
|
158
|
-
* # Returns
|
|
159
|
-
*
|
|
160
|
-
* A JS object with:
|
|
161
|
-
*
|
|
162
|
-
* - `wire_bytes`: serialized outer `DeRecMessage` bytes carrying an encrypted
|
|
163
|
-
* inner `VerifyShareResponseMessage`
|
|
164
|
-
* @param {Uint8Array} secret_id
|
|
165
1110
|
* @param {bigint} channel_id
|
|
1111
|
+
* @param {string} memo
|
|
166
1112
|
* @param {Uint8Array} shared_key
|
|
167
|
-
* @param {
|
|
168
|
-
* @param {Uint8Array} request_bytes
|
|
1113
|
+
* @param {any} reply_to
|
|
169
1114
|
* @returns {any}
|
|
170
1115
|
*/
|
|
171
|
-
function
|
|
172
|
-
const ptr0 =
|
|
1116
|
+
function unpairing_request_produce(channel_id, memo, shared_key, reply_to) {
|
|
1117
|
+
const ptr0 = passStringToWasm0(memo, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
173
1118
|
const len0 = WASM_VECTOR_LEN;
|
|
174
1119
|
const ptr1 = passArray8ToWasm0(shared_key, wasm.__wbindgen_malloc);
|
|
175
1120
|
const len1 = WASM_VECTOR_LEN;
|
|
176
|
-
const
|
|
177
|
-
const len2 = WASM_VECTOR_LEN;
|
|
178
|
-
const ptr3 = passArray8ToWasm0(request_bytes, wasm.__wbindgen_malloc);
|
|
179
|
-
const len3 = WASM_VECTOR_LEN;
|
|
180
|
-
const ret = wasm.generate_verification_response(ptr0, len0, channel_id, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
1121
|
+
const ret = wasm.unpairing_request_produce(channel_id, ptr0, len0, ptr1, len1, reply_to);
|
|
181
1122
|
if (ret[2]) {
|
|
182
1123
|
throw takeFromExternrefTable0(ret[1]);
|
|
183
1124
|
}
|
|
184
1125
|
return takeFromExternrefTable0(ret[0]);
|
|
185
1126
|
}
|
|
186
|
-
exports.
|
|
1127
|
+
exports.unpairing_request_produce = unpairing_request_produce;
|
|
187
1128
|
|
|
188
1129
|
/**
|
|
189
|
-
*
|
|
190
|
-
*
|
|
191
|
-
* This is the **responder-side** finalization step: the party that created the pairing request
|
|
192
|
-
* processes the pairing response and derives the same final shared key.
|
|
193
|
-
*
|
|
194
|
-
* # Arguments
|
|
195
|
-
*
|
|
196
|
-
* * `contact_message_bytes` - Plain serialized `ContactMessage` bytes
|
|
197
|
-
* * `pair_response_wire_bytes` - Serialized outer `DeRecMessage` carrying encrypted inner response bytes
|
|
198
|
-
* * `pairing_secret_key_material` - Serialized responder-side `PairingSecretKeyMaterial`
|
|
199
|
-
*
|
|
200
|
-
* # Returns
|
|
201
|
-
*
|
|
202
|
-
* A JS object with:
|
|
203
|
-
*
|
|
204
|
-
* - `pairing_shared_key`: final shared pairing key
|
|
205
|
-
* @param {Uint8Array} contact_message_bytes
|
|
206
|
-
* @param {Uint8Array} pair_response_wire_bytes
|
|
207
|
-
* @param {Uint8Array} pairing_secret_key_material
|
|
1130
|
+
* @param {Uint8Array} envelope_bytes
|
|
1131
|
+
* @param {Uint8Array} shared_key
|
|
208
1132
|
* @returns {any}
|
|
209
1133
|
*/
|
|
210
|
-
function
|
|
211
|
-
const ptr0 = passArray8ToWasm0(
|
|
1134
|
+
function unpairing_response_extract(envelope_bytes, shared_key) {
|
|
1135
|
+
const ptr0 = passArray8ToWasm0(envelope_bytes, wasm.__wbindgen_malloc);
|
|
212
1136
|
const len0 = WASM_VECTOR_LEN;
|
|
213
|
-
const ptr1 = passArray8ToWasm0(
|
|
1137
|
+
const ptr1 = passArray8ToWasm0(shared_key, wasm.__wbindgen_malloc);
|
|
214
1138
|
const len1 = WASM_VECTOR_LEN;
|
|
215
|
-
const
|
|
216
|
-
const len2 = WASM_VECTOR_LEN;
|
|
217
|
-
const ret = wasm.process_pairing_response_message(ptr0, len0, ptr1, len1, ptr2, len2);
|
|
1139
|
+
const ret = wasm.unpairing_response_extract(ptr0, len0, ptr1, len1);
|
|
218
1140
|
if (ret[2]) {
|
|
219
1141
|
throw takeFromExternrefTable0(ret[1]);
|
|
220
1142
|
}
|
|
221
1143
|
return takeFromExternrefTable0(ret[0]);
|
|
222
1144
|
}
|
|
223
|
-
exports.
|
|
1145
|
+
exports.unpairing_response_extract = unpairing_response_extract;
|
|
224
1146
|
|
|
225
1147
|
/**
|
|
226
|
-
*
|
|
227
|
-
*
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
*
|
|
240
|
-
*
|
|
241
|
-
*
|
|
242
|
-
* A JS object with:
|
|
243
|
-
*
|
|
244
|
-
* - `wire_bytes`: serialized outer `DeRecMessage` bytes
|
|
245
|
-
* - `secret_key_material`: serialized responder-side `PairingSecretKeyMaterial`
|
|
246
|
-
* @param {number} kind
|
|
247
|
-
* @param {string} transport_uri
|
|
248
|
-
* @param {Uint8Array} contact_message_bytes
|
|
1148
|
+
* @param {any} response
|
|
1149
|
+
* @returns {any}
|
|
1150
|
+
*/
|
|
1151
|
+
function unpairing_response_process(response) {
|
|
1152
|
+
const ret = wasm.unpairing_response_process(response);
|
|
1153
|
+
if (ret[2]) {
|
|
1154
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1155
|
+
}
|
|
1156
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1157
|
+
}
|
|
1158
|
+
exports.unpairing_response_process = unpairing_response_process;
|
|
1159
|
+
|
|
1160
|
+
/**
|
|
1161
|
+
* @param {bigint} channel_id
|
|
1162
|
+
* @param {Uint8Array} shared_key
|
|
249
1163
|
* @returns {any}
|
|
250
1164
|
*/
|
|
251
|
-
function
|
|
252
|
-
const ptr0 =
|
|
1165
|
+
function unpairing_response_produce(channel_id, shared_key) {
|
|
1166
|
+
const ptr0 = passArray8ToWasm0(shared_key, wasm.__wbindgen_malloc);
|
|
253
1167
|
const len0 = WASM_VECTOR_LEN;
|
|
254
|
-
const
|
|
255
|
-
const len1 = WASM_VECTOR_LEN;
|
|
256
|
-
const ret = wasm.produce_pairing_request_message(kind, ptr0, len0, ptr1, len1);
|
|
1168
|
+
const ret = wasm.unpairing_response_produce(channel_id, ptr0, len0);
|
|
257
1169
|
if (ret[2]) {
|
|
258
1170
|
throw takeFromExternrefTable0(ret[1]);
|
|
259
1171
|
}
|
|
260
1172
|
return takeFromExternrefTable0(ret[0]);
|
|
261
1173
|
}
|
|
262
|
-
exports.
|
|
1174
|
+
exports.unpairing_response_produce = unpairing_response_produce;
|
|
263
1175
|
|
|
264
1176
|
/**
|
|
265
|
-
*
|
|
266
|
-
*
|
|
267
|
-
* This is the **initiator-side** step: the party that originally created the contact
|
|
268
|
-
* processes the incoming pairing request and returns the pairing response.
|
|
269
|
-
*
|
|
270
|
-
* # Arguments
|
|
271
|
-
*
|
|
272
|
-
* * `kind` - Sender role encoded as:
|
|
273
|
-
* - `0` => `SharerNonRecovery`
|
|
274
|
-
* - `1` => `SharerRecovery`
|
|
275
|
-
* - `2` => `Helper`
|
|
276
|
-
* * `pair_request_wire_bytes` - Serialized outer `DeRecMessage` carrying encrypted inner request bytes
|
|
277
|
-
* * `pairing_secret_key_material` - Serialized initiator-side `PairingSecretKeyMaterial`
|
|
278
|
-
*
|
|
279
|
-
* # Returns
|
|
280
|
-
*
|
|
281
|
-
* A JS object with:
|
|
282
|
-
*
|
|
283
|
-
* - `wire_bytes`: serialized outer `DeRecMessage` bytes carrying encrypted inner response bytes
|
|
284
|
-
* - `transport_protocol`: transport information extracted from the pairing request
|
|
285
|
-
* - `pairing_shared_key`: final shared pairing key
|
|
286
|
-
* @param {number} kind
|
|
287
|
-
* @param {Uint8Array} pair_request_wire_bytes
|
|
288
|
-
* @param {Uint8Array} pairing_secret_key_material
|
|
1177
|
+
* @param {Uint8Array} envelope_bytes
|
|
1178
|
+
* @param {Uint8Array} shared_key
|
|
289
1179
|
* @returns {any}
|
|
290
1180
|
*/
|
|
291
|
-
function
|
|
292
|
-
const ptr0 = passArray8ToWasm0(
|
|
1181
|
+
function verification_request_extract(envelope_bytes, shared_key) {
|
|
1182
|
+
const ptr0 = passArray8ToWasm0(envelope_bytes, wasm.__wbindgen_malloc);
|
|
293
1183
|
const len0 = WASM_VECTOR_LEN;
|
|
294
|
-
const ptr1 = passArray8ToWasm0(
|
|
1184
|
+
const ptr1 = passArray8ToWasm0(shared_key, wasm.__wbindgen_malloc);
|
|
295
1185
|
const len1 = WASM_VECTOR_LEN;
|
|
296
|
-
const ret = wasm.
|
|
1186
|
+
const ret = wasm.verification_request_extract(ptr0, len0, ptr1, len1);
|
|
297
1187
|
if (ret[2]) {
|
|
298
1188
|
throw takeFromExternrefTable0(ret[1]);
|
|
299
1189
|
}
|
|
300
1190
|
return takeFromExternrefTable0(ret[0]);
|
|
301
1191
|
}
|
|
302
|
-
exports.
|
|
1192
|
+
exports.verification_request_extract = verification_request_extract;
|
|
303
1193
|
|
|
304
1194
|
/**
|
|
305
|
-
*
|
|
306
|
-
*
|
|
307
|
-
*
|
|
308
|
-
* # JavaScript input shape
|
|
309
|
-
*
|
|
310
|
-
* The `channels` argument must be a JS array of objects like:
|
|
311
|
-
*
|
|
312
|
-
* ```ts
|
|
313
|
-
* [
|
|
314
|
-
* { channel_id: 1, shared_key: new Uint8Array(32) },
|
|
315
|
-
* { channel_id: 2, shared_key: new Uint8Array(32) },
|
|
316
|
-
* ]
|
|
317
|
-
* ```
|
|
318
|
-
*
|
|
319
|
-
* Each `shared_key` must be exactly 32 bytes.
|
|
320
|
-
*
|
|
321
|
-
* The `keep_list` argument may be:
|
|
322
|
-
*
|
|
323
|
-
* - `undefined` or `null`, meaning no keep-list is provided
|
|
324
|
-
* - an array of integers, for example:
|
|
325
|
-
*
|
|
326
|
-
* ```ts
|
|
327
|
-
* [1, 2, 3]
|
|
328
|
-
* ```
|
|
329
|
-
*
|
|
330
|
-
* The `description` argument may be:
|
|
331
|
-
*
|
|
332
|
-
* - `undefined` or `null`, meaning no description is provided
|
|
333
|
-
* - a string, for example:
|
|
334
|
-
*
|
|
335
|
-
* ```ts
|
|
336
|
-
* "initial distribution"
|
|
337
|
-
* ```
|
|
338
|
-
*
|
|
339
|
-
* # Returns
|
|
340
|
-
*
|
|
341
|
-
* A JS object of the form:
|
|
342
|
-
*
|
|
343
|
-
* ```ts
|
|
344
|
-
* {
|
|
345
|
-
* value: {
|
|
346
|
-
* [channelId: number]: Uint8Array
|
|
347
|
-
* }
|
|
348
|
-
* }
|
|
349
|
-
* ```
|
|
350
|
-
*
|
|
351
|
-
* where each value is a serialized outer `DeRecMessage` envelope.
|
|
352
|
-
*
|
|
353
|
-
* # Arguments
|
|
354
|
-
*
|
|
355
|
-
* * `secret_id` - Secret identifier embedded into each generated share
|
|
356
|
-
* * `secret_data` - Secret bytes to split and distribute
|
|
357
|
-
* * `channels` - JS array of `{ channel_id, shared_key }` entries
|
|
358
|
-
* * `threshold` - Minimum number of shares required for reconstruction
|
|
359
|
-
* * `version` - Share-distribution version embedded into the generated messages
|
|
360
|
-
* * `keep_list` - Optional JS array of versions helpers should retain
|
|
361
|
-
* * `description` - Optional version description
|
|
362
|
-
* @param {Uint8Array} secret_id
|
|
363
|
-
* @param {Uint8Array} secret_data
|
|
364
|
-
* @param {any} channels
|
|
365
|
-
* @param {number} threshold
|
|
1195
|
+
* @param {bigint} channel_id
|
|
1196
|
+
* @param {bigint} secret_id
|
|
366
1197
|
* @param {number} version
|
|
367
|
-
* @param {
|
|
368
|
-
* @param {
|
|
1198
|
+
* @param {Uint8Array} shared_key
|
|
1199
|
+
* @param {any} reply_to
|
|
1200
|
+
* @returns {any}
|
|
1201
|
+
*/
|
|
1202
|
+
function verification_request_produce(channel_id, secret_id, version, shared_key, reply_to) {
|
|
1203
|
+
const ptr0 = passArray8ToWasm0(shared_key, wasm.__wbindgen_malloc);
|
|
1204
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1205
|
+
const ret = wasm.verification_request_produce(channel_id, secret_id, version, ptr0, len0, reply_to);
|
|
1206
|
+
if (ret[2]) {
|
|
1207
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1208
|
+
}
|
|
1209
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1210
|
+
}
|
|
1211
|
+
exports.verification_request_produce = verification_request_produce;
|
|
1212
|
+
|
|
1213
|
+
/**
|
|
1214
|
+
* @param {Uint8Array} envelope_bytes
|
|
1215
|
+
* @param {Uint8Array} shared_key
|
|
369
1216
|
* @returns {any}
|
|
370
1217
|
*/
|
|
371
|
-
function
|
|
372
|
-
const ptr0 = passArray8ToWasm0(
|
|
1218
|
+
function verification_response_extract(envelope_bytes, shared_key) {
|
|
1219
|
+
const ptr0 = passArray8ToWasm0(envelope_bytes, wasm.__wbindgen_malloc);
|
|
373
1220
|
const len0 = WASM_VECTOR_LEN;
|
|
374
|
-
const ptr1 = passArray8ToWasm0(
|
|
1221
|
+
const ptr1 = passArray8ToWasm0(shared_key, wasm.__wbindgen_malloc);
|
|
375
1222
|
const len1 = WASM_VECTOR_LEN;
|
|
376
|
-
|
|
377
|
-
var len2 = WASM_VECTOR_LEN;
|
|
378
|
-
const ret = wasm.protect_secret(ptr0, len0, ptr1, len1, channels, threshold, version, keep_list, ptr2, len2);
|
|
1223
|
+
const ret = wasm.verification_response_extract(ptr0, len0, ptr1, len1);
|
|
379
1224
|
if (ret[2]) {
|
|
380
1225
|
throw takeFromExternrefTable0(ret[1]);
|
|
381
1226
|
}
|
|
382
1227
|
return takeFromExternrefTable0(ret[0]);
|
|
383
1228
|
}
|
|
384
|
-
exports.
|
|
1229
|
+
exports.verification_response_extract = verification_response_extract;
|
|
385
1230
|
|
|
386
1231
|
/**
|
|
387
|
-
*
|
|
388
|
-
*
|
|
389
|
-
*
|
|
390
|
-
*
|
|
391
|
-
*
|
|
392
|
-
*
|
|
393
|
-
*
|
|
394
|
-
*
|
|
395
|
-
*
|
|
396
|
-
*
|
|
397
|
-
*
|
|
398
|
-
*
|
|
399
|
-
* The reconstructed secret bytes.
|
|
400
|
-
* @param {any} responses
|
|
401
|
-
* @param {Uint8Array} secret_id
|
|
402
|
-
* @param {number} version
|
|
403
|
-
* @returns {Uint8Array}
|
|
1232
|
+
* Verify a `VerifyShareResponseMessage` against the originating
|
|
1233
|
+
* `VerifyShareRequestMessage` and the expected share content.
|
|
1234
|
+
*
|
|
1235
|
+
* `request` must be the request the **owner** previously produced for
|
|
1236
|
+
* this challenge (kept by the caller in a per-`channel_id` pending-
|
|
1237
|
+
* verification map). The primitive rejects any response whose
|
|
1238
|
+
* `(nonce, secret_id, version)` triple doesn't match — that's the
|
|
1239
|
+
* anti-replay gate.
|
|
1240
|
+
* @param {any} request
|
|
1241
|
+
* @param {any} response
|
|
1242
|
+
* @param {Uint8Array} share_content
|
|
1243
|
+
* @returns {boolean}
|
|
404
1244
|
*/
|
|
405
|
-
function
|
|
406
|
-
const ptr0 = passArray8ToWasm0(
|
|
1245
|
+
function verification_response_process(request, response, share_content) {
|
|
1246
|
+
const ptr0 = passArray8ToWasm0(share_content, wasm.__wbindgen_malloc);
|
|
407
1247
|
const len0 = WASM_VECTOR_LEN;
|
|
408
|
-
const ret = wasm.
|
|
409
|
-
if (ret[
|
|
410
|
-
throw takeFromExternrefTable0(ret[
|
|
1248
|
+
const ret = wasm.verification_response_process(request, response, ptr0, len0);
|
|
1249
|
+
if (ret[2]) {
|
|
1250
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
411
1251
|
}
|
|
412
|
-
|
|
413
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
414
|
-
return v2;
|
|
1252
|
+
return ret[0] !== 0;
|
|
415
1253
|
}
|
|
416
|
-
exports.
|
|
1254
|
+
exports.verification_response_process = verification_response_process;
|
|
417
1255
|
|
|
418
1256
|
/**
|
|
419
|
-
* Verifies a verification response envelope.
|
|
420
|
-
*
|
|
421
|
-
* # Arguments
|
|
422
|
-
*
|
|
423
|
-
* * `secret_id` - Secret identifier
|
|
424
|
-
* * `channel_id` - Helper channel identifier
|
|
425
|
-
* * `shared_key` - 32-byte symmetric key established during pairing
|
|
426
|
-
* * `share_content` - Expected share bytes
|
|
427
|
-
* * `response_bytes` - Serialized outer `DeRecMessage` bytes carrying encrypted
|
|
428
|
-
* inner `VerifyShareResponseMessage`
|
|
429
|
-
*
|
|
430
|
-
* # Returns
|
|
431
|
-
*
|
|
432
|
-
* `true` if the verification response is valid, otherwise `false`.
|
|
433
|
-
* @param {Uint8Array} secret_id
|
|
434
1257
|
* @param {bigint} channel_id
|
|
1258
|
+
* @param {any} request
|
|
435
1259
|
* @param {Uint8Array} shared_key
|
|
436
1260
|
* @param {Uint8Array} share_content
|
|
437
|
-
* @
|
|
438
|
-
* @returns {boolean}
|
|
1261
|
+
* @returns {any}
|
|
439
1262
|
*/
|
|
440
|
-
function
|
|
441
|
-
const ptr0 = passArray8ToWasm0(
|
|
1263
|
+
function verification_response_produce(channel_id, request, shared_key, share_content) {
|
|
1264
|
+
const ptr0 = passArray8ToWasm0(shared_key, wasm.__wbindgen_malloc);
|
|
442
1265
|
const len0 = WASM_VECTOR_LEN;
|
|
443
|
-
const ptr1 = passArray8ToWasm0(
|
|
1266
|
+
const ptr1 = passArray8ToWasm0(share_content, wasm.__wbindgen_malloc);
|
|
444
1267
|
const len1 = WASM_VECTOR_LEN;
|
|
445
|
-
const
|
|
446
|
-
const len2 = WASM_VECTOR_LEN;
|
|
447
|
-
const ptr3 = passArray8ToWasm0(response_bytes, wasm.__wbindgen_malloc);
|
|
448
|
-
const len3 = WASM_VECTOR_LEN;
|
|
449
|
-
const ret = wasm.verify_share_response(ptr0, len0, channel_id, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
1268
|
+
const ret = wasm.verification_response_produce(channel_id, request, ptr0, len0, ptr1, len1);
|
|
450
1269
|
if (ret[2]) {
|
|
451
1270
|
throw takeFromExternrefTable0(ret[1]);
|
|
452
1271
|
}
|
|
453
|
-
return ret[0]
|
|
1272
|
+
return takeFromExternrefTable0(ret[0]);
|
|
454
1273
|
}
|
|
455
|
-
exports.
|
|
1274
|
+
exports.verification_response_produce = verification_response_produce;
|
|
456
1275
|
|
|
457
1276
|
function wasm_start() {
|
|
458
1277
|
wasm.wasm_start();
|
|
459
1278
|
}
|
|
460
1279
|
exports.wasm_start = wasm_start;
|
|
461
|
-
|
|
462
1280
|
function __wbg_get_imports() {
|
|
463
1281
|
const import0 = {
|
|
464
1282
|
__proto__: null,
|
|
465
|
-
|
|
1283
|
+
__wbg_BigInt_9fb73aa817d633b1: function(arg0) {
|
|
1284
|
+
const ret = BigInt(arg0);
|
|
1285
|
+
return ret;
|
|
1286
|
+
},
|
|
1287
|
+
__wbg_Error_92b29b0548f8b746: function(arg0, arg1) {
|
|
466
1288
|
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
467
1289
|
return ret;
|
|
468
1290
|
},
|
|
469
|
-
|
|
1291
|
+
__wbg_Number_9a4e0ecb0fa16705: function(arg0) {
|
|
470
1292
|
const ret = Number(arg0);
|
|
471
1293
|
return ret;
|
|
472
1294
|
},
|
|
@@ -477,68 +1299,76 @@ function __wbg_get_imports() {
|
|
|
477
1299
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
478
1300
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
479
1301
|
},
|
|
480
|
-
|
|
1302
|
+
__wbg___wbindgen_bigint_get_as_i64_d968e41184ae354f: function(arg0, arg1) {
|
|
481
1303
|
const v = arg1;
|
|
482
1304
|
const ret = typeof(v) === 'bigint' ? v : undefined;
|
|
483
1305
|
getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
|
|
484
1306
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
485
1307
|
},
|
|
486
|
-
|
|
1308
|
+
__wbg___wbindgen_boolean_get_fa956cfa2d1bd751: function(arg0) {
|
|
487
1309
|
const v = arg0;
|
|
488
1310
|
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
489
1311
|
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
|
|
490
1312
|
},
|
|
491
|
-
|
|
1313
|
+
__wbg___wbindgen_debug_string_c25d447a39f5578f: function(arg0, arg1) {
|
|
492
1314
|
const ret = debugString(arg1);
|
|
493
1315
|
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
494
1316
|
const len1 = WASM_VECTOR_LEN;
|
|
495
1317
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
496
1318
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
497
1319
|
},
|
|
498
|
-
|
|
1320
|
+
__wbg___wbindgen_in_aca499c5de7ff5e5: function(arg0, arg1) {
|
|
499
1321
|
const ret = arg0 in arg1;
|
|
500
1322
|
return ret;
|
|
501
1323
|
},
|
|
502
|
-
|
|
1324
|
+
__wbg___wbindgen_is_bigint_2f76dc55065b4273: function(arg0) {
|
|
503
1325
|
const ret = typeof(arg0) === 'bigint';
|
|
504
1326
|
return ret;
|
|
505
1327
|
},
|
|
506
|
-
|
|
1328
|
+
__wbg___wbindgen_is_function_1ff95bcc5517c252: function(arg0) {
|
|
507
1329
|
const ret = typeof(arg0) === 'function';
|
|
508
1330
|
return ret;
|
|
509
1331
|
},
|
|
510
|
-
|
|
1332
|
+
__wbg___wbindgen_is_null_ea9085d691f535d3: function(arg0) {
|
|
511
1333
|
const ret = arg0 === null;
|
|
512
1334
|
return ret;
|
|
513
1335
|
},
|
|
514
|
-
|
|
1336
|
+
__wbg___wbindgen_is_object_a27215656b807791: function(arg0) {
|
|
515
1337
|
const val = arg0;
|
|
516
1338
|
const ret = typeof(val) === 'object' && val !== null;
|
|
517
1339
|
return ret;
|
|
518
1340
|
},
|
|
519
|
-
|
|
1341
|
+
__wbg___wbindgen_is_string_ea5e6cc2e4141dfe: function(arg0) {
|
|
520
1342
|
const ret = typeof(arg0) === 'string';
|
|
521
1343
|
return ret;
|
|
522
1344
|
},
|
|
523
|
-
|
|
1345
|
+
__wbg___wbindgen_is_undefined_c05833b95a3cf397: function(arg0) {
|
|
524
1346
|
const ret = arg0 === undefined;
|
|
525
1347
|
return ret;
|
|
526
1348
|
},
|
|
527
|
-
|
|
1349
|
+
__wbg___wbindgen_jsval_eq_e659fcf7b0e32763: function(arg0, arg1) {
|
|
528
1350
|
const ret = arg0 === arg1;
|
|
529
1351
|
return ret;
|
|
530
1352
|
},
|
|
531
|
-
|
|
1353
|
+
__wbg___wbindgen_jsval_loose_eq_db4c3b15f63fc170: function(arg0, arg1) {
|
|
532
1354
|
const ret = arg0 == arg1;
|
|
533
1355
|
return ret;
|
|
534
1356
|
},
|
|
535
|
-
|
|
1357
|
+
__wbg___wbindgen_lt_f5e407c37b70b8b0: function(arg0, arg1) {
|
|
1358
|
+
const ret = arg0 < arg1;
|
|
1359
|
+
return ret;
|
|
1360
|
+
},
|
|
1361
|
+
__wbg___wbindgen_neg_69ea89900918a95f: function(arg0) {
|
|
1362
|
+
const ret = -arg0;
|
|
1363
|
+
return ret;
|
|
1364
|
+
},
|
|
1365
|
+
__wbg___wbindgen_number_get_394265ed1e1b84ee: function(arg0, arg1) {
|
|
536
1366
|
const obj = arg1;
|
|
537
1367
|
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
538
1368
|
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
539
1369
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
540
1370
|
},
|
|
541
|
-
|
|
1371
|
+
__wbg___wbindgen_string_get_b0ca35b86a603356: function(arg0, arg1) {
|
|
542
1372
|
const obj = arg1;
|
|
543
1373
|
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
544
1374
|
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
@@ -546,25 +1376,39 @@ function __wbg_get_imports() {
|
|
|
546
1376
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
547
1377
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
548
1378
|
},
|
|
549
|
-
|
|
1379
|
+
__wbg___wbindgen_throw_344f42d3211c4765: function(arg0, arg1) {
|
|
550
1380
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
551
1381
|
},
|
|
552
|
-
|
|
553
|
-
|
|
1382
|
+
__wbg__wbg_cb_unref_fffb441def202758: function(arg0) {
|
|
1383
|
+
arg0._wbg_cb_unref();
|
|
1384
|
+
},
|
|
1385
|
+
__wbg_apply_3ac86a26fdb56c05: function() { return handleError(function (arg0, arg1, arg2) {
|
|
1386
|
+
const ret = arg0.apply(arg1, arg2);
|
|
554
1387
|
return ret;
|
|
555
1388
|
}, arguments); },
|
|
556
|
-
|
|
1389
|
+
__wbg_call_8a2dd23819f8a60a: function() { return handleError(function (arg0, arg1) {
|
|
557
1390
|
const ret = arg0.call(arg1);
|
|
558
1391
|
return ret;
|
|
559
1392
|
}, arguments); },
|
|
560
|
-
|
|
1393
|
+
__wbg_call_a6e5c5dce5018821: function() { return handleError(function (arg0, arg1, arg2) {
|
|
1394
|
+
const ret = arg0.call(arg1, arg2);
|
|
1395
|
+
return ret;
|
|
1396
|
+
}, arguments); },
|
|
1397
|
+
__wbg_crypto_38df2bab126b63dc: function(arg0) {
|
|
561
1398
|
const ret = arg0.crypto;
|
|
562
1399
|
return ret;
|
|
563
1400
|
},
|
|
564
|
-
|
|
1401
|
+
__wbg_done_89b2b13e91a60321: function(arg0) {
|
|
565
1402
|
const ret = arg0.done;
|
|
566
1403
|
return ret;
|
|
567
1404
|
},
|
|
1405
|
+
__wbg_entries_015dc610cd81ede0: function(arg0) {
|
|
1406
|
+
const ret = Object.entries(arg0);
|
|
1407
|
+
return ret;
|
|
1408
|
+
},
|
|
1409
|
+
__wbg_error_744744ff0c9861e6: function(arg0) {
|
|
1410
|
+
console.error(arg0);
|
|
1411
|
+
},
|
|
568
1412
|
__wbg_error_a6fa202b58aa1cd3: function(arg0, arg1) {
|
|
569
1413
|
let deferred0_0;
|
|
570
1414
|
let deferred0_1;
|
|
@@ -576,17 +1420,29 @@ function __wbg_get_imports() {
|
|
|
576
1420
|
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
577
1421
|
}
|
|
578
1422
|
},
|
|
579
|
-
|
|
1423
|
+
__wbg_from_13e323c65fc8f464: function(arg0) {
|
|
1424
|
+
const ret = Array.from(arg0);
|
|
1425
|
+
return ret;
|
|
1426
|
+
},
|
|
1427
|
+
__wbg_getRandomValues_c44a50d8cfdaebeb: function() { return handleError(function (arg0, arg1) {
|
|
580
1428
|
arg0.getRandomValues(arg1);
|
|
581
1429
|
}, arguments); },
|
|
582
|
-
|
|
1430
|
+
__wbg_getRandomValues_cc7f052a444bb2ce: function() { return handleError(function (arg0, arg1) {
|
|
583
1431
|
globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
|
|
584
1432
|
}, arguments); },
|
|
585
|
-
|
|
1433
|
+
__wbg_get_507a50627bffa49b: function(arg0, arg1) {
|
|
1434
|
+
const ret = arg0[arg1 >>> 0];
|
|
1435
|
+
return ret;
|
|
1436
|
+
},
|
|
1437
|
+
__wbg_get_78f252d074a84d0b: function() { return handleError(function (arg0, arg1) {
|
|
1438
|
+
const ret = Reflect.get(arg0, arg1);
|
|
1439
|
+
return ret;
|
|
1440
|
+
}, arguments); },
|
|
1441
|
+
__wbg_get_c7eb1f358a7654df: function() { return handleError(function (arg0, arg1) {
|
|
586
1442
|
const ret = Reflect.get(arg0, arg1);
|
|
587
1443
|
return ret;
|
|
588
1444
|
}, arguments); },
|
|
589
|
-
|
|
1445
|
+
__wbg_get_unchecked_6e0ad6d2a41b06f6: function(arg0, arg1) {
|
|
590
1446
|
const ret = arg0[arg1 >>> 0];
|
|
591
1447
|
return ret;
|
|
592
1448
|
},
|
|
@@ -594,7 +1450,7 @@ function __wbg_get_imports() {
|
|
|
594
1450
|
const ret = arg0[arg1];
|
|
595
1451
|
return ret;
|
|
596
1452
|
},
|
|
597
|
-
|
|
1453
|
+
__wbg_instanceof_ArrayBuffer_4480b9e0068a8adb: function(arg0) {
|
|
598
1454
|
let result;
|
|
599
1455
|
try {
|
|
600
1456
|
result = arg0 instanceof ArrayBuffer;
|
|
@@ -604,7 +1460,7 @@ function __wbg_get_imports() {
|
|
|
604
1460
|
const ret = result;
|
|
605
1461
|
return ret;
|
|
606
1462
|
},
|
|
607
|
-
|
|
1463
|
+
__wbg_instanceof_Uint8Array_309b927aaf7a3fc7: function(arg0) {
|
|
608
1464
|
let result;
|
|
609
1465
|
try {
|
|
610
1466
|
result = arg0 instanceof Uint8Array;
|
|
@@ -614,27 +1470,27 @@ function __wbg_get_imports() {
|
|
|
614
1470
|
const ret = result;
|
|
615
1471
|
return ret;
|
|
616
1472
|
},
|
|
617
|
-
|
|
1473
|
+
__wbg_isArray_0677c962b281d01a: function(arg0) {
|
|
618
1474
|
const ret = Array.isArray(arg0);
|
|
619
1475
|
return ret;
|
|
620
1476
|
},
|
|
621
|
-
|
|
1477
|
+
__wbg_isSafeInteger_04f36e4056f1b851: function(arg0) {
|
|
622
1478
|
const ret = Number.isSafeInteger(arg0);
|
|
623
1479
|
return ret;
|
|
624
1480
|
},
|
|
625
|
-
|
|
1481
|
+
__wbg_iterator_6f722e4a93058b71: function() {
|
|
626
1482
|
const ret = Symbol.iterator;
|
|
627
1483
|
return ret;
|
|
628
1484
|
},
|
|
629
|
-
|
|
1485
|
+
__wbg_length_1f0964f4a5e2c6d8: function(arg0) {
|
|
630
1486
|
const ret = arg0.length;
|
|
631
1487
|
return ret;
|
|
632
1488
|
},
|
|
633
|
-
|
|
1489
|
+
__wbg_length_370319915dc99107: function(arg0) {
|
|
634
1490
|
const ret = arg0.length;
|
|
635
1491
|
return ret;
|
|
636
1492
|
},
|
|
637
|
-
|
|
1493
|
+
__wbg_msCrypto_bd5a034af96bcba6: function(arg0) {
|
|
638
1494
|
const ret = arg0.msCrypto;
|
|
639
1495
|
return ret;
|
|
640
1496
|
},
|
|
@@ -642,65 +1498,106 @@ function __wbg_get_imports() {
|
|
|
642
1498
|
const ret = new Error();
|
|
643
1499
|
return ret;
|
|
644
1500
|
},
|
|
645
|
-
|
|
1501
|
+
__wbg_new_32b398fb48b6d94a: function() {
|
|
1502
|
+
const ret = new Array();
|
|
1503
|
+
return ret;
|
|
1504
|
+
},
|
|
1505
|
+
__wbg_new_7796ffc7ed656783: function() {
|
|
646
1506
|
const ret = new Map();
|
|
647
1507
|
return ret;
|
|
648
1508
|
},
|
|
649
|
-
|
|
1509
|
+
__wbg_new_cd45aabdf6073e84: function(arg0) {
|
|
650
1510
|
const ret = new Uint8Array(arg0);
|
|
651
1511
|
return ret;
|
|
652
1512
|
},
|
|
653
|
-
|
|
654
|
-
const ret = new
|
|
1513
|
+
__wbg_new_da52cf8fe3429cb2: function() {
|
|
1514
|
+
const ret = new Object();
|
|
655
1515
|
return ret;
|
|
656
1516
|
},
|
|
657
|
-
|
|
658
|
-
const ret = new
|
|
1517
|
+
__wbg_new_from_slice_77cdfb7977362f3c: function(arg0, arg1) {
|
|
1518
|
+
const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
|
|
659
1519
|
return ret;
|
|
660
1520
|
},
|
|
661
|
-
|
|
1521
|
+
__wbg_new_typed_1824d93f294193e5: function(arg0, arg1) {
|
|
1522
|
+
try {
|
|
1523
|
+
var state0 = {a: arg0, b: arg1};
|
|
1524
|
+
var cb0 = (arg0, arg1) => {
|
|
1525
|
+
const a = state0.a;
|
|
1526
|
+
state0.a = 0;
|
|
1527
|
+
try {
|
|
1528
|
+
return wasm_bindgen__convert__closures_____invoke__h6bfc661997de4fd7(a, state0.b, arg0, arg1);
|
|
1529
|
+
} finally {
|
|
1530
|
+
state0.a = a;
|
|
1531
|
+
}
|
|
1532
|
+
};
|
|
1533
|
+
const ret = new Promise(cb0);
|
|
1534
|
+
return ret;
|
|
1535
|
+
} finally {
|
|
1536
|
+
state0.a = 0;
|
|
1537
|
+
}
|
|
1538
|
+
},
|
|
1539
|
+
__wbg_new_with_length_e6785c33c8e4cce8: function(arg0) {
|
|
662
1540
|
const ret = new Uint8Array(arg0 >>> 0);
|
|
663
1541
|
return ret;
|
|
664
1542
|
},
|
|
665
|
-
|
|
666
|
-
const ret = arg0.next();
|
|
667
|
-
return ret;
|
|
668
|
-
}, arguments); },
|
|
669
|
-
__wbg_next_e01a967809d1aa68: function(arg0) {
|
|
1543
|
+
__wbg_next_6dbf2c0ac8cde20f: function(arg0) {
|
|
670
1544
|
const ret = arg0.next;
|
|
671
1545
|
return ret;
|
|
672
1546
|
},
|
|
673
|
-
|
|
1547
|
+
__wbg_next_71f2aa1cb3d1e37e: function() { return handleError(function (arg0) {
|
|
1548
|
+
const ret = arg0.next();
|
|
1549
|
+
return ret;
|
|
1550
|
+
}, arguments); },
|
|
1551
|
+
__wbg_node_84ea875411254db1: function(arg0) {
|
|
674
1552
|
const ret = arg0.node;
|
|
675
1553
|
return ret;
|
|
676
1554
|
},
|
|
677
|
-
|
|
1555
|
+
__wbg_now_86c0d4ba3fa605b8: function() {
|
|
678
1556
|
const ret = Date.now();
|
|
679
1557
|
return ret;
|
|
680
1558
|
},
|
|
681
|
-
|
|
1559
|
+
__wbg_process_44c7a14e11e9f69e: function(arg0) {
|
|
682
1560
|
const ret = arg0.process;
|
|
683
1561
|
return ret;
|
|
684
1562
|
},
|
|
685
|
-
|
|
1563
|
+
__wbg_prototypesetcall_4770620bbe4688a0: function(arg0, arg1, arg2) {
|
|
686
1564
|
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
687
1565
|
},
|
|
688
|
-
|
|
1566
|
+
__wbg_push_d2ae3af0c1217ae6: function(arg0, arg1) {
|
|
1567
|
+
const ret = arg0.push(arg1);
|
|
1568
|
+
return ret;
|
|
1569
|
+
},
|
|
1570
|
+
__wbg_queueMicrotask_0ab5b2d2393e99b9: function(arg0) {
|
|
1571
|
+
const ret = arg0.queueMicrotask;
|
|
1572
|
+
return ret;
|
|
1573
|
+
},
|
|
1574
|
+
__wbg_queueMicrotask_6a09b7bc46549209: function(arg0) {
|
|
1575
|
+
queueMicrotask(arg0);
|
|
1576
|
+
},
|
|
1577
|
+
__wbg_randomFillSync_6c25eac9869eb53c: function() { return handleError(function (arg0, arg1) {
|
|
689
1578
|
arg0.randomFillSync(arg1);
|
|
690
1579
|
}, arguments); },
|
|
691
|
-
|
|
1580
|
+
__wbg_require_b4edbdcf3e2a1ef0: function() { return handleError(function () {
|
|
692
1581
|
const ret = module.require;
|
|
693
1582
|
return ret;
|
|
694
1583
|
}, arguments); },
|
|
695
|
-
|
|
696
|
-
|
|
1584
|
+
__wbg_resolve_2191a4dfe481c25b: function(arg0) {
|
|
1585
|
+
const ret = Promise.resolve(arg0);
|
|
1586
|
+
return ret;
|
|
1587
|
+
},
|
|
1588
|
+
__wbg_set_575dd786d51585f8: function(arg0, arg1, arg2) {
|
|
1589
|
+
const ret = arg0.set(arg1, arg2);
|
|
1590
|
+
return ret;
|
|
697
1591
|
},
|
|
698
1592
|
__wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
|
|
699
1593
|
arg0[arg1] = arg2;
|
|
700
1594
|
},
|
|
701
|
-
|
|
702
|
-
const ret =
|
|
1595
|
+
__wbg_set_8535240470bf2500: function() { return handleError(function (arg0, arg1, arg2) {
|
|
1596
|
+
const ret = Reflect.set(arg0, arg1, arg2);
|
|
703
1597
|
return ret;
|
|
1598
|
+
}, arguments); },
|
|
1599
|
+
__wbg_set_8a16b38e4805b298: function(arg0, arg1, arg2) {
|
|
1600
|
+
arg0[arg1 >>> 0] = arg2;
|
|
704
1601
|
},
|
|
705
1602
|
__wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
|
|
706
1603
|
const ret = arg1.stack;
|
|
@@ -709,50 +1606,79 @@ function __wbg_get_imports() {
|
|
|
709
1606
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
710
1607
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
711
1608
|
},
|
|
712
|
-
|
|
1609
|
+
__wbg_static_accessor_GLOBAL_4ef717fb391d88b7: function() {
|
|
713
1610
|
const ret = typeof global === 'undefined' ? null : global;
|
|
714
1611
|
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
715
1612
|
},
|
|
716
|
-
|
|
1613
|
+
__wbg_static_accessor_GLOBAL_THIS_8d1badc68b5a74f4: function() {
|
|
717
1614
|
const ret = typeof globalThis === 'undefined' ? null : globalThis;
|
|
718
1615
|
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
719
1616
|
},
|
|
720
|
-
|
|
1617
|
+
__wbg_static_accessor_SELF_146583524fe1469b: function() {
|
|
721
1618
|
const ret = typeof self === 'undefined' ? null : self;
|
|
722
1619
|
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
723
1620
|
},
|
|
724
|
-
|
|
1621
|
+
__wbg_static_accessor_WINDOW_f2829a2234d7819e: function() {
|
|
725
1622
|
const ret = typeof window === 'undefined' ? null : window;
|
|
726
1623
|
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
727
1624
|
},
|
|
728
|
-
|
|
1625
|
+
__wbg_subarray_3ed232c8a6baee09: function(arg0, arg1, arg2) {
|
|
729
1626
|
const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
|
|
730
1627
|
return ret;
|
|
731
1628
|
},
|
|
732
|
-
|
|
1629
|
+
__wbg_then_16d107c451e9905d: function(arg0, arg1, arg2) {
|
|
1630
|
+
const ret = arg0.then(arg1, arg2);
|
|
1631
|
+
return ret;
|
|
1632
|
+
},
|
|
1633
|
+
__wbg_then_6ec10ae38b3e92f7: function(arg0, arg1) {
|
|
1634
|
+
const ret = arg0.then(arg1);
|
|
1635
|
+
return ret;
|
|
1636
|
+
},
|
|
1637
|
+
__wbg_toString_34387d7c1df9ca1e: function() { return handleError(function (arg0, arg1) {
|
|
1638
|
+
const ret = arg0.toString(arg1);
|
|
1639
|
+
return ret;
|
|
1640
|
+
}, arguments); },
|
|
1641
|
+
__wbg_toString_6a94911348396720: function(arg0, arg1, arg2) {
|
|
1642
|
+
const ret = arg1.toString(arg2);
|
|
1643
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1644
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1645
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1646
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1647
|
+
},
|
|
1648
|
+
__wbg_value_a5d5488a9589444a: function(arg0) {
|
|
733
1649
|
const ret = arg0.value;
|
|
734
1650
|
return ret;
|
|
735
1651
|
},
|
|
736
|
-
|
|
1652
|
+
__wbg_versions_276b2795b1c6a219: function(arg0) {
|
|
737
1653
|
const ret = arg0.versions;
|
|
738
1654
|
return ret;
|
|
739
1655
|
},
|
|
740
|
-
__wbindgen_cast_0000000000000001: function(arg0) {
|
|
1656
|
+
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
1657
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 287, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
1658
|
+
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h6d974fa9882759cc);
|
|
1659
|
+
return ret;
|
|
1660
|
+
},
|
|
1661
|
+
__wbindgen_cast_0000000000000002: function(arg0) {
|
|
741
1662
|
// Cast intrinsic for `F64 -> Externref`.
|
|
742
1663
|
const ret = arg0;
|
|
743
1664
|
return ret;
|
|
744
1665
|
},
|
|
745
|
-
|
|
1666
|
+
__wbindgen_cast_0000000000000003: function(arg0) {
|
|
1667
|
+
// Cast intrinsic for `I64 -> Externref`.
|
|
1668
|
+
const ret = arg0;
|
|
1669
|
+
return ret;
|
|
1670
|
+
},
|
|
1671
|
+
__wbindgen_cast_0000000000000004: function(arg0, arg1) {
|
|
746
1672
|
// Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
|
|
747
1673
|
const ret = getArrayU8FromWasm0(arg0, arg1);
|
|
748
1674
|
return ret;
|
|
749
1675
|
},
|
|
750
|
-
|
|
1676
|
+
__wbindgen_cast_0000000000000005: function(arg0, arg1) {
|
|
751
1677
|
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
752
1678
|
const ret = getStringFromWasm0(arg0, arg1);
|
|
753
1679
|
return ret;
|
|
754
1680
|
},
|
|
755
|
-
|
|
1681
|
+
__wbindgen_cast_0000000000000006: function(arg0) {
|
|
756
1682
|
// Cast intrinsic for `U64 -> Externref`.
|
|
757
1683
|
const ret = BigInt.asUintN(64, arg0);
|
|
758
1684
|
return ret;
|
|
@@ -773,12 +1699,34 @@ function __wbg_get_imports() {
|
|
|
773
1699
|
};
|
|
774
1700
|
}
|
|
775
1701
|
|
|
1702
|
+
function wasm_bindgen__convert__closures_____invoke__h6d974fa9882759cc(arg0, arg1, arg2) {
|
|
1703
|
+
const ret = wasm.wasm_bindgen__convert__closures_____invoke__h6d974fa9882759cc(arg0, arg1, arg2);
|
|
1704
|
+
if (ret[1]) {
|
|
1705
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
1706
|
+
}
|
|
1707
|
+
}
|
|
1708
|
+
|
|
1709
|
+
function wasm_bindgen__convert__closures_____invoke__h6bfc661997de4fd7(arg0, arg1, arg2, arg3) {
|
|
1710
|
+
wasm.wasm_bindgen__convert__closures_____invoke__h6bfc661997de4fd7(arg0, arg1, arg2, arg3);
|
|
1711
|
+
}
|
|
1712
|
+
|
|
1713
|
+
const DeRecProtocolBuilderFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1714
|
+
? { register: () => {}, unregister: () => {} }
|
|
1715
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_derecprotocolbuilder_free(ptr, 1));
|
|
1716
|
+
const DeRecProtocolWasmFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1717
|
+
? { register: () => {}, unregister: () => {} }
|
|
1718
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_derecprotocolwasm_free(ptr, 1));
|
|
1719
|
+
|
|
776
1720
|
function addToExternrefTable0(obj) {
|
|
777
1721
|
const idx = wasm.__externref_table_alloc();
|
|
778
1722
|
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
779
1723
|
return idx;
|
|
780
1724
|
}
|
|
781
1725
|
|
|
1726
|
+
const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
|
|
1727
|
+
? { register: () => {}, unregister: () => {} }
|
|
1728
|
+
: new FinalizationRegistry(state => wasm.__wbindgen_destroy_closure(state.a, state.b));
|
|
1729
|
+
|
|
782
1730
|
function debugString(val) {
|
|
783
1731
|
// primitive types
|
|
784
1732
|
const type = typeof val;
|
|
@@ -858,8 +1806,7 @@ function getDataViewMemory0() {
|
|
|
858
1806
|
}
|
|
859
1807
|
|
|
860
1808
|
function getStringFromWasm0(ptr, len) {
|
|
861
|
-
|
|
862
|
-
return decodeText(ptr, len);
|
|
1809
|
+
return decodeText(ptr >>> 0, len);
|
|
863
1810
|
}
|
|
864
1811
|
|
|
865
1812
|
let cachedUint8ArrayMemory0 = null;
|
|
@@ -883,6 +1830,34 @@ function isLikeNone(x) {
|
|
|
883
1830
|
return x === undefined || x === null;
|
|
884
1831
|
}
|
|
885
1832
|
|
|
1833
|
+
function makeMutClosure(arg0, arg1, f) {
|
|
1834
|
+
const state = { a: arg0, b: arg1, cnt: 1 };
|
|
1835
|
+
const real = (...args) => {
|
|
1836
|
+
|
|
1837
|
+
// First up with a closure we increment the internal reference
|
|
1838
|
+
// count. This ensures that the Rust closure environment won't
|
|
1839
|
+
// be deallocated while we're invoking it.
|
|
1840
|
+
state.cnt++;
|
|
1841
|
+
const a = state.a;
|
|
1842
|
+
state.a = 0;
|
|
1843
|
+
try {
|
|
1844
|
+
return f(a, state.b, ...args);
|
|
1845
|
+
} finally {
|
|
1846
|
+
state.a = a;
|
|
1847
|
+
real._wbg_cb_unref();
|
|
1848
|
+
}
|
|
1849
|
+
};
|
|
1850
|
+
real._wbg_cb_unref = () => {
|
|
1851
|
+
if (--state.cnt === 0) {
|
|
1852
|
+
wasm.__wbindgen_destroy_closure(state.a, state.b);
|
|
1853
|
+
state.a = 0;
|
|
1854
|
+
CLOSURE_DTORS.unregister(state);
|
|
1855
|
+
}
|
|
1856
|
+
};
|
|
1857
|
+
CLOSURE_DTORS.register(real, state, state);
|
|
1858
|
+
return real;
|
|
1859
|
+
}
|
|
1860
|
+
|
|
886
1861
|
function passArray8ToWasm0(arg, malloc) {
|
|
887
1862
|
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
888
1863
|
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
@@ -957,5 +1932,6 @@ let WASM_VECTOR_LEN = 0;
|
|
|
957
1932
|
const wasmPath = `${__dirname}/derec_library_bg.wasm`;
|
|
958
1933
|
const wasmBytes = require('fs').readFileSync(wasmPath);
|
|
959
1934
|
const wasmModule = new WebAssembly.Module(wasmBytes);
|
|
960
|
-
let
|
|
1935
|
+
let wasmInstance = new WebAssembly.Instance(wasmModule, __wbg_get_imports());
|
|
1936
|
+
let wasm = wasmInstance.exports;
|
|
961
1937
|
wasm.__wbindgen_start();
|