@derec-alliance/nodejs 0.0.1-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +551 -0
- package/derec_library.d.ts +466 -0
- package/derec_library.js +2008 -0
- package/derec_library_bg.wasm +0 -0
- package/derec_library_bg.wasm.d.ts +92 -0
- package/index.d.ts +1547 -0
- package/index.js +106 -0
- package/package.json +34 -0
package/derec_library.js
ADDED
|
@@ -0,0 +1,2008 @@
|
|
|
1
|
+
/* @ts-self-types="./derec_library.d.ts" */
|
|
2
|
+
|
|
3
|
+
/**
|
|
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
|
+
* Configure the four waiting periods in one call.
|
|
223
|
+
*
|
|
224
|
+
* Object shape — every field optional, and **absent means "keep the
|
|
225
|
+
* library default"**:
|
|
226
|
+
*
|
|
227
|
+
* ```text
|
|
228
|
+
* {
|
|
229
|
+
* inbound_message_secs?: number, // staleness / replay window
|
|
230
|
+
* sharing_round_secs?: number,
|
|
231
|
+
* unpair_ack_secs?: number,
|
|
232
|
+
* expired_channels?: { enabled: boolean, timeout_in_secs: number },
|
|
233
|
+
* }
|
|
234
|
+
* ```
|
|
235
|
+
*
|
|
236
|
+
* Values are forwarded verbatim; clamping and the meaning of a disabled
|
|
237
|
+
* `expired_channels` are library decisions, not this shim's. Not calling
|
|
238
|
+
* this leaves every default in force.
|
|
239
|
+
* @param {any} timeouts
|
|
240
|
+
* @returns {DeRecProtocolBuilder}
|
|
241
|
+
*/
|
|
242
|
+
withTimeouts(timeouts) {
|
|
243
|
+
const ptr = this.__destroy_into_raw();
|
|
244
|
+
const ret = wasm.derecprotocolbuilder_withTimeouts(ptr, timeouts);
|
|
245
|
+
if (ret[2]) {
|
|
246
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
247
|
+
}
|
|
248
|
+
return DeRecProtocolBuilder.__wrap(ret[0]);
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* @param {any} transport
|
|
252
|
+
* @returns {DeRecProtocolBuilder}
|
|
253
|
+
*/
|
|
254
|
+
withTransport(transport) {
|
|
255
|
+
const ptr = this.__destroy_into_raw();
|
|
256
|
+
const ret = wasm.derecprotocolbuilder_withTransport(ptr, transport);
|
|
257
|
+
return DeRecProtocolBuilder.__wrap(ret);
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* `ack` is `"required"` (default) or `"not_required"`.
|
|
261
|
+
* @param {string} ack
|
|
262
|
+
* @returns {DeRecProtocolBuilder}
|
|
263
|
+
*/
|
|
264
|
+
withUnpairAck(ack) {
|
|
265
|
+
const ptr = this.__destroy_into_raw();
|
|
266
|
+
const ptr0 = passStringToWasm0(ack, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
267
|
+
const len0 = WASM_VECTOR_LEN;
|
|
268
|
+
const ret = wasm.derecprotocolbuilder_withUnpairAck(ptr, ptr0, len0);
|
|
269
|
+
if (ret[2]) {
|
|
270
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
271
|
+
}
|
|
272
|
+
return DeRecProtocolBuilder.__wrap(ret[0]);
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Accept plaintext `http://` transport endpoints. **Development only.**
|
|
276
|
+
* Default `false`.
|
|
277
|
+
*
|
|
278
|
+
* With it `false`, plaintext is accepted only for an endpoint this
|
|
279
|
+
* device configured for *itself* that names loopback (`localhost`,
|
|
280
|
+
* `127.0.0.1`, `::1`) — so a local dev server needs no configuration.
|
|
281
|
+
* With it `true`, plaintext is accepted for any host on any path,
|
|
282
|
+
* including endpoints a peer supplies. That is what makes the LAN case
|
|
283
|
+
* work (a phone against a laptop), and why the name is blunt.
|
|
284
|
+
* @param {boolean} allow
|
|
285
|
+
* @returns {DeRecProtocolBuilder}
|
|
286
|
+
*/
|
|
287
|
+
withUnsafeHttp(allow) {
|
|
288
|
+
const ptr = this.__destroy_into_raw();
|
|
289
|
+
const ret = wasm.derecprotocolbuilder_withUnsafeHttp(ptr, allow);
|
|
290
|
+
return DeRecProtocolBuilder.__wrap(ret);
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* @param {any} store
|
|
294
|
+
* @returns {DeRecProtocolBuilder}
|
|
295
|
+
*/
|
|
296
|
+
withUserSecretStore(store) {
|
|
297
|
+
const ptr = this.__destroy_into_raw();
|
|
298
|
+
const ret = wasm.derecprotocolbuilder_withUserSecretStore(ptr, store);
|
|
299
|
+
return DeRecProtocolBuilder.__wrap(ret);
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
if (Symbol.dispose) DeRecProtocolBuilder.prototype[Symbol.dispose] = DeRecProtocolBuilder.prototype.free;
|
|
303
|
+
exports.DeRecProtocolBuilder = DeRecProtocolBuilder;
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* Higher-level DeRec protocol orchestrator for TypeScript/JavaScript consumers.
|
|
307
|
+
*
|
|
308
|
+
* Wraps [`DeRecProtocol`](crate::protocol::DeRecProtocol) with JS-side store
|
|
309
|
+
* and transport adapters so that a TypeScript application can drive all five
|
|
310
|
+
* protocol flows without routing raw bytes manually.
|
|
311
|
+
*
|
|
312
|
+
* # Stores
|
|
313
|
+
*
|
|
314
|
+
* Pass four JS objects that implement the interfaces documented on each
|
|
315
|
+
* parameter. All store methods must return `Promise`s — synchronous
|
|
316
|
+
* implementations can wrap their result with `Promise.resolve(...)`.
|
|
317
|
+
*
|
|
318
|
+
* # Events
|
|
319
|
+
*
|
|
320
|
+
* [`process`](DeRecProtocolWasm::process) returns an `Array` of plain JS
|
|
321
|
+
* objects, each with a `type` discriminant field:
|
|
322
|
+
*
|
|
323
|
+
* | `type` | Additional fields |
|
|
324
|
+
* |--------------------|--------------------------------------------------------|
|
|
325
|
+
* | `PairingCompleted` | `channel_id: string`, `pairing_channel_id: string`, `kind: number` |
|
|
326
|
+
* | `ShareStored` | `channel_id: string`, `version: number` |
|
|
327
|
+
* | `ShareConfirmed` | `channel_id: string`, `version: number` |
|
|
328
|
+
* | `ShareVerified` | `channel_id: string`, `version: number` |
|
|
329
|
+
* | `SecretsDiscovered`| `channel_id: string`, `secrets: SecretVersionEntry[]` |
|
|
330
|
+
* | `SecretRecovered` | `secret: { helpers, secrets, replicas }` (same nested shape as `ReplicaSecretReceived.secret`) |
|
|
331
|
+
* | `NoOp` | _(none)_ |
|
|
332
|
+
*
|
|
333
|
+
* `SecretVersionEntry = { secret_id: bigint, versions: { version: number, description: string }[] }`
|
|
334
|
+
*/
|
|
335
|
+
class DeRecProtocolWasm {
|
|
336
|
+
static __wrap(ptr) {
|
|
337
|
+
const obj = Object.create(DeRecProtocolWasm.prototype);
|
|
338
|
+
obj.__wbg_ptr = ptr;
|
|
339
|
+
DeRecProtocolWasmFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
340
|
+
return obj;
|
|
341
|
+
}
|
|
342
|
+
__destroy_into_raw() {
|
|
343
|
+
const ptr = this.__wbg_ptr;
|
|
344
|
+
this.__wbg_ptr = 0;
|
|
345
|
+
DeRecProtocolWasmFinalization.unregister(this);
|
|
346
|
+
return ptr;
|
|
347
|
+
}
|
|
348
|
+
free() {
|
|
349
|
+
const ptr = this.__destroy_into_raw();
|
|
350
|
+
wasm.__wbg_derecprotocolwasm_free(ptr, 0);
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* Accept a pending action from an `ActionRequired` event.
|
|
354
|
+
*
|
|
355
|
+
* # Arguments
|
|
356
|
+
*
|
|
357
|
+
* * `action_bytes` — Opaque `Uint8Array` from the `action` field of an `ActionRequired` event.
|
|
358
|
+
*
|
|
359
|
+
* # Returns
|
|
360
|
+
*
|
|
361
|
+
* An `Array` of event objects (same format as `process()`).
|
|
362
|
+
* @param {Uint8Array} action_bytes
|
|
363
|
+
* @returns {Promise<any>}
|
|
364
|
+
*/
|
|
365
|
+
accept(action_bytes) {
|
|
366
|
+
const ptr0 = passArray8ToWasm0(action_bytes, wasm.__wbindgen_malloc);
|
|
367
|
+
const len0 = WASM_VECTOR_LEN;
|
|
368
|
+
const ret = wasm.derecprotocolwasm_accept(this.__wbg_ptr, ptr0, len0);
|
|
369
|
+
return ret;
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* Single entry point for all three contact modes (`InlineKeys`,
|
|
373
|
+
* `HashedKeys`, `NoKeys`).
|
|
374
|
+
*
|
|
375
|
+
* * `channel_id` — `null`/`undefined` lets the library mint a
|
|
376
|
+
* random id; otherwise `bigint` / `number` is used verbatim.
|
|
377
|
+
* * `contact_mode` — `0` (InlineKeys), `1` (HashedKeys), `2` (NoKeys).
|
|
378
|
+
* * `nonce` — `null`/`undefined` lets the library generate a fresh
|
|
379
|
+
* random `u64`; otherwise the supplied `bigint`/`number` is used.
|
|
380
|
+
* Required for `NoKeys` where callers typically pick a small
|
|
381
|
+
* human-typable value.
|
|
382
|
+
* @param {any} channel_id
|
|
383
|
+
* @param {number} contact_mode
|
|
384
|
+
* @param {any} nonce
|
|
385
|
+
* @returns {Promise<any>}
|
|
386
|
+
*/
|
|
387
|
+
createContact(channel_id, contact_mode, nonce) {
|
|
388
|
+
const ret = wasm.derecprotocolwasm_createContact(this.__wbg_ptr, channel_id, contact_mode, nonce);
|
|
389
|
+
return ret;
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
* Derive the human-readable fingerprint for a paired channel. Both
|
|
393
|
+
* sides of a replica pair derive the same fingerprint from the
|
|
394
|
+
* shared key, enabling out-of-band confirmation before the channel
|
|
395
|
+
* transitions from `Pending` to `Paired`.
|
|
396
|
+
* @param {any} channel_id
|
|
397
|
+
* @returns {Promise<string>}
|
|
398
|
+
*/
|
|
399
|
+
getFingerprint(channel_id) {
|
|
400
|
+
const ret = wasm.derecprotocolwasm_getFingerprint(this.__wbg_ptr, channel_id);
|
|
401
|
+
return ret;
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* Feed any incoming wire bytes to the protocol.
|
|
405
|
+
*
|
|
406
|
+
* Returns an `Array` of plain JS event objects (see struct-level docs for shapes).
|
|
407
|
+
* Every inbound flow — pairing, sharing, verification, discovery,
|
|
408
|
+
* recovery, unpairing, channel-info updates and the replica flows — is
|
|
409
|
+
* handled through this single entry point.
|
|
410
|
+
*
|
|
411
|
+
* # Arguments
|
|
412
|
+
*
|
|
413
|
+
* * `message` — Raw wire bytes of an incoming `DeRecMessage`.
|
|
414
|
+
* @param {Uint8Array} message
|
|
415
|
+
* @returns {Promise<any>}
|
|
416
|
+
*/
|
|
417
|
+
process(message) {
|
|
418
|
+
const ptr0 = passArray8ToWasm0(message, wasm.__wbindgen_malloc);
|
|
419
|
+
const len0 = WASM_VECTOR_LEN;
|
|
420
|
+
const ret = wasm.derecprotocolwasm_process(this.__wbg_ptr, ptr0, len0);
|
|
421
|
+
return ret;
|
|
422
|
+
}
|
|
423
|
+
/**
|
|
424
|
+
* Reject a pending action from an `ActionRequired` event.
|
|
425
|
+
*
|
|
426
|
+
* # Arguments
|
|
427
|
+
*
|
|
428
|
+
* * `action_bytes` — Opaque `Uint8Array` from the `action` field of an `ActionRequired` event.
|
|
429
|
+
* * `status` — Numeric status code from `StatusEnum` (e.g. 2 for FAIL, 10 for REJECTED).
|
|
430
|
+
* * `memo` — Human-readable rejection reason.
|
|
431
|
+
* @param {Uint8Array} action_bytes
|
|
432
|
+
* @param {number} status
|
|
433
|
+
* @param {string} memo
|
|
434
|
+
* @returns {Promise<void>}
|
|
435
|
+
*/
|
|
436
|
+
reject(action_bytes, status, memo) {
|
|
437
|
+
const ptr0 = passArray8ToWasm0(action_bytes, wasm.__wbindgen_malloc);
|
|
438
|
+
const len0 = WASM_VECTOR_LEN;
|
|
439
|
+
const ptr1 = passStringToWasm0(memo, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
440
|
+
const len1 = WASM_VECTOR_LEN;
|
|
441
|
+
const ret = wasm.derecprotocolwasm_reject(this.__wbg_ptr, ptr0, len0, status, ptr1, len1);
|
|
442
|
+
return ret;
|
|
443
|
+
}
|
|
444
|
+
/**
|
|
445
|
+
* Remove `Pending` channels older than `older_than_secs`, along with
|
|
446
|
+
* their pairing keys.
|
|
447
|
+
*
|
|
448
|
+
* Independent of the configured cleanup policy — it sweeps at the
|
|
449
|
+
* threshold given, even when the policy is disabled. The age
|
|
450
|
+
* comparison is strict, so a channel created within the current
|
|
451
|
+
* second survives even `0`.
|
|
452
|
+
*
|
|
453
|
+
* # Returns
|
|
454
|
+
*
|
|
455
|
+
* An `Array` of removed channel ids as decimal strings.
|
|
456
|
+
* @param {number} older_than_secs
|
|
457
|
+
* @returns {Promise<any>}
|
|
458
|
+
*/
|
|
459
|
+
removeExpiredChannels(older_than_secs) {
|
|
460
|
+
const ret = wasm.derecprotocolwasm_removeExpiredChannels(this.__wbg_ptr, older_than_secs);
|
|
461
|
+
return ret;
|
|
462
|
+
}
|
|
463
|
+
/**
|
|
464
|
+
* Rebuild this protocol's `secret_id` namespace from a recovered
|
|
465
|
+
* `Secret`. Mirrors [`crate::protocol::DeRecProtocol::restore`] —
|
|
466
|
+
* see that method for the full contract.
|
|
467
|
+
*
|
|
468
|
+
* `recoveredSecret` is the typed `Secret` object carried by the
|
|
469
|
+
* `SecretRecovered` event; pass it verbatim.
|
|
470
|
+
*
|
|
471
|
+
* Errors surface as structured JS errors with a `code` field:
|
|
472
|
+
*
|
|
473
|
+
* | code | meaning |
|
|
474
|
+
* |--------------------|------------------------------------------------------------------|
|
|
475
|
+
* | `ALREADY_RESTORED` | A user-secret snapshot already exists for this `secret_id`. |
|
|
476
|
+
* | `CONFLICT` | Channels live at canonical helper / replica ids. The error |
|
|
477
|
+
* | | carries `channel_ids: string[]` listing the collisions. |
|
|
478
|
+
* | `INVARIANT` | The recovered `Secret` is internally inconsistent. |
|
|
479
|
+
* | `STORAGE` | A store I/O call failed mid-restore. |
|
|
480
|
+
* @param {any} recovered_secret
|
|
481
|
+
* @param {number} version
|
|
482
|
+
* @returns {Promise<any>}
|
|
483
|
+
*/
|
|
484
|
+
restore(recovered_secret, version) {
|
|
485
|
+
const ret = wasm.derecprotocolwasm_restore(this.__wbg_ptr, recovered_secret, version);
|
|
486
|
+
return ret;
|
|
487
|
+
}
|
|
488
|
+
/**
|
|
489
|
+
* Generate an out-of-band contact message (QR code payload, deep link, …).
|
|
490
|
+
*
|
|
491
|
+
* Returns a plain JS `ContactMessage` object. The `channel_id` field identifies
|
|
492
|
+
* the pairing session and will match the `channel_id` in the eventual
|
|
493
|
+
* `PairingCompleted` event — read it directly from the returned object.
|
|
494
|
+
*
|
|
495
|
+
* The caller is responsible for serializing the contact for out-of-band
|
|
496
|
+
* delivery (QR code, deep link, etc.). The peer passes the deserialized object
|
|
497
|
+
* to [`start`](Self::start) with `FlowKind::Pairing`.
|
|
498
|
+
*
|
|
499
|
+
* # Arguments
|
|
500
|
+
*
|
|
501
|
+
* * `channel_id` — Optional `BigInt` channel identifier. Pass `null` or
|
|
502
|
+
* `undefined` to have the library generate a random one.
|
|
503
|
+
* * `contact_mode` — `0` for `InlineKeys` (keys embedded directly), `1`
|
|
504
|
+
* for `HashedKeys` (contact carries only a SHA-384 binding hash; the
|
|
505
|
+
* scanner fetches keys via a `PrePair` round-trip). `HashedKeys`
|
|
506
|
+
* requires the protocol's `own_transport` to be ephemeral.
|
|
507
|
+
* The secret identifier this protocol instance is bound to.
|
|
508
|
+
* @returns {bigint}
|
|
509
|
+
*/
|
|
510
|
+
secretId() {
|
|
511
|
+
const ret = wasm.derecprotocolwasm_secretId(this.__wbg_ptr);
|
|
512
|
+
return BigInt.asUintN(64, ret);
|
|
513
|
+
}
|
|
514
|
+
/**
|
|
515
|
+
* Replace this node's local communication info. Does not contact peers —
|
|
516
|
+
* follow up with a `start(UpdateChannelInfo, ...)` to propagate.
|
|
517
|
+
* @param {any} info
|
|
518
|
+
*/
|
|
519
|
+
setCommunicationInfo(info) {
|
|
520
|
+
const ret = wasm.derecprotocolwasm_setCommunicationInfo(this.__wbg_ptr, info);
|
|
521
|
+
if (ret[1]) {
|
|
522
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
/**
|
|
526
|
+
* Replace this node's local transport endpoint. See
|
|
527
|
+
* `setCommunicationInfo` for the matching update-propagation flow.
|
|
528
|
+
* IMPORTANT: keep the old endpoint operational during the changeover —
|
|
529
|
+
* see the Rust docs on `set_own_transport` for the discipline.
|
|
530
|
+
* @param {string} uri
|
|
531
|
+
* @param {string} protocol
|
|
532
|
+
*/
|
|
533
|
+
setOwnTransport(uri, protocol) {
|
|
534
|
+
const ptr0 = passStringToWasm0(uri, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
535
|
+
const len0 = WASM_VECTOR_LEN;
|
|
536
|
+
const ptr1 = passStringToWasm0(protocol, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
537
|
+
const len1 = WASM_VECTOR_LEN;
|
|
538
|
+
const ret = wasm.derecprotocolwasm_setOwnTransport(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
539
|
+
if (ret[1]) {
|
|
540
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
/**
|
|
544
|
+
* Unified entry point for initiating any protocol flow.
|
|
545
|
+
*
|
|
546
|
+
* # Arguments
|
|
547
|
+
*
|
|
548
|
+
* * `flow_kind` — Flow discriminant:
|
|
549
|
+
* - `0` = Pairing (params: `{ kind: number, contact: ContactMessage, name?: string }`)
|
|
550
|
+
* - `1` = Discovery (params: `{ target: BigInt | BigInt[] | null }`)
|
|
551
|
+
* - `2` = ProtectSecret (params: `{ secrets: UserSecret[], description?: string }`)
|
|
552
|
+
* - `3` = VerifyShares (params: `{ version: number, target: BigInt | BigInt[] | null }`)
|
|
553
|
+
* - `4` = RecoverSecret (params: `{ secretId: Uint8Array, version: number }`)
|
|
554
|
+
*
|
|
555
|
+
* # Returns
|
|
556
|
+
*
|
|
557
|
+
* An `Array` of `*Started` / `*Failed` events describing the
|
|
558
|
+
* dispatched requests. Same shape as `process()`.
|
|
559
|
+
* @param {number} flow_kind
|
|
560
|
+
* @param {any} params
|
|
561
|
+
* @returns {Promise<any>}
|
|
562
|
+
*/
|
|
563
|
+
start(flow_kind, params) {
|
|
564
|
+
const ret = wasm.derecprotocolwasm_start(this.__wbg_ptr, flow_kind, params);
|
|
565
|
+
return ret;
|
|
566
|
+
}
|
|
567
|
+
/**
|
|
568
|
+
* Advance time-driven state without an inbound message.
|
|
569
|
+
*
|
|
570
|
+
* Timeouts are otherwise only evaluated by `process`, so a publish whose
|
|
571
|
+
* helpers all go quiet has nothing left to close it. Call this from a
|
|
572
|
+
* timer — `setInterval`, a service-worker alarm, a job runner — at an
|
|
573
|
+
* interval shorter than the configured timeout.
|
|
574
|
+
*
|
|
575
|
+
* Returns an `Array` of plain JS event objects, empty when nothing was
|
|
576
|
+
* in flight. Safe to call at any time.
|
|
577
|
+
* @returns {Promise<any>}
|
|
578
|
+
*/
|
|
579
|
+
tick() {
|
|
580
|
+
const ret = wasm.derecprotocolwasm_tick(this.__wbg_ptr);
|
|
581
|
+
return ret;
|
|
582
|
+
}
|
|
583
|
+
/**
|
|
584
|
+
* Verify a fingerprint against the channel's locally-derived one. On
|
|
585
|
+
* match, the channel transitions from `Pending` to `Paired`. Returns
|
|
586
|
+
* `true` when the fingerprint matches and the channel is confirmed,
|
|
587
|
+
* `false` otherwise.
|
|
588
|
+
* @param {any} channel_id
|
|
589
|
+
* @param {string} fingerprint
|
|
590
|
+
* @returns {Promise<boolean>}
|
|
591
|
+
*/
|
|
592
|
+
verifyFingerprint(channel_id, fingerprint) {
|
|
593
|
+
const ptr0 = passStringToWasm0(fingerprint, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
594
|
+
const len0 = WASM_VECTOR_LEN;
|
|
595
|
+
const ret = wasm.derecprotocolwasm_verifyFingerprint(this.__wbg_ptr, channel_id, ptr0, len0);
|
|
596
|
+
return ret;
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
if (Symbol.dispose) DeRecProtocolWasm.prototype[Symbol.dispose] = DeRecProtocolWasm.prototype.free;
|
|
600
|
+
exports.DeRecProtocolWasm = DeRecProtocolWasm;
|
|
601
|
+
|
|
602
|
+
/**
|
|
603
|
+
* @param {Uint8Array} envelope_bytes
|
|
604
|
+
* @param {Uint8Array} shared_key
|
|
605
|
+
* @returns {any}
|
|
606
|
+
*/
|
|
607
|
+
function discovery_request_extract(envelope_bytes, shared_key) {
|
|
608
|
+
const ptr0 = passArray8ToWasm0(envelope_bytes, wasm.__wbindgen_malloc);
|
|
609
|
+
const len0 = WASM_VECTOR_LEN;
|
|
610
|
+
const ptr1 = passArray8ToWasm0(shared_key, wasm.__wbindgen_malloc);
|
|
611
|
+
const len1 = WASM_VECTOR_LEN;
|
|
612
|
+
const ret = wasm.discovery_request_extract(ptr0, len0, ptr1, len1);
|
|
613
|
+
if (ret[2]) {
|
|
614
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
615
|
+
}
|
|
616
|
+
return takeFromExternrefTable0(ret[0]);
|
|
617
|
+
}
|
|
618
|
+
exports.discovery_request_extract = discovery_request_extract;
|
|
619
|
+
|
|
620
|
+
/**
|
|
621
|
+
* @param {bigint} channel_id
|
|
622
|
+
* @param {Uint8Array} shared_key
|
|
623
|
+
* @param {any} reply_to
|
|
624
|
+
* @returns {any}
|
|
625
|
+
*/
|
|
626
|
+
function discovery_request_produce(channel_id, shared_key, reply_to) {
|
|
627
|
+
const ptr0 = passArray8ToWasm0(shared_key, wasm.__wbindgen_malloc);
|
|
628
|
+
const len0 = WASM_VECTOR_LEN;
|
|
629
|
+
const ret = wasm.discovery_request_produce(channel_id, ptr0, len0, reply_to);
|
|
630
|
+
if (ret[2]) {
|
|
631
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
632
|
+
}
|
|
633
|
+
return takeFromExternrefTable0(ret[0]);
|
|
634
|
+
}
|
|
635
|
+
exports.discovery_request_produce = discovery_request_produce;
|
|
636
|
+
|
|
637
|
+
/**
|
|
638
|
+
* @param {Uint8Array} envelope_bytes
|
|
639
|
+
* @param {Uint8Array} shared_key
|
|
640
|
+
* @returns {any}
|
|
641
|
+
*/
|
|
642
|
+
function discovery_response_extract(envelope_bytes, shared_key) {
|
|
643
|
+
const ptr0 = passArray8ToWasm0(envelope_bytes, wasm.__wbindgen_malloc);
|
|
644
|
+
const len0 = WASM_VECTOR_LEN;
|
|
645
|
+
const ptr1 = passArray8ToWasm0(shared_key, wasm.__wbindgen_malloc);
|
|
646
|
+
const len1 = WASM_VECTOR_LEN;
|
|
647
|
+
const ret = wasm.discovery_response_extract(ptr0, len0, ptr1, len1);
|
|
648
|
+
if (ret[2]) {
|
|
649
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
650
|
+
}
|
|
651
|
+
return takeFromExternrefTable0(ret[0]);
|
|
652
|
+
}
|
|
653
|
+
exports.discovery_response_extract = discovery_response_extract;
|
|
654
|
+
|
|
655
|
+
/**
|
|
656
|
+
* @param {any} response
|
|
657
|
+
* @returns {any}
|
|
658
|
+
*/
|
|
659
|
+
function discovery_response_process(response) {
|
|
660
|
+
const ret = wasm.discovery_response_process(response);
|
|
661
|
+
if (ret[2]) {
|
|
662
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
663
|
+
}
|
|
664
|
+
return takeFromExternrefTable0(ret[0]);
|
|
665
|
+
}
|
|
666
|
+
exports.discovery_response_process = discovery_response_process;
|
|
667
|
+
|
|
668
|
+
/**
|
|
669
|
+
* @param {bigint} channel_id
|
|
670
|
+
* @param {any} secret_list
|
|
671
|
+
* @param {Uint8Array} shared_key
|
|
672
|
+
* @returns {any}
|
|
673
|
+
*/
|
|
674
|
+
function discovery_response_produce(channel_id, secret_list, shared_key) {
|
|
675
|
+
const ptr0 = passArray8ToWasm0(shared_key, wasm.__wbindgen_malloc);
|
|
676
|
+
const len0 = WASM_VECTOR_LEN;
|
|
677
|
+
const ret = wasm.discovery_response_produce(channel_id, secret_list, ptr0, len0);
|
|
678
|
+
if (ret[2]) {
|
|
679
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
680
|
+
}
|
|
681
|
+
return takeFromExternrefTable0(ret[0]);
|
|
682
|
+
}
|
|
683
|
+
exports.discovery_response_produce = discovery_response_produce;
|
|
684
|
+
|
|
685
|
+
/**
|
|
686
|
+
* Overwrite `trace_id` on a primitive-produced envelope and return the
|
|
687
|
+
* re-encoded bytes. The outer envelope is plaintext, so this does no
|
|
688
|
+
* crypto work.
|
|
689
|
+
*
|
|
690
|
+
* Useful for consumers driving the protocol through primitives directly
|
|
691
|
+
* (the orchestrator-level `DeRecProtocol` already handles trace_id
|
|
692
|
+
* end-to-end on its own).
|
|
693
|
+
* @param {Uint8Array} envelope_bytes
|
|
694
|
+
* @param {bigint} trace_id
|
|
695
|
+
* @returns {Uint8Array}
|
|
696
|
+
*/
|
|
697
|
+
function envelope_apply_trace_id(envelope_bytes, trace_id) {
|
|
698
|
+
const ptr0 = passArray8ToWasm0(envelope_bytes, wasm.__wbindgen_malloc);
|
|
699
|
+
const len0 = WASM_VECTOR_LEN;
|
|
700
|
+
const ret = wasm.envelope_apply_trace_id(ptr0, len0, trace_id);
|
|
701
|
+
if (ret[3]) {
|
|
702
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
703
|
+
}
|
|
704
|
+
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
705
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
706
|
+
return v2;
|
|
707
|
+
}
|
|
708
|
+
exports.envelope_apply_trace_id = envelope_apply_trace_id;
|
|
709
|
+
|
|
710
|
+
/**
|
|
711
|
+
* Read `trace_id` off an inbound envelope without touching the encrypted
|
|
712
|
+
* inner payload. Returns `0` when the sender didn't set one — the protobuf
|
|
713
|
+
* default is indistinguishable from an explicit zero.
|
|
714
|
+
* @param {Uint8Array} envelope_bytes
|
|
715
|
+
* @returns {bigint}
|
|
716
|
+
*/
|
|
717
|
+
function envelope_read_trace_id(envelope_bytes) {
|
|
718
|
+
const ptr0 = passArray8ToWasm0(envelope_bytes, wasm.__wbindgen_malloc);
|
|
719
|
+
const len0 = WASM_VECTOR_LEN;
|
|
720
|
+
const ret = wasm.envelope_read_trace_id(ptr0, len0);
|
|
721
|
+
if (ret[2]) {
|
|
722
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
723
|
+
}
|
|
724
|
+
return BigInt.asUintN(64, ret[0]);
|
|
725
|
+
}
|
|
726
|
+
exports.envelope_read_trace_id = envelope_read_trace_id;
|
|
727
|
+
|
|
728
|
+
/**
|
|
729
|
+
* Structurally validate a JS-side [`ContactMessage`]. Throws on any
|
|
730
|
+
* mode/field inconsistency (unknown `contact_mode`, mode/field mismatch,
|
|
731
|
+
* wrong binding-hash length).
|
|
732
|
+
* @param {any} contact_message
|
|
733
|
+
*/
|
|
734
|
+
function pairing_contact_message_validate(contact_message) {
|
|
735
|
+
const ret = wasm.pairing_contact_message_validate(contact_message);
|
|
736
|
+
if (ret[1]) {
|
|
737
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
exports.pairing_contact_message_validate = pairing_contact_message_validate;
|
|
741
|
+
|
|
742
|
+
/**
|
|
743
|
+
* @param {bigint} channel_id
|
|
744
|
+
* @param {number} contact_mode
|
|
745
|
+
* @param {any} transport_protocol
|
|
746
|
+
* @param {any} nonce
|
|
747
|
+
* @returns {any}
|
|
748
|
+
*/
|
|
749
|
+
function pairing_request_create_contact(channel_id, contact_mode, transport_protocol, nonce) {
|
|
750
|
+
const ret = wasm.pairing_request_create_contact(channel_id, contact_mode, transport_protocol, nonce);
|
|
751
|
+
if (ret[2]) {
|
|
752
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
753
|
+
}
|
|
754
|
+
return takeFromExternrefTable0(ret[0]);
|
|
755
|
+
}
|
|
756
|
+
exports.pairing_request_create_contact = pairing_request_create_contact;
|
|
757
|
+
|
|
758
|
+
/**
|
|
759
|
+
* Decodes a proto-encoded [`ContactMessage`]. Structurally validates the
|
|
760
|
+
* decoded value before returning it to application code so consumers can
|
|
761
|
+
* trust the mode/field invariants documented on the wire format.
|
|
762
|
+
* @param {Uint8Array} bytes
|
|
763
|
+
* @returns {any}
|
|
764
|
+
*/
|
|
765
|
+
function pairing_request_decode_contact(bytes) {
|
|
766
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
767
|
+
const len0 = WASM_VECTOR_LEN;
|
|
768
|
+
const ret = wasm.pairing_request_decode_contact(ptr0, len0);
|
|
769
|
+
if (ret[2]) {
|
|
770
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
771
|
+
}
|
|
772
|
+
return takeFromExternrefTable0(ret[0]);
|
|
773
|
+
}
|
|
774
|
+
exports.pairing_request_decode_contact = pairing_request_decode_contact;
|
|
775
|
+
|
|
776
|
+
/**
|
|
777
|
+
* Encodes a [`ContactMessage`] to proto wire bytes. Structurally validates
|
|
778
|
+
* the input first so a locally-constructed contact that violates the
|
|
779
|
+
* mode/field invariant is rejected at the boundary rather than silently
|
|
780
|
+
* serialized.
|
|
781
|
+
* @param {any} contact_message
|
|
782
|
+
* @returns {Uint8Array}
|
|
783
|
+
*/
|
|
784
|
+
function pairing_request_encode_contact(contact_message) {
|
|
785
|
+
const ret = wasm.pairing_request_encode_contact(contact_message);
|
|
786
|
+
if (ret[3]) {
|
|
787
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
788
|
+
}
|
|
789
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
790
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
791
|
+
return v1;
|
|
792
|
+
}
|
|
793
|
+
exports.pairing_request_encode_contact = pairing_request_encode_contact;
|
|
794
|
+
|
|
795
|
+
/**
|
|
796
|
+
* @param {Uint8Array} envelope_bytes
|
|
797
|
+
* @param {Uint8Array} secret_key
|
|
798
|
+
* @returns {any}
|
|
799
|
+
*/
|
|
800
|
+
function pairing_request_extract(envelope_bytes, secret_key) {
|
|
801
|
+
const ptr0 = passArray8ToWasm0(envelope_bytes, wasm.__wbindgen_malloc);
|
|
802
|
+
const len0 = WASM_VECTOR_LEN;
|
|
803
|
+
const ptr1 = passArray8ToWasm0(secret_key, wasm.__wbindgen_malloc);
|
|
804
|
+
const len1 = WASM_VECTOR_LEN;
|
|
805
|
+
const ret = wasm.pairing_request_extract(ptr0, len0, ptr1, len1);
|
|
806
|
+
if (ret[2]) {
|
|
807
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
808
|
+
}
|
|
809
|
+
return takeFromExternrefTable0(ret[0]);
|
|
810
|
+
}
|
|
811
|
+
exports.pairing_request_extract = pairing_request_extract;
|
|
812
|
+
|
|
813
|
+
/**
|
|
814
|
+
* Initiator-side: decode an inbound plaintext `PrePairRequest` envelope.
|
|
815
|
+
* @param {Uint8Array} envelope_bytes
|
|
816
|
+
* @returns {any}
|
|
817
|
+
*/
|
|
818
|
+
function pairing_request_extract_pre_pair(envelope_bytes) {
|
|
819
|
+
const ptr0 = passArray8ToWasm0(envelope_bytes, wasm.__wbindgen_malloc);
|
|
820
|
+
const len0 = WASM_VECTOR_LEN;
|
|
821
|
+
const ret = wasm.pairing_request_extract_pre_pair(ptr0, len0);
|
|
822
|
+
if (ret[2]) {
|
|
823
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
824
|
+
}
|
|
825
|
+
return takeFromExternrefTable0(ret[0]);
|
|
826
|
+
}
|
|
827
|
+
exports.pairing_request_extract_pre_pair = pairing_request_extract_pre_pair;
|
|
828
|
+
|
|
829
|
+
/**
|
|
830
|
+
* @param {number} kind
|
|
831
|
+
* @param {any} transport_protocol
|
|
832
|
+
* @param {any} contact_message
|
|
833
|
+
* @param {any} communication_info
|
|
834
|
+
* @param {any} parameter_range
|
|
835
|
+
* @returns {any}
|
|
836
|
+
*/
|
|
837
|
+
function pairing_request_produce(kind, transport_protocol, contact_message, communication_info, parameter_range) {
|
|
838
|
+
const ret = wasm.pairing_request_produce(kind, transport_protocol, contact_message, communication_info, parameter_range);
|
|
839
|
+
if (ret[2]) {
|
|
840
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
841
|
+
}
|
|
842
|
+
return takeFromExternrefTable0(ret[0]);
|
|
843
|
+
}
|
|
844
|
+
exports.pairing_request_produce = pairing_request_produce;
|
|
845
|
+
|
|
846
|
+
/**
|
|
847
|
+
* Scanner-side: build the plaintext `PrePairRequest` envelope for a
|
|
848
|
+
* `HASHED_KEYS` contact.
|
|
849
|
+
* @param {any} transport_protocol
|
|
850
|
+
* @param {any} contact_message
|
|
851
|
+
* @returns {any}
|
|
852
|
+
*/
|
|
853
|
+
function pairing_request_produce_pre_pair(transport_protocol, contact_message) {
|
|
854
|
+
const ret = wasm.pairing_request_produce_pre_pair(transport_protocol, contact_message);
|
|
855
|
+
if (ret[2]) {
|
|
856
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
857
|
+
}
|
|
858
|
+
return takeFromExternrefTable0(ret[0]);
|
|
859
|
+
}
|
|
860
|
+
exports.pairing_request_produce_pre_pair = pairing_request_produce_pre_pair;
|
|
861
|
+
|
|
862
|
+
/**
|
|
863
|
+
* @param {Uint8Array} envelope_bytes
|
|
864
|
+
* @param {Uint8Array} secret_key
|
|
865
|
+
* @returns {any}
|
|
866
|
+
*/
|
|
867
|
+
function pairing_response_extract(envelope_bytes, secret_key) {
|
|
868
|
+
const ptr0 = passArray8ToWasm0(envelope_bytes, wasm.__wbindgen_malloc);
|
|
869
|
+
const len0 = WASM_VECTOR_LEN;
|
|
870
|
+
const ptr1 = passArray8ToWasm0(secret_key, wasm.__wbindgen_malloc);
|
|
871
|
+
const len1 = WASM_VECTOR_LEN;
|
|
872
|
+
const ret = wasm.pairing_response_extract(ptr0, len0, ptr1, len1);
|
|
873
|
+
if (ret[2]) {
|
|
874
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
875
|
+
}
|
|
876
|
+
return takeFromExternrefTable0(ret[0]);
|
|
877
|
+
}
|
|
878
|
+
exports.pairing_response_extract = pairing_response_extract;
|
|
879
|
+
|
|
880
|
+
/**
|
|
881
|
+
* Scanner-side: decode the inbound plaintext `PrePairResponse` envelope.
|
|
882
|
+
* @param {Uint8Array} envelope_bytes
|
|
883
|
+
* @returns {any}
|
|
884
|
+
*/
|
|
885
|
+
function pairing_response_extract_pre_pair(envelope_bytes) {
|
|
886
|
+
const ptr0 = passArray8ToWasm0(envelope_bytes, wasm.__wbindgen_malloc);
|
|
887
|
+
const len0 = WASM_VECTOR_LEN;
|
|
888
|
+
const ret = wasm.pairing_response_extract_pre_pair(ptr0, len0);
|
|
889
|
+
if (ret[2]) {
|
|
890
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
891
|
+
}
|
|
892
|
+
return takeFromExternrefTable0(ret[0]);
|
|
893
|
+
}
|
|
894
|
+
exports.pairing_response_extract_pre_pair = pairing_response_extract_pre_pair;
|
|
895
|
+
|
|
896
|
+
/**
|
|
897
|
+
* @param {any} contact_message
|
|
898
|
+
* @param {any} response
|
|
899
|
+
* @param {Uint8Array} secret_key
|
|
900
|
+
* @returns {any}
|
|
901
|
+
*/
|
|
902
|
+
function pairing_response_process(contact_message, response, secret_key) {
|
|
903
|
+
const ptr0 = passArray8ToWasm0(secret_key, wasm.__wbindgen_malloc);
|
|
904
|
+
const len0 = WASM_VECTOR_LEN;
|
|
905
|
+
const ret = wasm.pairing_response_process(contact_message, response, ptr0, len0);
|
|
906
|
+
if (ret[2]) {
|
|
907
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
908
|
+
}
|
|
909
|
+
return takeFromExternrefTable0(ret[0]);
|
|
910
|
+
}
|
|
911
|
+
exports.pairing_response_process = pairing_response_process;
|
|
912
|
+
|
|
913
|
+
/**
|
|
914
|
+
* Scanner-side: validate the `PrePairResponse` against the contact's
|
|
915
|
+
* SHA-384 binding hash. Returns the validated keys + nonce on match.
|
|
916
|
+
* @param {any} contact_message
|
|
917
|
+
* @param {any} response
|
|
918
|
+
* @returns {any}
|
|
919
|
+
*/
|
|
920
|
+
function pairing_response_process_pre_pair(contact_message, response) {
|
|
921
|
+
const ret = wasm.pairing_response_process_pre_pair(contact_message, response);
|
|
922
|
+
if (ret[2]) {
|
|
923
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
924
|
+
}
|
|
925
|
+
return takeFromExternrefTable0(ret[0]);
|
|
926
|
+
}
|
|
927
|
+
exports.pairing_response_process_pre_pair = pairing_response_process_pre_pair;
|
|
928
|
+
|
|
929
|
+
/**
|
|
930
|
+
* @param {bigint} channel_id
|
|
931
|
+
* @param {any} request
|
|
932
|
+
* @param {Uint8Array} secret_key
|
|
933
|
+
* @param {any} communication_info
|
|
934
|
+
* @param {any} parameter_range
|
|
935
|
+
* @returns {any}
|
|
936
|
+
*/
|
|
937
|
+
function pairing_response_produce(channel_id, request, secret_key, communication_info, parameter_range) {
|
|
938
|
+
const ptr0 = passArray8ToWasm0(secret_key, wasm.__wbindgen_malloc);
|
|
939
|
+
const len0 = WASM_VECTOR_LEN;
|
|
940
|
+
const ret = wasm.pairing_response_produce(channel_id, request, ptr0, len0, communication_info, parameter_range);
|
|
941
|
+
if (ret[2]) {
|
|
942
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
943
|
+
}
|
|
944
|
+
return takeFromExternrefTable0(ret[0]);
|
|
945
|
+
}
|
|
946
|
+
exports.pairing_response_produce = pairing_response_produce;
|
|
947
|
+
|
|
948
|
+
/**
|
|
949
|
+
* Contact-creator side: publish the actual public keys back to the scanner.
|
|
950
|
+
* @param {bigint} channel_id
|
|
951
|
+
* @param {any} request
|
|
952
|
+
* @param {Uint8Array} secret_key
|
|
953
|
+
* @returns {any}
|
|
954
|
+
*/
|
|
955
|
+
function pairing_response_produce_pre_pair(channel_id, request, secret_key) {
|
|
956
|
+
const ptr0 = passArray8ToWasm0(secret_key, wasm.__wbindgen_malloc);
|
|
957
|
+
const len0 = WASM_VECTOR_LEN;
|
|
958
|
+
const ret = wasm.pairing_response_produce_pre_pair(channel_id, request, ptr0, len0);
|
|
959
|
+
if (ret[2]) {
|
|
960
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
961
|
+
}
|
|
962
|
+
return takeFromExternrefTable0(ret[0]);
|
|
963
|
+
}
|
|
964
|
+
exports.pairing_response_produce_pre_pair = pairing_response_produce_pre_pair;
|
|
965
|
+
|
|
966
|
+
/**
|
|
967
|
+
* @param {Uint8Array} envelope_bytes
|
|
968
|
+
* @param {Uint8Array} shared_key
|
|
969
|
+
* @returns {any}
|
|
970
|
+
*/
|
|
971
|
+
function recovery_request_extract(envelope_bytes, shared_key) {
|
|
972
|
+
const ptr0 = passArray8ToWasm0(envelope_bytes, wasm.__wbindgen_malloc);
|
|
973
|
+
const len0 = WASM_VECTOR_LEN;
|
|
974
|
+
const ptr1 = passArray8ToWasm0(shared_key, wasm.__wbindgen_malloc);
|
|
975
|
+
const len1 = WASM_VECTOR_LEN;
|
|
976
|
+
const ret = wasm.recovery_request_extract(ptr0, len0, ptr1, len1);
|
|
977
|
+
if (ret[2]) {
|
|
978
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
979
|
+
}
|
|
980
|
+
return takeFromExternrefTable0(ret[0]);
|
|
981
|
+
}
|
|
982
|
+
exports.recovery_request_extract = recovery_request_extract;
|
|
983
|
+
|
|
984
|
+
/**
|
|
985
|
+
* @param {bigint} channel_id
|
|
986
|
+
* @param {bigint} secret_id
|
|
987
|
+
* @param {number} version
|
|
988
|
+
* @param {Uint8Array} shared_key
|
|
989
|
+
* @param {any} reply_to
|
|
990
|
+
* @returns {any}
|
|
991
|
+
*/
|
|
992
|
+
function recovery_request_produce(channel_id, secret_id, version, shared_key, reply_to) {
|
|
993
|
+
const ptr0 = passArray8ToWasm0(shared_key, wasm.__wbindgen_malloc);
|
|
994
|
+
const len0 = WASM_VECTOR_LEN;
|
|
995
|
+
const ret = wasm.recovery_request_produce(channel_id, secret_id, version, ptr0, len0, reply_to);
|
|
996
|
+
if (ret[2]) {
|
|
997
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
998
|
+
}
|
|
999
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1000
|
+
}
|
|
1001
|
+
exports.recovery_request_produce = recovery_request_produce;
|
|
1002
|
+
|
|
1003
|
+
/**
|
|
1004
|
+
* @param {Uint8Array} envelope_bytes
|
|
1005
|
+
* @param {Uint8Array} shared_key
|
|
1006
|
+
* @returns {any}
|
|
1007
|
+
*/
|
|
1008
|
+
function recovery_response_extract(envelope_bytes, shared_key) {
|
|
1009
|
+
const ptr0 = passArray8ToWasm0(envelope_bytes, wasm.__wbindgen_malloc);
|
|
1010
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1011
|
+
const ptr1 = passArray8ToWasm0(shared_key, wasm.__wbindgen_malloc);
|
|
1012
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1013
|
+
const ret = wasm.recovery_response_extract(ptr0, len0, ptr1, len1);
|
|
1014
|
+
if (ret[2]) {
|
|
1015
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1016
|
+
}
|
|
1017
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1018
|
+
}
|
|
1019
|
+
exports.recovery_response_extract = recovery_response_extract;
|
|
1020
|
+
|
|
1021
|
+
/**
|
|
1022
|
+
* @param {bigint} channel_id
|
|
1023
|
+
* @param {any} request
|
|
1024
|
+
* @param {any} stored_share_request
|
|
1025
|
+
* @param {Uint8Array} shared_key
|
|
1026
|
+
* @returns {any}
|
|
1027
|
+
*/
|
|
1028
|
+
function recovery_response_produce(channel_id, request, stored_share_request, shared_key) {
|
|
1029
|
+
const ptr0 = passArray8ToWasm0(shared_key, wasm.__wbindgen_malloc);
|
|
1030
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1031
|
+
const ret = wasm.recovery_response_produce(channel_id, request, stored_share_request, ptr0, len0);
|
|
1032
|
+
if (ret[2]) {
|
|
1033
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1034
|
+
}
|
|
1035
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1036
|
+
}
|
|
1037
|
+
exports.recovery_response_produce = recovery_response_produce;
|
|
1038
|
+
|
|
1039
|
+
/**
|
|
1040
|
+
* @param {bigint} secret_id
|
|
1041
|
+
* @param {number} version
|
|
1042
|
+
* @param {any} responses
|
|
1043
|
+
* @returns {any}
|
|
1044
|
+
*/
|
|
1045
|
+
function recovery_response_recover(secret_id, version, responses) {
|
|
1046
|
+
const ret = wasm.recovery_response_recover(secret_id, version, responses);
|
|
1047
|
+
if (ret[2]) {
|
|
1048
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1049
|
+
}
|
|
1050
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1051
|
+
}
|
|
1052
|
+
exports.recovery_response_recover = recovery_response_recover;
|
|
1053
|
+
|
|
1054
|
+
/**
|
|
1055
|
+
* @param {Uint8Array} envelope_bytes
|
|
1056
|
+
* @param {Uint8Array} shared_key
|
|
1057
|
+
* @returns {any}
|
|
1058
|
+
*/
|
|
1059
|
+
function sharing_request_extract(envelope_bytes, shared_key) {
|
|
1060
|
+
const ptr0 = passArray8ToWasm0(envelope_bytes, wasm.__wbindgen_malloc);
|
|
1061
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1062
|
+
const ptr1 = passArray8ToWasm0(shared_key, wasm.__wbindgen_malloc);
|
|
1063
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1064
|
+
const ret = wasm.sharing_request_extract(ptr0, len0, ptr1, len1);
|
|
1065
|
+
if (ret[2]) {
|
|
1066
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1067
|
+
}
|
|
1068
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1069
|
+
}
|
|
1070
|
+
exports.sharing_request_extract = sharing_request_extract;
|
|
1071
|
+
|
|
1072
|
+
/**
|
|
1073
|
+
* @param {bigint} channel_id
|
|
1074
|
+
* @param {number} version
|
|
1075
|
+
* @param {bigint} secret_id
|
|
1076
|
+
* @param {any} committed_share
|
|
1077
|
+
* @param {any} keep_list
|
|
1078
|
+
* @param {string} description
|
|
1079
|
+
* @param {Uint8Array} shared_key
|
|
1080
|
+
* @param {any} reply_to
|
|
1081
|
+
* @returns {any}
|
|
1082
|
+
*/
|
|
1083
|
+
function sharing_request_produce(channel_id, version, secret_id, committed_share, keep_list, description, shared_key, reply_to) {
|
|
1084
|
+
const ptr0 = passStringToWasm0(description, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1085
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1086
|
+
const ptr1 = passArray8ToWasm0(shared_key, wasm.__wbindgen_malloc);
|
|
1087
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1088
|
+
const ret = wasm.sharing_request_produce(channel_id, version, secret_id, committed_share, keep_list, ptr0, len0, ptr1, len1, reply_to);
|
|
1089
|
+
if (ret[2]) {
|
|
1090
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1091
|
+
}
|
|
1092
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1093
|
+
}
|
|
1094
|
+
exports.sharing_request_produce = sharing_request_produce;
|
|
1095
|
+
|
|
1096
|
+
/**
|
|
1097
|
+
* @param {any} channels
|
|
1098
|
+
* @param {bigint} secret_id
|
|
1099
|
+
* @param {number} version
|
|
1100
|
+
* @param {Uint8Array} secret_data
|
|
1101
|
+
* @param {number} threshold
|
|
1102
|
+
* @returns {any}
|
|
1103
|
+
*/
|
|
1104
|
+
function sharing_request_split(channels, secret_id, version, secret_data, threshold) {
|
|
1105
|
+
const ptr0 = passArray8ToWasm0(secret_data, wasm.__wbindgen_malloc);
|
|
1106
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1107
|
+
const ret = wasm.sharing_request_split(channels, secret_id, version, ptr0, len0, threshold);
|
|
1108
|
+
if (ret[2]) {
|
|
1109
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1110
|
+
}
|
|
1111
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1112
|
+
}
|
|
1113
|
+
exports.sharing_request_split = sharing_request_split;
|
|
1114
|
+
|
|
1115
|
+
/**
|
|
1116
|
+
* @param {Uint8Array} envelope_bytes
|
|
1117
|
+
* @param {Uint8Array} shared_key
|
|
1118
|
+
* @returns {any}
|
|
1119
|
+
*/
|
|
1120
|
+
function sharing_response_extract(envelope_bytes, shared_key) {
|
|
1121
|
+
const ptr0 = passArray8ToWasm0(envelope_bytes, wasm.__wbindgen_malloc);
|
|
1122
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1123
|
+
const ptr1 = passArray8ToWasm0(shared_key, wasm.__wbindgen_malloc);
|
|
1124
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1125
|
+
const ret = wasm.sharing_response_extract(ptr0, len0, ptr1, len1);
|
|
1126
|
+
if (ret[2]) {
|
|
1127
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1128
|
+
}
|
|
1129
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1130
|
+
}
|
|
1131
|
+
exports.sharing_response_extract = sharing_response_extract;
|
|
1132
|
+
|
|
1133
|
+
/**
|
|
1134
|
+
* @param {number} version
|
|
1135
|
+
* @param {any} response
|
|
1136
|
+
*/
|
|
1137
|
+
function sharing_response_process(version, response) {
|
|
1138
|
+
const ret = wasm.sharing_response_process(version, response);
|
|
1139
|
+
if (ret[1]) {
|
|
1140
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
1141
|
+
}
|
|
1142
|
+
}
|
|
1143
|
+
exports.sharing_response_process = sharing_response_process;
|
|
1144
|
+
|
|
1145
|
+
/**
|
|
1146
|
+
* @param {bigint} channel_id
|
|
1147
|
+
* @param {any} request
|
|
1148
|
+
* @param {Uint8Array} shared_key
|
|
1149
|
+
* @returns {any}
|
|
1150
|
+
*/
|
|
1151
|
+
function sharing_response_produce(channel_id, request, shared_key) {
|
|
1152
|
+
const ptr0 = passArray8ToWasm0(shared_key, wasm.__wbindgen_malloc);
|
|
1153
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1154
|
+
const ret = wasm.sharing_response_produce(channel_id, request, ptr0, len0);
|
|
1155
|
+
if (ret[2]) {
|
|
1156
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1157
|
+
}
|
|
1158
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1159
|
+
}
|
|
1160
|
+
exports.sharing_response_produce = sharing_response_produce;
|
|
1161
|
+
|
|
1162
|
+
/**
|
|
1163
|
+
* @param {Uint8Array} envelope_bytes
|
|
1164
|
+
* @param {Uint8Array} shared_key
|
|
1165
|
+
* @returns {any}
|
|
1166
|
+
*/
|
|
1167
|
+
function unpairing_request_extract(envelope_bytes, shared_key) {
|
|
1168
|
+
const ptr0 = passArray8ToWasm0(envelope_bytes, wasm.__wbindgen_malloc);
|
|
1169
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1170
|
+
const ptr1 = passArray8ToWasm0(shared_key, wasm.__wbindgen_malloc);
|
|
1171
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1172
|
+
const ret = wasm.unpairing_request_extract(ptr0, len0, ptr1, len1);
|
|
1173
|
+
if (ret[2]) {
|
|
1174
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1175
|
+
}
|
|
1176
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1177
|
+
}
|
|
1178
|
+
exports.unpairing_request_extract = unpairing_request_extract;
|
|
1179
|
+
|
|
1180
|
+
/**
|
|
1181
|
+
* @param {bigint} channel_id
|
|
1182
|
+
* @param {string} memo
|
|
1183
|
+
* @param {Uint8Array} shared_key
|
|
1184
|
+
* @param {any} reply_to
|
|
1185
|
+
* @returns {any}
|
|
1186
|
+
*/
|
|
1187
|
+
function unpairing_request_produce(channel_id, memo, shared_key, reply_to) {
|
|
1188
|
+
const ptr0 = passStringToWasm0(memo, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1189
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1190
|
+
const ptr1 = passArray8ToWasm0(shared_key, wasm.__wbindgen_malloc);
|
|
1191
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1192
|
+
const ret = wasm.unpairing_request_produce(channel_id, ptr0, len0, ptr1, len1, reply_to);
|
|
1193
|
+
if (ret[2]) {
|
|
1194
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1195
|
+
}
|
|
1196
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1197
|
+
}
|
|
1198
|
+
exports.unpairing_request_produce = unpairing_request_produce;
|
|
1199
|
+
|
|
1200
|
+
/**
|
|
1201
|
+
* @param {Uint8Array} envelope_bytes
|
|
1202
|
+
* @param {Uint8Array} shared_key
|
|
1203
|
+
* @returns {any}
|
|
1204
|
+
*/
|
|
1205
|
+
function unpairing_response_extract(envelope_bytes, shared_key) {
|
|
1206
|
+
const ptr0 = passArray8ToWasm0(envelope_bytes, wasm.__wbindgen_malloc);
|
|
1207
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1208
|
+
const ptr1 = passArray8ToWasm0(shared_key, wasm.__wbindgen_malloc);
|
|
1209
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1210
|
+
const ret = wasm.unpairing_response_extract(ptr0, len0, ptr1, len1);
|
|
1211
|
+
if (ret[2]) {
|
|
1212
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1213
|
+
}
|
|
1214
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1215
|
+
}
|
|
1216
|
+
exports.unpairing_response_extract = unpairing_response_extract;
|
|
1217
|
+
|
|
1218
|
+
/**
|
|
1219
|
+
* @param {any} response
|
|
1220
|
+
* @returns {any}
|
|
1221
|
+
*/
|
|
1222
|
+
function unpairing_response_process(response) {
|
|
1223
|
+
const ret = wasm.unpairing_response_process(response);
|
|
1224
|
+
if (ret[2]) {
|
|
1225
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1226
|
+
}
|
|
1227
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1228
|
+
}
|
|
1229
|
+
exports.unpairing_response_process = unpairing_response_process;
|
|
1230
|
+
|
|
1231
|
+
/**
|
|
1232
|
+
* @param {bigint} channel_id
|
|
1233
|
+
* @param {Uint8Array} shared_key
|
|
1234
|
+
* @returns {any}
|
|
1235
|
+
*/
|
|
1236
|
+
function unpairing_response_produce(channel_id, shared_key) {
|
|
1237
|
+
const ptr0 = passArray8ToWasm0(shared_key, wasm.__wbindgen_malloc);
|
|
1238
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1239
|
+
const ret = wasm.unpairing_response_produce(channel_id, ptr0, len0);
|
|
1240
|
+
if (ret[2]) {
|
|
1241
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1242
|
+
}
|
|
1243
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1244
|
+
}
|
|
1245
|
+
exports.unpairing_response_produce = unpairing_response_produce;
|
|
1246
|
+
|
|
1247
|
+
/**
|
|
1248
|
+
* @param {Uint8Array} envelope_bytes
|
|
1249
|
+
* @param {Uint8Array} shared_key
|
|
1250
|
+
* @returns {any}
|
|
1251
|
+
*/
|
|
1252
|
+
function verification_request_extract(envelope_bytes, shared_key) {
|
|
1253
|
+
const ptr0 = passArray8ToWasm0(envelope_bytes, wasm.__wbindgen_malloc);
|
|
1254
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1255
|
+
const ptr1 = passArray8ToWasm0(shared_key, wasm.__wbindgen_malloc);
|
|
1256
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1257
|
+
const ret = wasm.verification_request_extract(ptr0, len0, ptr1, len1);
|
|
1258
|
+
if (ret[2]) {
|
|
1259
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1260
|
+
}
|
|
1261
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1262
|
+
}
|
|
1263
|
+
exports.verification_request_extract = verification_request_extract;
|
|
1264
|
+
|
|
1265
|
+
/**
|
|
1266
|
+
* @param {bigint} channel_id
|
|
1267
|
+
* @param {bigint} secret_id
|
|
1268
|
+
* @param {number} version
|
|
1269
|
+
* @param {Uint8Array} shared_key
|
|
1270
|
+
* @param {any} reply_to
|
|
1271
|
+
* @returns {any}
|
|
1272
|
+
*/
|
|
1273
|
+
function verification_request_produce(channel_id, secret_id, version, shared_key, reply_to) {
|
|
1274
|
+
const ptr0 = passArray8ToWasm0(shared_key, wasm.__wbindgen_malloc);
|
|
1275
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1276
|
+
const ret = wasm.verification_request_produce(channel_id, secret_id, version, ptr0, len0, reply_to);
|
|
1277
|
+
if (ret[2]) {
|
|
1278
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1279
|
+
}
|
|
1280
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1281
|
+
}
|
|
1282
|
+
exports.verification_request_produce = verification_request_produce;
|
|
1283
|
+
|
|
1284
|
+
/**
|
|
1285
|
+
* @param {Uint8Array} envelope_bytes
|
|
1286
|
+
* @param {Uint8Array} shared_key
|
|
1287
|
+
* @returns {any}
|
|
1288
|
+
*/
|
|
1289
|
+
function verification_response_extract(envelope_bytes, shared_key) {
|
|
1290
|
+
const ptr0 = passArray8ToWasm0(envelope_bytes, wasm.__wbindgen_malloc);
|
|
1291
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1292
|
+
const ptr1 = passArray8ToWasm0(shared_key, wasm.__wbindgen_malloc);
|
|
1293
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1294
|
+
const ret = wasm.verification_response_extract(ptr0, len0, ptr1, len1);
|
|
1295
|
+
if (ret[2]) {
|
|
1296
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1297
|
+
}
|
|
1298
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1299
|
+
}
|
|
1300
|
+
exports.verification_response_extract = verification_response_extract;
|
|
1301
|
+
|
|
1302
|
+
/**
|
|
1303
|
+
* Verify a `VerifyShareResponseMessage` against the originating
|
|
1304
|
+
* `VerifyShareRequestMessage` and the expected share content.
|
|
1305
|
+
*
|
|
1306
|
+
* `request` must be the request the **owner** previously produced for
|
|
1307
|
+
* this challenge (kept by the caller in a per-`channel_id` pending-
|
|
1308
|
+
* verification map). The primitive rejects any response whose
|
|
1309
|
+
* `(nonce, secret_id, version)` triple doesn't match — that's the
|
|
1310
|
+
* anti-replay gate.
|
|
1311
|
+
* @param {any} request
|
|
1312
|
+
* @param {any} response
|
|
1313
|
+
* @param {Uint8Array} share_content
|
|
1314
|
+
* @returns {boolean}
|
|
1315
|
+
*/
|
|
1316
|
+
function verification_response_process(request, response, share_content) {
|
|
1317
|
+
const ptr0 = passArray8ToWasm0(share_content, wasm.__wbindgen_malloc);
|
|
1318
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1319
|
+
const ret = wasm.verification_response_process(request, response, ptr0, len0);
|
|
1320
|
+
if (ret[2]) {
|
|
1321
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1322
|
+
}
|
|
1323
|
+
return ret[0] !== 0;
|
|
1324
|
+
}
|
|
1325
|
+
exports.verification_response_process = verification_response_process;
|
|
1326
|
+
|
|
1327
|
+
/**
|
|
1328
|
+
* @param {bigint} channel_id
|
|
1329
|
+
* @param {any} request
|
|
1330
|
+
* @param {Uint8Array} shared_key
|
|
1331
|
+
* @param {Uint8Array} share_content
|
|
1332
|
+
* @returns {any}
|
|
1333
|
+
*/
|
|
1334
|
+
function verification_response_produce(channel_id, request, shared_key, share_content) {
|
|
1335
|
+
const ptr0 = passArray8ToWasm0(shared_key, wasm.__wbindgen_malloc);
|
|
1336
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1337
|
+
const ptr1 = passArray8ToWasm0(share_content, wasm.__wbindgen_malloc);
|
|
1338
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1339
|
+
const ret = wasm.verification_response_produce(channel_id, request, ptr0, len0, ptr1, len1);
|
|
1340
|
+
if (ret[2]) {
|
|
1341
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1342
|
+
}
|
|
1343
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1344
|
+
}
|
|
1345
|
+
exports.verification_response_produce = verification_response_produce;
|
|
1346
|
+
|
|
1347
|
+
function wasm_start() {
|
|
1348
|
+
wasm.wasm_start();
|
|
1349
|
+
}
|
|
1350
|
+
exports.wasm_start = wasm_start;
|
|
1351
|
+
function __wbg_get_imports() {
|
|
1352
|
+
const import0 = {
|
|
1353
|
+
__proto__: null,
|
|
1354
|
+
__wbg_BigInt_54837260f97b6890: function(arg0) {
|
|
1355
|
+
const ret = BigInt(arg0);
|
|
1356
|
+
return ret;
|
|
1357
|
+
},
|
|
1358
|
+
__wbg_Error_408e67f47ca7b58b: function(arg0, arg1) {
|
|
1359
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
1360
|
+
return ret;
|
|
1361
|
+
},
|
|
1362
|
+
__wbg_Number_3890faa6d3ff057d: function(arg0) {
|
|
1363
|
+
const ret = Number(arg0);
|
|
1364
|
+
return ret;
|
|
1365
|
+
},
|
|
1366
|
+
__wbg_String_8564e559799eccda: function(arg0, arg1) {
|
|
1367
|
+
const ret = String(arg1);
|
|
1368
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1369
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1370
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1371
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1372
|
+
},
|
|
1373
|
+
__wbg___wbindgen_bigint_get_as_i64_c4ecf48528083721: function(arg0, arg1) {
|
|
1374
|
+
const v = arg1;
|
|
1375
|
+
const ret = typeof(v) === 'bigint' ? v : undefined;
|
|
1376
|
+
getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
|
|
1377
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
1378
|
+
},
|
|
1379
|
+
__wbg___wbindgen_boolean_get_c9c83ebd41b34df3: function(arg0) {
|
|
1380
|
+
const v = arg0;
|
|
1381
|
+
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
1382
|
+
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
|
|
1383
|
+
},
|
|
1384
|
+
__wbg___wbindgen_debug_string_a57024b9c6e4a48b: function(arg0, arg1) {
|
|
1385
|
+
const ret = debugString(arg1);
|
|
1386
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1387
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1388
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1389
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1390
|
+
},
|
|
1391
|
+
__wbg___wbindgen_in_ac983077f137f2e6: function(arg0, arg1) {
|
|
1392
|
+
const ret = arg0 in arg1;
|
|
1393
|
+
return ret;
|
|
1394
|
+
},
|
|
1395
|
+
__wbg___wbindgen_is_bigint_8ffbbef442139384: function(arg0) {
|
|
1396
|
+
const ret = typeof(arg0) === 'bigint';
|
|
1397
|
+
return ret;
|
|
1398
|
+
},
|
|
1399
|
+
__wbg___wbindgen_is_function_5e4570eb24ffa122: function(arg0) {
|
|
1400
|
+
const ret = typeof(arg0) === 'function';
|
|
1401
|
+
return ret;
|
|
1402
|
+
},
|
|
1403
|
+
__wbg___wbindgen_is_null_7d13f41e1a2d5140: function(arg0) {
|
|
1404
|
+
const ret = arg0 === null;
|
|
1405
|
+
return ret;
|
|
1406
|
+
},
|
|
1407
|
+
__wbg___wbindgen_is_object_a2790eb24c211ea0: function(arg0) {
|
|
1408
|
+
const val = arg0;
|
|
1409
|
+
const ret = typeof(val) === 'object' && val !== null;
|
|
1410
|
+
return ret;
|
|
1411
|
+
},
|
|
1412
|
+
__wbg___wbindgen_is_string_e6f02f0ea5f20a32: function(arg0) {
|
|
1413
|
+
const ret = typeof(arg0) === 'string';
|
|
1414
|
+
return ret;
|
|
1415
|
+
},
|
|
1416
|
+
__wbg___wbindgen_is_undefined_6cff064c44e0d823: function(arg0) {
|
|
1417
|
+
const ret = arg0 === undefined;
|
|
1418
|
+
return ret;
|
|
1419
|
+
},
|
|
1420
|
+
__wbg___wbindgen_jsval_eq_0a18949a61670320: function(arg0, arg1) {
|
|
1421
|
+
const ret = arg0 === arg1;
|
|
1422
|
+
return ret;
|
|
1423
|
+
},
|
|
1424
|
+
__wbg___wbindgen_jsval_loose_eq_acf2776254a8d832: function(arg0, arg1) {
|
|
1425
|
+
const ret = arg0 == arg1;
|
|
1426
|
+
return ret;
|
|
1427
|
+
},
|
|
1428
|
+
__wbg___wbindgen_lt_94fbb50645571f95: function(arg0, arg1) {
|
|
1429
|
+
const ret = arg0 < arg1;
|
|
1430
|
+
return ret;
|
|
1431
|
+
},
|
|
1432
|
+
__wbg___wbindgen_neg_8a39375bffed95b1: function(arg0) {
|
|
1433
|
+
const ret = -arg0;
|
|
1434
|
+
return ret;
|
|
1435
|
+
},
|
|
1436
|
+
__wbg___wbindgen_number_get_136b9679cab35cfb: function(arg0, arg1) {
|
|
1437
|
+
const obj = arg1;
|
|
1438
|
+
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
1439
|
+
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
1440
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
1441
|
+
},
|
|
1442
|
+
__wbg___wbindgen_string_get_d154f1e671052120: function(arg0, arg1) {
|
|
1443
|
+
const obj = arg1;
|
|
1444
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
1445
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1446
|
+
var len1 = WASM_VECTOR_LEN;
|
|
1447
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1448
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1449
|
+
},
|
|
1450
|
+
__wbg___wbindgen_throw_bb96b2010945f0bc: function(arg0, arg1) {
|
|
1451
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
1452
|
+
},
|
|
1453
|
+
__wbg__wbg_cb_unref_be22cc64ae6946a0: function(arg0) {
|
|
1454
|
+
arg0._wbg_cb_unref();
|
|
1455
|
+
},
|
|
1456
|
+
__wbg_apply_cb180996ed7fdae9: function() { return handleError(function (arg0, arg1, arg2) {
|
|
1457
|
+
const ret = arg0.apply(arg1, arg2);
|
|
1458
|
+
return ret;
|
|
1459
|
+
}, arguments); },
|
|
1460
|
+
__wbg_call_1c5886ab9c57d1c7: function() { return handleError(function (arg0, arg1) {
|
|
1461
|
+
const ret = arg0.call(arg1);
|
|
1462
|
+
return ret;
|
|
1463
|
+
}, arguments); },
|
|
1464
|
+
__wbg_call_35dba3c747ad7521: function() { return handleError(function (arg0, arg1, arg2) {
|
|
1465
|
+
const ret = arg0.call(arg1, arg2);
|
|
1466
|
+
return ret;
|
|
1467
|
+
}, arguments); },
|
|
1468
|
+
__wbg_crypto_38df2bab126b63dc: function(arg0) {
|
|
1469
|
+
const ret = arg0.crypto;
|
|
1470
|
+
return ret;
|
|
1471
|
+
},
|
|
1472
|
+
__wbg_done_669171204c3dcae2: function(arg0) {
|
|
1473
|
+
const ret = arg0.done;
|
|
1474
|
+
return ret;
|
|
1475
|
+
},
|
|
1476
|
+
__wbg_entries_7774d489e1da5f4f: function(arg0) {
|
|
1477
|
+
const ret = Object.entries(arg0);
|
|
1478
|
+
return ret;
|
|
1479
|
+
},
|
|
1480
|
+
__wbg_error_757e9472f8410341: function(arg0, arg1) {
|
|
1481
|
+
let deferred0_0;
|
|
1482
|
+
let deferred0_1;
|
|
1483
|
+
try {
|
|
1484
|
+
deferred0_0 = arg0;
|
|
1485
|
+
deferred0_1 = arg1;
|
|
1486
|
+
console.error(getStringFromWasm0(arg0, arg1));
|
|
1487
|
+
} finally {
|
|
1488
|
+
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
1489
|
+
}
|
|
1490
|
+
},
|
|
1491
|
+
__wbg_error_dd408a7b3cb542dd: function(arg0) {
|
|
1492
|
+
console.error(arg0);
|
|
1493
|
+
},
|
|
1494
|
+
__wbg_from_74f3d90e0ff11240: function(arg0) {
|
|
1495
|
+
const ret = Array.from(arg0);
|
|
1496
|
+
return ret;
|
|
1497
|
+
},
|
|
1498
|
+
__wbg_getRandomValues_436a51d0629d84e1: function() { return handleError(function (arg0, arg1) {
|
|
1499
|
+
globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
|
|
1500
|
+
}, arguments); },
|
|
1501
|
+
__wbg_getRandomValues_c44a50d8cfdaebeb: function() { return handleError(function (arg0, arg1) {
|
|
1502
|
+
arg0.getRandomValues(arg1);
|
|
1503
|
+
}, arguments); },
|
|
1504
|
+
__wbg_get_971a0c45d172643f: function() { return handleError(function (arg0, arg1) {
|
|
1505
|
+
const ret = Reflect.get(arg0, arg1);
|
|
1506
|
+
return ret;
|
|
1507
|
+
}, arguments); },
|
|
1508
|
+
__wbg_get_c0c8f8d7da0c03dd: function(arg0, arg1) {
|
|
1509
|
+
const ret = arg0[arg1 >>> 0];
|
|
1510
|
+
return ret;
|
|
1511
|
+
},
|
|
1512
|
+
__wbg_get_d173c0308df22d37: function() { return handleError(function (arg0, arg1) {
|
|
1513
|
+
const ret = Reflect.get(arg0, arg1);
|
|
1514
|
+
return ret;
|
|
1515
|
+
}, arguments); },
|
|
1516
|
+
__wbg_get_unchecked_e20b893aeafc3fca: function(arg0, arg1) {
|
|
1517
|
+
const ret = arg0[arg1 >>> 0];
|
|
1518
|
+
return ret;
|
|
1519
|
+
},
|
|
1520
|
+
__wbg_get_with_ref_key_6412cf3094599694: function(arg0, arg1) {
|
|
1521
|
+
const ret = arg0[arg1];
|
|
1522
|
+
return ret;
|
|
1523
|
+
},
|
|
1524
|
+
__wbg_instanceof_ArrayBuffer_993d02d2d254cad1: function(arg0) {
|
|
1525
|
+
let result;
|
|
1526
|
+
try {
|
|
1527
|
+
result = arg0 instanceof ArrayBuffer;
|
|
1528
|
+
} catch (_) {
|
|
1529
|
+
result = false;
|
|
1530
|
+
}
|
|
1531
|
+
const ret = result;
|
|
1532
|
+
return ret;
|
|
1533
|
+
},
|
|
1534
|
+
__wbg_instanceof_Uint8Array_f935dbb0aa7cdeed: function(arg0) {
|
|
1535
|
+
let result;
|
|
1536
|
+
try {
|
|
1537
|
+
result = arg0 instanceof Uint8Array;
|
|
1538
|
+
} catch (_) {
|
|
1539
|
+
result = false;
|
|
1540
|
+
}
|
|
1541
|
+
const ret = result;
|
|
1542
|
+
return ret;
|
|
1543
|
+
},
|
|
1544
|
+
__wbg_isArray_6339f732981044bf: function(arg0) {
|
|
1545
|
+
const ret = Array.isArray(arg0);
|
|
1546
|
+
return ret;
|
|
1547
|
+
},
|
|
1548
|
+
__wbg_isSafeInteger_f3d6cd19ccfe4512: function(arg0) {
|
|
1549
|
+
const ret = Number.isSafeInteger(arg0);
|
|
1550
|
+
return ret;
|
|
1551
|
+
},
|
|
1552
|
+
__wbg_iterator_5cebbb86e33c6dd6: function() {
|
|
1553
|
+
const ret = Symbol.iterator;
|
|
1554
|
+
return ret;
|
|
1555
|
+
},
|
|
1556
|
+
__wbg_length_36bd29c6848c2144: function(arg0) {
|
|
1557
|
+
const ret = arg0.length;
|
|
1558
|
+
return ret;
|
|
1559
|
+
},
|
|
1560
|
+
__wbg_length_ecfa2c63d3d0d82c: function(arg0) {
|
|
1561
|
+
const ret = arg0.length;
|
|
1562
|
+
return ret;
|
|
1563
|
+
},
|
|
1564
|
+
__wbg_msCrypto_bd5a034af96bcba6: function(arg0) {
|
|
1565
|
+
const ret = arg0.msCrypto;
|
|
1566
|
+
return ret;
|
|
1567
|
+
},
|
|
1568
|
+
__wbg_new_116be93542d39019: function() {
|
|
1569
|
+
const ret = new Array();
|
|
1570
|
+
return ret;
|
|
1571
|
+
},
|
|
1572
|
+
__wbg_new_227d7c05414eb861: function() {
|
|
1573
|
+
const ret = new Error();
|
|
1574
|
+
return ret;
|
|
1575
|
+
},
|
|
1576
|
+
__wbg_new_77cc4f4f472aeb81: function(arg0) {
|
|
1577
|
+
const ret = new Uint8Array(arg0);
|
|
1578
|
+
return ret;
|
|
1579
|
+
},
|
|
1580
|
+
__wbg_new_cdf041679ded4c5f: function() {
|
|
1581
|
+
const ret = new Map();
|
|
1582
|
+
return ret;
|
|
1583
|
+
},
|
|
1584
|
+
__wbg_new_ebe3e0f6837f0879: function() {
|
|
1585
|
+
const ret = new Object();
|
|
1586
|
+
return ret;
|
|
1587
|
+
},
|
|
1588
|
+
__wbg_new_from_slice_3eea173078478cfe: function(arg0, arg1) {
|
|
1589
|
+
const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
|
|
1590
|
+
return ret;
|
|
1591
|
+
},
|
|
1592
|
+
__wbg_new_typed_cceaf62d8d95e9f2: function(arg0, arg1) {
|
|
1593
|
+
try {
|
|
1594
|
+
var state0 = {a: arg0, b: arg1};
|
|
1595
|
+
var cb0 = (arg0, arg1) => {
|
|
1596
|
+
const a = state0.a;
|
|
1597
|
+
state0.a = 0;
|
|
1598
|
+
try {
|
|
1599
|
+
return wasm_bindgen__convert__closures_____invoke__h037700d3f721a480(a, state0.b, arg0, arg1);
|
|
1600
|
+
} finally {
|
|
1601
|
+
state0.a = a;
|
|
1602
|
+
}
|
|
1603
|
+
};
|
|
1604
|
+
const ret = new Promise(cb0);
|
|
1605
|
+
return ret;
|
|
1606
|
+
} finally {
|
|
1607
|
+
state0.a = 0;
|
|
1608
|
+
}
|
|
1609
|
+
},
|
|
1610
|
+
__wbg_new_with_length_3ffc1c56427c525c: function(arg0) {
|
|
1611
|
+
const ret = new Uint8Array(arg0 >>> 0);
|
|
1612
|
+
return ret;
|
|
1613
|
+
},
|
|
1614
|
+
__wbg_next_42cf16ee0dafc9e2: function() { return handleError(function (arg0) {
|
|
1615
|
+
const ret = arg0.next();
|
|
1616
|
+
return ret;
|
|
1617
|
+
}, arguments); },
|
|
1618
|
+
__wbg_next_8f26b64fa5e9f64b: function(arg0) {
|
|
1619
|
+
const ret = arg0.next;
|
|
1620
|
+
return ret;
|
|
1621
|
+
},
|
|
1622
|
+
__wbg_node_84ea875411254db1: function(arg0) {
|
|
1623
|
+
const ret = arg0.node;
|
|
1624
|
+
return ret;
|
|
1625
|
+
},
|
|
1626
|
+
__wbg_now_8b265300afd5f2b9: function() {
|
|
1627
|
+
const ret = Date.now();
|
|
1628
|
+
return ret;
|
|
1629
|
+
},
|
|
1630
|
+
__wbg_process_44c7a14e11e9f69e: function(arg0) {
|
|
1631
|
+
const ret = arg0.process;
|
|
1632
|
+
return ret;
|
|
1633
|
+
},
|
|
1634
|
+
__wbg_prototypesetcall_de8e0d9553586985: function(arg0, arg1, arg2) {
|
|
1635
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
1636
|
+
},
|
|
1637
|
+
__wbg_push_adb0107829f02d75: function(arg0, arg1) {
|
|
1638
|
+
const ret = arg0.push(arg1);
|
|
1639
|
+
return ret;
|
|
1640
|
+
},
|
|
1641
|
+
__wbg_queueMicrotask_ac694eae12e92dfb: function(arg0) {
|
|
1642
|
+
queueMicrotask(arg0);
|
|
1643
|
+
},
|
|
1644
|
+
__wbg_queueMicrotask_be5fe34a8f4cad4d: function(arg0) {
|
|
1645
|
+
const ret = arg0.queueMicrotask;
|
|
1646
|
+
return ret;
|
|
1647
|
+
},
|
|
1648
|
+
__wbg_randomFillSync_6c25eac9869eb53c: function() { return handleError(function (arg0, arg1) {
|
|
1649
|
+
arg0.randomFillSync(arg1);
|
|
1650
|
+
}, arguments); },
|
|
1651
|
+
__wbg_require_b4edbdcf3e2a1ef0: function() { return handleError(function () {
|
|
1652
|
+
const ret = module.require;
|
|
1653
|
+
return ret;
|
|
1654
|
+
}, arguments); },
|
|
1655
|
+
__wbg_resolve_020f95d838c6ef25: function(arg0) {
|
|
1656
|
+
const ret = Promise.resolve(arg0);
|
|
1657
|
+
return ret;
|
|
1658
|
+
},
|
|
1659
|
+
__wbg_set_014226dfeca53178: function(arg0, arg1, arg2) {
|
|
1660
|
+
const ret = arg0.set(arg1, arg2);
|
|
1661
|
+
return ret;
|
|
1662
|
+
},
|
|
1663
|
+
__wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
|
|
1664
|
+
arg0[arg1] = arg2;
|
|
1665
|
+
},
|
|
1666
|
+
__wbg_set_8155bb79a948541b: function() { return handleError(function (arg0, arg1, arg2) {
|
|
1667
|
+
const ret = Reflect.set(arg0, arg1, arg2);
|
|
1668
|
+
return ret;
|
|
1669
|
+
}, arguments); },
|
|
1670
|
+
__wbg_set_a80955eb93b145c6: function(arg0, arg1, arg2) {
|
|
1671
|
+
arg0[arg1 >>> 0] = arg2;
|
|
1672
|
+
},
|
|
1673
|
+
__wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
|
|
1674
|
+
const ret = arg1.stack;
|
|
1675
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1676
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1677
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1678
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1679
|
+
},
|
|
1680
|
+
__wbg_static_accessor_GLOBAL_THIS_466428f93b4eaa76: function() {
|
|
1681
|
+
const ret = typeof globalThis === 'undefined' ? null : globalThis;
|
|
1682
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
1683
|
+
},
|
|
1684
|
+
__wbg_static_accessor_GLOBAL_c7aea38d4de089bc: function() {
|
|
1685
|
+
const ret = typeof global === 'undefined' ? null : global;
|
|
1686
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
1687
|
+
},
|
|
1688
|
+
__wbg_static_accessor_SELF_42d4fae05e59267a: function() {
|
|
1689
|
+
const ret = typeof self === 'undefined' ? null : self;
|
|
1690
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
1691
|
+
},
|
|
1692
|
+
__wbg_static_accessor_WINDOW_e0db14a0eba6a812: function() {
|
|
1693
|
+
const ret = typeof window === 'undefined' ? null : window;
|
|
1694
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
1695
|
+
},
|
|
1696
|
+
__wbg_subarray_a4cc58201c7359fd: function(arg0, arg1, arg2) {
|
|
1697
|
+
const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
|
|
1698
|
+
return ret;
|
|
1699
|
+
},
|
|
1700
|
+
__wbg_then_7026b513a94278a8: function(arg0, arg1) {
|
|
1701
|
+
const ret = arg0.then(arg1);
|
|
1702
|
+
return ret;
|
|
1703
|
+
},
|
|
1704
|
+
__wbg_then_72819b8d4e081fb5: function(arg0, arg1, arg2) {
|
|
1705
|
+
const ret = arg0.then(arg1, arg2);
|
|
1706
|
+
return ret;
|
|
1707
|
+
},
|
|
1708
|
+
__wbg_toString_76752bc853683831: function() { return handleError(function (arg0, arg1) {
|
|
1709
|
+
const ret = arg0.toString(arg1);
|
|
1710
|
+
return ret;
|
|
1711
|
+
}, arguments); },
|
|
1712
|
+
__wbg_toString_effe882d0e9af91c: function(arg0, arg1, arg2) {
|
|
1713
|
+
const ret = arg1.toString(arg2);
|
|
1714
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1715
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1716
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1717
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1718
|
+
},
|
|
1719
|
+
__wbg_value_1e2369fab29b420e: function(arg0) {
|
|
1720
|
+
const ret = arg0.value;
|
|
1721
|
+
return ret;
|
|
1722
|
+
},
|
|
1723
|
+
__wbg_versions_276b2795b1c6a219: function(arg0) {
|
|
1724
|
+
const ret = arg0.versions;
|
|
1725
|
+
return ret;
|
|
1726
|
+
},
|
|
1727
|
+
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
1728
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 380, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
1729
|
+
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h379e0770a020d351);
|
|
1730
|
+
return ret;
|
|
1731
|
+
},
|
|
1732
|
+
__wbindgen_cast_0000000000000002: function(arg0) {
|
|
1733
|
+
// Cast intrinsic for `F64 -> Externref`.
|
|
1734
|
+
const ret = arg0;
|
|
1735
|
+
return ret;
|
|
1736
|
+
},
|
|
1737
|
+
__wbindgen_cast_0000000000000003: function(arg0) {
|
|
1738
|
+
// Cast intrinsic for `I64 -> Externref`.
|
|
1739
|
+
const ret = arg0;
|
|
1740
|
+
return ret;
|
|
1741
|
+
},
|
|
1742
|
+
__wbindgen_cast_0000000000000004: function(arg0, arg1) {
|
|
1743
|
+
// Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
|
|
1744
|
+
const ret = getArrayU8FromWasm0(arg0, arg1);
|
|
1745
|
+
return ret;
|
|
1746
|
+
},
|
|
1747
|
+
__wbindgen_cast_0000000000000005: function(arg0, arg1) {
|
|
1748
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
1749
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
1750
|
+
return ret;
|
|
1751
|
+
},
|
|
1752
|
+
__wbindgen_cast_0000000000000006: function(arg0) {
|
|
1753
|
+
// Cast intrinsic for `U64 -> Externref`.
|
|
1754
|
+
const ret = BigInt.asUintN(64, arg0);
|
|
1755
|
+
return ret;
|
|
1756
|
+
},
|
|
1757
|
+
__wbindgen_init_externref_table: function() {
|
|
1758
|
+
const table = wasm.__wbindgen_externrefs;
|
|
1759
|
+
const offset = table.grow(4);
|
|
1760
|
+
table.set(0, undefined);
|
|
1761
|
+
table.set(offset + 0, undefined);
|
|
1762
|
+
table.set(offset + 1, null);
|
|
1763
|
+
table.set(offset + 2, true);
|
|
1764
|
+
table.set(offset + 3, false);
|
|
1765
|
+
},
|
|
1766
|
+
};
|
|
1767
|
+
return {
|
|
1768
|
+
__proto__: null,
|
|
1769
|
+
"./derec_library_bg.js": import0,
|
|
1770
|
+
};
|
|
1771
|
+
}
|
|
1772
|
+
|
|
1773
|
+
function wasm_bindgen__convert__closures_____invoke__h379e0770a020d351(arg0, arg1, arg2) {
|
|
1774
|
+
const ret = wasm.wasm_bindgen__convert__closures_____invoke__h379e0770a020d351(arg0, arg1, arg2);
|
|
1775
|
+
if (ret[1]) {
|
|
1776
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
1777
|
+
}
|
|
1778
|
+
}
|
|
1779
|
+
|
|
1780
|
+
function wasm_bindgen__convert__closures_____invoke__h037700d3f721a480(arg0, arg1, arg2, arg3) {
|
|
1781
|
+
wasm.wasm_bindgen__convert__closures_____invoke__h037700d3f721a480(arg0, arg1, arg2, arg3);
|
|
1782
|
+
}
|
|
1783
|
+
|
|
1784
|
+
const DeRecProtocolBuilderFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1785
|
+
? { register: () => {}, unregister: () => {} }
|
|
1786
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_derecprotocolbuilder_free(ptr, 1));
|
|
1787
|
+
const DeRecProtocolWasmFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1788
|
+
? { register: () => {}, unregister: () => {} }
|
|
1789
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_derecprotocolwasm_free(ptr, 1));
|
|
1790
|
+
|
|
1791
|
+
function addToExternrefTable0(obj) {
|
|
1792
|
+
const idx = wasm.__externref_table_alloc();
|
|
1793
|
+
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
1794
|
+
return idx;
|
|
1795
|
+
}
|
|
1796
|
+
|
|
1797
|
+
const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
|
|
1798
|
+
? { register: () => {}, unregister: () => {} }
|
|
1799
|
+
: new FinalizationRegistry(state => wasm.__wbindgen_destroy_closure(state.a, state.b));
|
|
1800
|
+
|
|
1801
|
+
function debugString(val) {
|
|
1802
|
+
// primitive types
|
|
1803
|
+
const type = typeof val;
|
|
1804
|
+
if (type == 'number' || type == 'boolean' || val == null) {
|
|
1805
|
+
return `${val}`;
|
|
1806
|
+
}
|
|
1807
|
+
if (type == 'string') {
|
|
1808
|
+
return `"${val}"`;
|
|
1809
|
+
}
|
|
1810
|
+
if (type == 'symbol') {
|
|
1811
|
+
const description = val.description;
|
|
1812
|
+
if (description == null) {
|
|
1813
|
+
return 'Symbol';
|
|
1814
|
+
} else {
|
|
1815
|
+
return `Symbol(${description})`;
|
|
1816
|
+
}
|
|
1817
|
+
}
|
|
1818
|
+
if (type == 'function') {
|
|
1819
|
+
const name = val.name;
|
|
1820
|
+
if (typeof name == 'string' && name.length > 0) {
|
|
1821
|
+
return `Function(${name})`;
|
|
1822
|
+
} else {
|
|
1823
|
+
return 'Function';
|
|
1824
|
+
}
|
|
1825
|
+
}
|
|
1826
|
+
// objects
|
|
1827
|
+
if (Array.isArray(val)) {
|
|
1828
|
+
const length = val.length;
|
|
1829
|
+
let debug = '[';
|
|
1830
|
+
if (length > 0) {
|
|
1831
|
+
debug += debugString(val[0]);
|
|
1832
|
+
}
|
|
1833
|
+
for(let i = 1; i < length; i++) {
|
|
1834
|
+
debug += ', ' + debugString(val[i]);
|
|
1835
|
+
}
|
|
1836
|
+
debug += ']';
|
|
1837
|
+
return debug;
|
|
1838
|
+
}
|
|
1839
|
+
// Test for built-in
|
|
1840
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
1841
|
+
let className;
|
|
1842
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
1843
|
+
className = builtInMatches[1];
|
|
1844
|
+
} else {
|
|
1845
|
+
// Failed to match the standard '[object ClassName]'
|
|
1846
|
+
return toString.call(val);
|
|
1847
|
+
}
|
|
1848
|
+
if (className == 'Object') {
|
|
1849
|
+
// we're a user defined class or Object
|
|
1850
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
1851
|
+
// easier than looping through ownProperties of `val`.
|
|
1852
|
+
try {
|
|
1853
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
1854
|
+
} catch (_) {
|
|
1855
|
+
return 'Object';
|
|
1856
|
+
}
|
|
1857
|
+
}
|
|
1858
|
+
// errors
|
|
1859
|
+
if (val instanceof Error) {
|
|
1860
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
1861
|
+
}
|
|
1862
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
1863
|
+
return className;
|
|
1864
|
+
}
|
|
1865
|
+
|
|
1866
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
1867
|
+
ptr = ptr >>> 0;
|
|
1868
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
1869
|
+
}
|
|
1870
|
+
|
|
1871
|
+
let cachedDataViewMemory0 = null;
|
|
1872
|
+
function getDataViewMemory0() {
|
|
1873
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
1874
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
1875
|
+
}
|
|
1876
|
+
return cachedDataViewMemory0;
|
|
1877
|
+
}
|
|
1878
|
+
|
|
1879
|
+
function getStringFromWasm0(ptr, len) {
|
|
1880
|
+
return decodeText(ptr >>> 0, len);
|
|
1881
|
+
}
|
|
1882
|
+
|
|
1883
|
+
let cachedUint8ArrayMemory0 = null;
|
|
1884
|
+
function getUint8ArrayMemory0() {
|
|
1885
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
1886
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
1887
|
+
}
|
|
1888
|
+
return cachedUint8ArrayMemory0;
|
|
1889
|
+
}
|
|
1890
|
+
|
|
1891
|
+
function handleError(f, args) {
|
|
1892
|
+
try {
|
|
1893
|
+
return f.apply(this, args);
|
|
1894
|
+
} catch (e) {
|
|
1895
|
+
const idx = addToExternrefTable0(e);
|
|
1896
|
+
wasm.__wbindgen_exn_store(idx);
|
|
1897
|
+
}
|
|
1898
|
+
}
|
|
1899
|
+
|
|
1900
|
+
function isLikeNone(x) {
|
|
1901
|
+
return x === undefined || x === null;
|
|
1902
|
+
}
|
|
1903
|
+
|
|
1904
|
+
function makeMutClosure(arg0, arg1, f) {
|
|
1905
|
+
const state = { a: arg0, b: arg1, cnt: 1 };
|
|
1906
|
+
const real = (...args) => {
|
|
1907
|
+
|
|
1908
|
+
// First up with a closure we increment the internal reference
|
|
1909
|
+
// count. This ensures that the Rust closure environment won't
|
|
1910
|
+
// be deallocated while we're invoking it.
|
|
1911
|
+
state.cnt++;
|
|
1912
|
+
const a = state.a;
|
|
1913
|
+
state.a = 0;
|
|
1914
|
+
try {
|
|
1915
|
+
return f(a, state.b, ...args);
|
|
1916
|
+
} finally {
|
|
1917
|
+
state.a = a;
|
|
1918
|
+
real._wbg_cb_unref();
|
|
1919
|
+
}
|
|
1920
|
+
};
|
|
1921
|
+
real._wbg_cb_unref = () => {
|
|
1922
|
+
if (--state.cnt === 0) {
|
|
1923
|
+
wasm.__wbindgen_destroy_closure(state.a, state.b);
|
|
1924
|
+
state.a = 0;
|
|
1925
|
+
CLOSURE_DTORS.unregister(state);
|
|
1926
|
+
}
|
|
1927
|
+
};
|
|
1928
|
+
CLOSURE_DTORS.register(real, state, state);
|
|
1929
|
+
return real;
|
|
1930
|
+
}
|
|
1931
|
+
|
|
1932
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
1933
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
1934
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
1935
|
+
WASM_VECTOR_LEN = arg.length;
|
|
1936
|
+
return ptr;
|
|
1937
|
+
}
|
|
1938
|
+
|
|
1939
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
1940
|
+
if (realloc === undefined) {
|
|
1941
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
1942
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
1943
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
1944
|
+
WASM_VECTOR_LEN = buf.length;
|
|
1945
|
+
return ptr;
|
|
1946
|
+
}
|
|
1947
|
+
|
|
1948
|
+
let len = arg.length;
|
|
1949
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
1950
|
+
|
|
1951
|
+
const mem = getUint8ArrayMemory0();
|
|
1952
|
+
|
|
1953
|
+
let offset = 0;
|
|
1954
|
+
|
|
1955
|
+
for (; offset < len; offset++) {
|
|
1956
|
+
const code = arg.charCodeAt(offset);
|
|
1957
|
+
if (code > 0x7F) break;
|
|
1958
|
+
mem[ptr + offset] = code;
|
|
1959
|
+
}
|
|
1960
|
+
if (offset !== len) {
|
|
1961
|
+
if (offset !== 0) {
|
|
1962
|
+
arg = arg.slice(offset);
|
|
1963
|
+
}
|
|
1964
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
1965
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
1966
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
1967
|
+
|
|
1968
|
+
offset += ret.written;
|
|
1969
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
1970
|
+
}
|
|
1971
|
+
|
|
1972
|
+
WASM_VECTOR_LEN = offset;
|
|
1973
|
+
return ptr;
|
|
1974
|
+
}
|
|
1975
|
+
|
|
1976
|
+
function takeFromExternrefTable0(idx) {
|
|
1977
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
1978
|
+
wasm.__externref_table_dealloc(idx);
|
|
1979
|
+
return value;
|
|
1980
|
+
}
|
|
1981
|
+
|
|
1982
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
1983
|
+
cachedTextDecoder.decode();
|
|
1984
|
+
function decodeText(ptr, len) {
|
|
1985
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
1986
|
+
}
|
|
1987
|
+
|
|
1988
|
+
const cachedTextEncoder = new TextEncoder();
|
|
1989
|
+
|
|
1990
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
1991
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
1992
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
1993
|
+
view.set(buf);
|
|
1994
|
+
return {
|
|
1995
|
+
read: arg.length,
|
|
1996
|
+
written: buf.length
|
|
1997
|
+
};
|
|
1998
|
+
};
|
|
1999
|
+
}
|
|
2000
|
+
|
|
2001
|
+
let WASM_VECTOR_LEN = 0;
|
|
2002
|
+
|
|
2003
|
+
const wasmPath = `${__dirname}/derec_library_bg.wasm`;
|
|
2004
|
+
const wasmBytes = require('fs').readFileSync(wasmPath);
|
|
2005
|
+
const wasmModule = new WebAssembly.Module(wasmBytes);
|
|
2006
|
+
let wasmInstance = new WebAssembly.Instance(wasmModule, __wbg_get_imports());
|
|
2007
|
+
let wasm = wasmInstance.exports;
|
|
2008
|
+
wasm.__wbindgen_start();
|