@ping-app/ping-openmls-sdk 0.10.3 → 0.10.4
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 +13 -10
- package/dist/index.cjs +1359 -274
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +968 -146
- package/dist/index.d.ts +968 -146
- package/dist/index.js +1319 -271
- package/dist/index.js.map +1 -1
- package/dist/notification-preview.cjs +1 -3
- package/dist/notification-preview.cjs.map +1 -1
- package/dist/notification-preview.d.cts +1 -8
- package/dist/notification-preview.d.ts +1 -8
- package/dist/notification-preview.js +1 -3
- package/dist/notification-preview.js.map +1 -1
- package/dist/storage/indexeddb.cjs +4 -3
- package/dist/storage/indexeddb.cjs.map +1 -1
- package/dist/storage/indexeddb.d.cts +1 -1
- package/dist/storage/indexeddb.d.ts +1 -1
- package/dist/storage/indexeddb.js +4 -3
- package/dist/storage/indexeddb.js.map +1 -1
- package/dist/transport/websocket.d.cts +1 -1
- package/dist/transport/websocket.d.ts +1 -1
- package/dist/{types-BOXvsHgp.d.cts → types-omhvRjtq.d.cts} +314 -45
- package/dist/{types-BOXvsHgp.d.ts → types-omhvRjtq.d.ts} +314 -45
- package/dist/worker.cjs +685 -70
- package/dist/worker.cjs.map +1 -1
- package/dist/worker.js +714 -81
- package/dist/worker.js.map +1 -1
- package/package.json +1 -1
- package/wasm/package.json +1 -1
- package/wasm/ping_wasm.d.ts +524 -115
- package/wasm/ping_wasm.js +1369 -342
- package/wasm/ping_wasm_bg.wasm +0 -0
- package/wasm/ping_wasm_bg.wasm.d.ts +73 -21
package/wasm/ping_wasm.js
CHANGED
|
@@ -1,5 +1,185 @@
|
|
|
1
1
|
/* @ts-self-types="./ping_wasm.d.ts" */
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* A set-up session whose root is in memory only (rule R34 a): for the
|
|
5
|
+
* person who makes the backup during set-up. Freeing it wipes the root.
|
|
6
|
+
*/
|
|
7
|
+
export class AccountSetupSession {
|
|
8
|
+
static __wrap(ptr) {
|
|
9
|
+
const obj = Object.create(AccountSetupSession.prototype);
|
|
10
|
+
obj.__wbg_ptr = ptr;
|
|
11
|
+
AccountSetupSessionFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
12
|
+
return obj;
|
|
13
|
+
}
|
|
14
|
+
__destroy_into_raw() {
|
|
15
|
+
const ptr = this.__wbg_ptr;
|
|
16
|
+
this.__wbg_ptr = 0;
|
|
17
|
+
AccountSetupSessionFinalization.unregister(this);
|
|
18
|
+
return ptr;
|
|
19
|
+
}
|
|
20
|
+
free() {
|
|
21
|
+
const ptr = this.__destroy_into_raw();
|
|
22
|
+
wasm.__wbg_accountsetupsession_free(ptr, 0);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* End the session after the proof: writes the device record, wipes
|
|
26
|
+
* the root and answers what the host registers with the server.
|
|
27
|
+
* Before a proof it refuses and the session stays open.
|
|
28
|
+
* @param {JsStorage} storage
|
|
29
|
+
* @returns {Promise<any>}
|
|
30
|
+
*/
|
|
31
|
+
finish(storage) {
|
|
32
|
+
const ret = wasm.accountsetupsession_finish(this.__wbg_ptr, addHeapObject(storage));
|
|
33
|
+
return takeObject(ret);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* "Not now" after the session began (ruling ID42): writes THIS
|
|
37
|
+
* session's root as the pending item, then the device record.
|
|
38
|
+
* @param {JsStorage} storage
|
|
39
|
+
* @param {JsPendingRootStore} pending
|
|
40
|
+
* @param {string} slot
|
|
41
|
+
* @param {boolean | null} [persistent_storage]
|
|
42
|
+
* @returns {Promise<any>}
|
|
43
|
+
*/
|
|
44
|
+
keepAsPending(storage, pending, slot, persistent_storage) {
|
|
45
|
+
const ptr0 = passStringToWasm0(slot, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
46
|
+
const len0 = WASM_VECTOR_LEN;
|
|
47
|
+
const ret = wasm.accountsetupsession_keepAsPending(this.__wbg_ptr, addHeapObject(storage), addHeapObject(pending), ptr0, len0, isLikeNone(persistent_storage) ? 0xFFFFFF : persistent_storage ? 1 : 0);
|
|
48
|
+
return takeObject(ret);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* The session's backup: `{ rootPart, statePart, droppedAnchors }`.
|
|
52
|
+
* @param {Uint8Array} phrase
|
|
53
|
+
* @param {Uint8Array} account_id
|
|
54
|
+
* @param {Uint8Array} host_state
|
|
55
|
+
* @param {number} now_ms
|
|
56
|
+
* @returns {any}
|
|
57
|
+
*/
|
|
58
|
+
makeBackup(phrase, account_id, host_state, now_ms) {
|
|
59
|
+
try {
|
|
60
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
61
|
+
const ptr0 = passArray8ToWasm0(phrase, wasm.__wbindgen_export);
|
|
62
|
+
const len0 = WASM_VECTOR_LEN;
|
|
63
|
+
const ptr1 = passArray8ToWasm0(account_id, wasm.__wbindgen_export);
|
|
64
|
+
const len1 = WASM_VECTOR_LEN;
|
|
65
|
+
const ptr2 = passArray8ToWasm0(host_state, wasm.__wbindgen_export);
|
|
66
|
+
const len2 = WASM_VECTOR_LEN;
|
|
67
|
+
wasm.accountsetupsession_makeBackup(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, now_ms);
|
|
68
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
69
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
70
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
71
|
+
if (r2) {
|
|
72
|
+
throw takeObject(r1);
|
|
73
|
+
}
|
|
74
|
+
return takeObject(r0);
|
|
75
|
+
} finally {
|
|
76
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Rule R10 (b) for the session. Answers `{ fingerprint }`.
|
|
81
|
+
* @param {Uint8Array} read_back_root_part
|
|
82
|
+
* @param {Uint8Array} phrase
|
|
83
|
+
* @returns {any}
|
|
84
|
+
*/
|
|
85
|
+
proveBackup(read_back_root_part, phrase) {
|
|
86
|
+
try {
|
|
87
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
88
|
+
const ptr0 = passArray8ToWasm0(read_back_root_part, wasm.__wbindgen_export);
|
|
89
|
+
const len0 = WASM_VECTOR_LEN;
|
|
90
|
+
const ptr1 = passArray8ToWasm0(phrase, wasm.__wbindgen_export);
|
|
91
|
+
const len1 = WASM_VECTOR_LEN;
|
|
92
|
+
wasm.accountsetupsession_proveBackup(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
93
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
94
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
95
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
96
|
+
if (r2) {
|
|
97
|
+
throw takeObject(r1);
|
|
98
|
+
}
|
|
99
|
+
return takeObject(r0);
|
|
100
|
+
} finally {
|
|
101
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
if (Symbol.dispose) AccountSetupSession.prototype[Symbol.dispose] = AccountSetupSession.prototype.free;
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* What `beginDeviceLink` answers: the staging client (taken once), the
|
|
109
|
+
* handshake payload, and the two secret halves the call drew.
|
|
110
|
+
*/
|
|
111
|
+
export class DeviceLinkBegun {
|
|
112
|
+
static __wrap(ptr) {
|
|
113
|
+
const obj = Object.create(DeviceLinkBegun.prototype);
|
|
114
|
+
obj.__wbg_ptr = ptr;
|
|
115
|
+
DeviceLinkBegunFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
116
|
+
return obj;
|
|
117
|
+
}
|
|
118
|
+
__destroy_into_raw() {
|
|
119
|
+
const ptr = this.__wbg_ptr;
|
|
120
|
+
this.__wbg_ptr = 0;
|
|
121
|
+
DeviceLinkBegunFinalization.unregister(this);
|
|
122
|
+
return ptr;
|
|
123
|
+
}
|
|
124
|
+
free() {
|
|
125
|
+
const ptr = this.__destroy_into_raw();
|
|
126
|
+
wasm.__wbg_devicelinkbegun_free(ptr, 0);
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* @returns {Uint8Array}
|
|
130
|
+
*/
|
|
131
|
+
get deviceId() {
|
|
132
|
+
const ret = wasm.devicelinkbegun_deviceId(this.__wbg_ptr);
|
|
133
|
+
return takeObject(ret);
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* A SECRET: the device key the call drew, for the host's protected store.
|
|
137
|
+
* @returns {Uint8Array}
|
|
138
|
+
*/
|
|
139
|
+
get deviceSigningSecretKey() {
|
|
140
|
+
const ret = wasm.devicelinkbegun_deviceSigningSecretKey(this.__wbg_ptr);
|
|
141
|
+
return takeObject(ret);
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* A SECRET: the X-Wing seed the ticket and the link envelope are sealed to.
|
|
145
|
+
* @returns {Uint8Array}
|
|
146
|
+
*/
|
|
147
|
+
get hpkeSecretKey() {
|
|
148
|
+
const ret = wasm.devicelinkbegun_hpkeSecretKey(this.__wbg_ptr);
|
|
149
|
+
return takeObject(ret);
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* The handshake payload, version 3: publish exactly these bytes and
|
|
153
|
+
* show `linkCommitment` of exactly these bytes.
|
|
154
|
+
* @returns {Uint8Array}
|
|
155
|
+
*/
|
|
156
|
+
get payload() {
|
|
157
|
+
const ret = wasm.devicelinkbegun_payload(this.__wbg_ptr);
|
|
158
|
+
return takeObject(ret);
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* The staging client: it completes the link and is then freed. Taken
|
|
162
|
+
* once; a second call rejects.
|
|
163
|
+
* @returns {PingClient}
|
|
164
|
+
*/
|
|
165
|
+
takeClient() {
|
|
166
|
+
try {
|
|
167
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
168
|
+
wasm.devicelinkbegun_takeClient(retptr, this.__wbg_ptr);
|
|
169
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
170
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
171
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
172
|
+
if (r2) {
|
|
173
|
+
throw takeObject(r1);
|
|
174
|
+
}
|
|
175
|
+
return PingClient.__wrap(r0);
|
|
176
|
+
} finally {
|
|
177
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
if (Symbol.dispose) DeviceLinkBegun.prototype[Symbol.dispose] = DeviceLinkBegun.prototype.free;
|
|
182
|
+
|
|
3
183
|
export class PingClient {
|
|
4
184
|
static __wrap(ptr) {
|
|
5
185
|
const obj = Object.create(PingClient.prototype);
|
|
@@ -53,6 +233,29 @@ export class PingClient {
|
|
|
53
233
|
const ret = wasm.pingclient_addMembersWithVerdicts(this.__wbg_ptr, ptr0, len0, addHeapObject(entries), now_ms);
|
|
54
234
|
return takeObject(ret);
|
|
55
235
|
}
|
|
236
|
+
/**
|
|
237
|
+
* The one tap after a restore beside devices that stay: the
|
|
238
|
+
* device named `device_id`, which restored with the recovery phrase
|
|
239
|
+
* beside this one and waits for its DeviceGroup, added by this KEPT
|
|
240
|
+
* device at the person's tap (`ping_core`
|
|
241
|
+
* `MessagingClient::add_restored_device`; ruling V123's other half).
|
|
242
|
+
* `key_package` is a KeyPackage of that device as the host fetched it;
|
|
243
|
+
* it is believed only when its credential verifies for this device's
|
|
244
|
+
* own account root, at depth 0 and at the generation this device
|
|
245
|
+
* holds. Rejects with the core's refusal otherwise.
|
|
246
|
+
* @param {Uint8Array} device_id
|
|
247
|
+
* @param {Uint8Array} key_package
|
|
248
|
+
* @param {number} now_ms
|
|
249
|
+
* @returns {Promise<void>}
|
|
250
|
+
*/
|
|
251
|
+
addRestoredDevice(device_id, key_package, now_ms) {
|
|
252
|
+
const ptr0 = passArray8ToWasm0(device_id, wasm.__wbindgen_export);
|
|
253
|
+
const len0 = WASM_VECTOR_LEN;
|
|
254
|
+
const ptr1 = passArray8ToWasm0(key_package, wasm.__wbindgen_export);
|
|
255
|
+
const len1 = WASM_VECTOR_LEN;
|
|
256
|
+
const ret = wasm.pingclient_addRestoredDevice(this.__wbg_ptr, ptr0, len0, ptr1, len1, now_ms);
|
|
257
|
+
return takeObject(ret);
|
|
258
|
+
}
|
|
56
259
|
/**
|
|
57
260
|
* Admit a single new device to every chat in `entries` — one Commit +
|
|
58
261
|
* one Welcome per chat, with the Welcome's `?recipient=` priming
|
|
@@ -94,6 +297,37 @@ export class PingClient {
|
|
|
94
297
|
const ret = wasm.pingclient_admitDeviceToChatsConcurrent(this.__wbg_ptr, ptr0, len0, addHeapObject(entries), now_ms, concurrency);
|
|
95
298
|
return takeObject(ret);
|
|
96
299
|
}
|
|
300
|
+
/**
|
|
301
|
+
* Step 7 (`ping_recovery::adopt_generation`): this device's mailbox
|
|
302
|
+
* row. The credential must be this device's, the root's own, of the
|
|
303
|
+
* row's generation; the wrap must open with this device's delivery
|
|
304
|
+
* key and match the root's statement. Answers `{ generation, changed
|
|
305
|
+
* }`. On any refusal the device stays on its generation.
|
|
306
|
+
* @param {number} generation
|
|
307
|
+
* @param {Uint8Array} credential
|
|
308
|
+
* @param {Uint8Array} gs_wrap
|
|
309
|
+
* @param {any} statement
|
|
310
|
+
* @param {number} now_ms
|
|
311
|
+
* @returns {Promise<any>}
|
|
312
|
+
*/
|
|
313
|
+
adoptGeneration(generation, credential, gs_wrap, statement, now_ms) {
|
|
314
|
+
const ptr0 = passArray8ToWasm0(credential, wasm.__wbindgen_export);
|
|
315
|
+
const len0 = WASM_VECTOR_LEN;
|
|
316
|
+
const ptr1 = passArray8ToWasm0(gs_wrap, wasm.__wbindgen_export);
|
|
317
|
+
const len1 = WASM_VECTOR_LEN;
|
|
318
|
+
const ret = wasm.pingclient_adoptGeneration(this.__wbg_ptr, generation, ptr0, len0, ptr1, len1, addHeapObject(statement), now_ms);
|
|
319
|
+
return takeObject(ret);
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* The server refused the publication and answered with the statement it
|
|
323
|
+
* holds: taken only when it verifies under THIS device's own key.
|
|
324
|
+
* @param {any} stored
|
|
325
|
+
* @returns {Promise<any>}
|
|
326
|
+
*/
|
|
327
|
+
adoptHistoryDeliveryKeyCounter(stored) {
|
|
328
|
+
const ret = wasm.pingclient_adoptHistoryDeliveryKeyCounter(this.__wbg_ptr, addHeapObject(stored));
|
|
329
|
+
return takeObject(ret);
|
|
330
|
+
}
|
|
97
331
|
/**
|
|
98
332
|
* Anchor an unanchored cursor at a host-recorded `(epoch, server_seq)`
|
|
99
333
|
* (`MessagingClient::adopt_log_position`). Resolves `false` when the
|
|
@@ -110,22 +344,26 @@ export class PingClient {
|
|
|
110
344
|
return takeObject(ret);
|
|
111
345
|
}
|
|
112
346
|
/**
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
* @param {Uint8Array}
|
|
347
|
+
* The linking ticket, version 3, for the handshake `payload`, verified
|
|
348
|
+
* here against `expected_code` or `expected_qr` (exactly one). For a
|
|
349
|
+
* client started from a device record: the new device's credential is
|
|
350
|
+
* signed by THIS device's key. `last_app_events` as for the version 2
|
|
351
|
+
* ticket.
|
|
352
|
+
* @param {Uint8Array} payload
|
|
353
|
+
* @param {string | null | undefined} expected_code
|
|
354
|
+
* @param {Uint8Array | null | undefined} expected_qr
|
|
119
355
|
* @param {any} last_app_events
|
|
120
356
|
* @param {number} now_ms
|
|
121
357
|
* @returns {Promise<any>}
|
|
122
358
|
*/
|
|
123
|
-
|
|
124
|
-
const ptr0 = passArray8ToWasm0(
|
|
359
|
+
buildLinkingTicketV3For(payload, expected_code, expected_qr, last_app_events, now_ms) {
|
|
360
|
+
const ptr0 = passArray8ToWasm0(payload, wasm.__wbindgen_export);
|
|
125
361
|
const len0 = WASM_VECTOR_LEN;
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
362
|
+
var ptr1 = isLikeNone(expected_code) ? 0 : passStringToWasm0(expected_code, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
363
|
+
var len1 = WASM_VECTOR_LEN;
|
|
364
|
+
var ptr2 = isLikeNone(expected_qr) ? 0 : passArray8ToWasm0(expected_qr, wasm.__wbindgen_export);
|
|
365
|
+
var len2 = WASM_VECTOR_LEN;
|
|
366
|
+
const ret = wasm.pingclient_buildLinkingTicketV3For(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, addHeapObject(last_app_events), now_ms);
|
|
129
367
|
return takeObject(ret);
|
|
130
368
|
}
|
|
131
369
|
/**
|
|
@@ -161,6 +399,41 @@ export class PingClient {
|
|
|
161
399
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
162
400
|
}
|
|
163
401
|
}
|
|
402
|
+
/**
|
|
403
|
+
* Complete the link on the NEW device, on the staging client of
|
|
404
|
+
* `beginDeviceLink` and its store: every check of the ticket and of the
|
|
405
|
+
* envelope's two values, then the DeviceGroup, then the device record
|
|
406
|
+
* (`ping_recovery::complete_device_link`). Rejects with `account
|
|
407
|
+
* refused: link-refused` when anything does not fit: nothing was kept.
|
|
408
|
+
* Answers `{ userId, deviceId, generation, depth }`.
|
|
409
|
+
* @param {any} ticket
|
|
410
|
+
* @param {number} generation
|
|
411
|
+
* @param {Uint8Array} generation_secret
|
|
412
|
+
* @param {number} now_ms
|
|
413
|
+
* @returns {Promise<any>}
|
|
414
|
+
*/
|
|
415
|
+
completeDeviceLink(ticket, generation, generation_secret, now_ms) {
|
|
416
|
+
const ptr0 = passArray8ToWasm0(generation_secret, wasm.__wbindgen_export);
|
|
417
|
+
const len0 = WASM_VECTOR_LEN;
|
|
418
|
+
const ret = wasm.pingclient_completeDeviceLink(this.__wbg_ptr, addHeapObject(ticket), generation, ptr0, len0, now_ms);
|
|
419
|
+
return takeObject(ret);
|
|
420
|
+
}
|
|
421
|
+
/**
|
|
422
|
+
* Step 3 on the running client (`ping_recovery::complete_rotation_on`):
|
|
423
|
+
* the server's answer to a rotation this device built, AS RECEIVED:
|
|
424
|
+
* `{ status, error?, generation?, statement? }`, judged inside (ruling
|
|
425
|
+
* V161; no value says "applied"). When the device adopts, this client
|
|
426
|
+
* runs on the new record from that moment.
|
|
427
|
+
* @param {Uint8Array} record_id
|
|
428
|
+
* @param {any} answer
|
|
429
|
+
* @returns {Promise<any>}
|
|
430
|
+
*/
|
|
431
|
+
completeRotation(record_id, answer) {
|
|
432
|
+
const ptr0 = passArray8ToWasm0(record_id, wasm.__wbindgen_export);
|
|
433
|
+
const len0 = WASM_VECTOR_LEN;
|
|
434
|
+
const ret = wasm.pingclient_completeRotation(this.__wbg_ptr, ptr0, len0, addHeapObject(answer));
|
|
435
|
+
return takeObject(ret);
|
|
436
|
+
}
|
|
164
437
|
/**
|
|
165
438
|
* [D27] Delete journal entries whose messages the host has durably
|
|
166
439
|
* persisted, and checkpoint so the deletion survives a reload. Unknown
|
|
@@ -175,12 +448,17 @@ export class PingClient {
|
|
|
175
448
|
return takeObject(ret);
|
|
176
449
|
}
|
|
177
450
|
/**
|
|
178
|
-
*
|
|
179
|
-
*
|
|
180
|
-
*
|
|
451
|
+
* Ruling V177: the host has saved the events of the bundle an open
|
|
452
|
+
* returned with `import_id`; from now on that bundle is refused as a
|
|
453
|
+
* replay. `true` when this call recorded it. Until this call the same
|
|
454
|
+
* transfer opens again as often as it is delivered.
|
|
455
|
+
* @param {Uint8Array} import_id
|
|
456
|
+
* @returns {Promise<boolean>}
|
|
181
457
|
*/
|
|
182
|
-
|
|
183
|
-
const
|
|
458
|
+
confirmHistoryImport(import_id) {
|
|
459
|
+
const ptr0 = passArray8ToWasm0(import_id, wasm.__wbindgen_export);
|
|
460
|
+
const len0 = WASM_VECTOR_LEN;
|
|
461
|
+
const ret = wasm.pingclient_confirmHistoryImport(this.__wbg_ptr, ptr0, len0);
|
|
184
462
|
return takeObject(ret);
|
|
185
463
|
}
|
|
186
464
|
/**
|
|
@@ -495,25 +773,6 @@ export class PingClient {
|
|
|
495
773
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
496
774
|
}
|
|
497
775
|
}
|
|
498
|
-
/**
|
|
499
|
-
* Export the account identity seed (CBOR-wrapped Ed25519, SECRET). Transfer
|
|
500
|
-
* to a newly-linked device over the sealed channel so all of an account's
|
|
501
|
-
* devices share one user_id (basis for cross-device self-attribution).
|
|
502
|
-
* @returns {Uint8Array}
|
|
503
|
-
*/
|
|
504
|
-
exportIdentity() {
|
|
505
|
-
try {
|
|
506
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
507
|
-
wasm.pingclient_exportIdentity(retptr, this.__wbg_ptr);
|
|
508
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
509
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
510
|
-
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
511
|
-
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
512
|
-
return v1;
|
|
513
|
-
} finally {
|
|
514
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
515
|
-
}
|
|
516
|
-
}
|
|
517
776
|
/**
|
|
518
777
|
* @returns {Promise<Uint8Array>}
|
|
519
778
|
*/
|
|
@@ -532,15 +791,23 @@ export class PingClient {
|
|
|
532
791
|
return takeObject(ret);
|
|
533
792
|
}
|
|
534
793
|
/**
|
|
535
|
-
*
|
|
794
|
+
* The credential this device HOLDS for itself (version 2). Public.
|
|
795
|
+
* Never absent since ruling V550 (3): every client a binding starts
|
|
796
|
+
* holds a device record. A read-only client (the record's public row,
|
|
797
|
+
* no credential) throws `NoDeviceRecord`.
|
|
536
798
|
* @returns {Uint8Array}
|
|
537
799
|
*/
|
|
538
|
-
|
|
800
|
+
heldCredential() {
|
|
539
801
|
try {
|
|
540
802
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
541
|
-
wasm.
|
|
803
|
+
wasm.pingclient_heldCredential(retptr, this.__wbg_ptr);
|
|
542
804
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
543
805
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
806
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
807
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
808
|
+
if (r3) {
|
|
809
|
+
throw takeObject(r2);
|
|
810
|
+
}
|
|
544
811
|
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
545
812
|
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
546
813
|
return v1;
|
|
@@ -556,6 +823,61 @@ export class PingClient {
|
|
|
556
823
|
const ret = wasm.pingclient_heldFrameCount(this.__wbg_ptr);
|
|
557
824
|
return ret >>> 0;
|
|
558
825
|
}
|
|
826
|
+
/**
|
|
827
|
+
* The generation of the held credential. Throws `NoDeviceRecord` as
|
|
828
|
+
* [`Self::held_credential`] does.
|
|
829
|
+
* @returns {number}
|
|
830
|
+
*/
|
|
831
|
+
heldGeneration() {
|
|
832
|
+
try {
|
|
833
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
834
|
+
wasm.pingclient_heldGeneration(retptr, this.__wbg_ptr);
|
|
835
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
836
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
837
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
838
|
+
if (r2) {
|
|
839
|
+
throw takeObject(r1);
|
|
840
|
+
}
|
|
841
|
+
return r0 >>> 0;
|
|
842
|
+
} finally {
|
|
843
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
844
|
+
}
|
|
845
|
+
}
|
|
846
|
+
/**
|
|
847
|
+
* The counter the next `publishHistoryDeliveryKey` with this floor will
|
|
848
|
+
* sign. A host that keeps the device key outside the SDK's store writes
|
|
849
|
+
* this number beside it BEFORE the publish.
|
|
850
|
+
* @param {number} counter_floor
|
|
851
|
+
* @returns {Promise<number>}
|
|
852
|
+
*/
|
|
853
|
+
historyDeliveryKeyNextCounter(counter_floor) {
|
|
854
|
+
const ret = wasm.pingclient_historyDeliveryKeyNextCounter(this.__wbg_ptr, counter_floor);
|
|
855
|
+
return takeObject(ret);
|
|
856
|
+
}
|
|
857
|
+
/**
|
|
858
|
+
* Rule H7 for a device of this account: `"automatic"`, `"ask"` or
|
|
859
|
+
* `"refused"` (ship by itself, only after the person confirms on this
|
|
860
|
+
* device, or not at all).
|
|
861
|
+
* @param {Uint8Array} device_id
|
|
862
|
+
* @returns {Promise<string>}
|
|
863
|
+
*/
|
|
864
|
+
historyShipDecision(device_id) {
|
|
865
|
+
const ptr0 = passArray8ToWasm0(device_id, wasm.__wbindgen_export);
|
|
866
|
+
const len0 = WASM_VECTOR_LEN;
|
|
867
|
+
const ret = wasm.pingclient_historyShipDecision(this.__wbg_ptr, ptr0, len0);
|
|
868
|
+
return takeObject(ret);
|
|
869
|
+
}
|
|
870
|
+
/**
|
|
871
|
+
* Rule H9: whether this device's trust record names `device_id`.
|
|
872
|
+
* @param {Uint8Array} device_id
|
|
873
|
+
* @returns {Promise<boolean>}
|
|
874
|
+
*/
|
|
875
|
+
historyTrust(device_id) {
|
|
876
|
+
const ptr0 = passArray8ToWasm0(device_id, wasm.__wbindgen_export);
|
|
877
|
+
const len0 = WASM_VECTOR_LEN;
|
|
878
|
+
const ret = wasm.pingclient_historyTrust(this.__wbg_ptr, ptr0, len0);
|
|
879
|
+
return takeObject(ret);
|
|
880
|
+
}
|
|
559
881
|
/**
|
|
560
882
|
* [CR-7] Import an MLS state snapshot produced by another device of the same
|
|
561
883
|
* user identity. Returns the conversation id the snapshot describes.
|
|
@@ -575,24 +897,23 @@ export class PingClient {
|
|
|
575
897
|
return takeObject(ret);
|
|
576
898
|
}
|
|
577
899
|
/**
|
|
578
|
-
*
|
|
900
|
+
* Start the client FROM THE DEVICE RECORD (`ping_core`'s
|
|
901
|
+
* `MessagingClient::init_from_device_record`): the start of a device
|
|
902
|
+
* under the root design. There is no identity export: the record that
|
|
903
|
+
* account set-up (or a link, or a restore) wrote into `storage` says
|
|
904
|
+
* which account and which device this is, and carries the ONE
|
|
905
|
+
* credential the device holds, which every leaf and KeyPackage it
|
|
906
|
+
* builds then carries.
|
|
579
907
|
*
|
|
580
|
-
* `device_signing_secret_key`:
|
|
581
|
-
*
|
|
582
|
-
*
|
|
583
|
-
*
|
|
584
|
-
* caller's input, so the host can align the SDK's `device_id`
|
|
585
|
-
* (which the SDK stamps into every envelope's `sender_device`)
|
|
586
|
-
* with whatever device_id the auth layer registered in the JWT.
|
|
587
|
-
* Ignored on re-init when a `LocalDevice` is already persisted
|
|
588
|
-
* in `storage`. Pass `null`/`undefined` to keep the legacy
|
|
589
|
-
* random-key behaviour.
|
|
908
|
+
* `device_signing_secret_key`: the device key the host kept from the
|
|
909
|
+
* call that made the device, or `null`/`undefined`. When given it must
|
|
910
|
+
* be the record's own device key, or the start rejects and nothing is
|
|
911
|
+
* written. Rejects when the store holds no device record.
|
|
590
912
|
*
|
|
591
913
|
* `expected_owners` (2026-11-04, round 2): an array of
|
|
592
914
|
* `{ conversationId, owner }` (`Uint8Array`s), the owner each
|
|
593
915
|
* conversation's FIRST roles write must name (the server's creator as
|
|
594
916
|
* an MLS user id); `null`/`undefined` for none. See `setExpectedOwners`.
|
|
595
|
-
* @param {Uint8Array} identity_export
|
|
596
917
|
* @param {string} device_label
|
|
597
918
|
* @param {JsStorage} storage
|
|
598
919
|
* @param {JsTransport} transport
|
|
@@ -601,14 +922,12 @@ export class PingClient {
|
|
|
601
922
|
* @param {any} expected_owners
|
|
602
923
|
* @returns {Promise<PingClient>}
|
|
603
924
|
*/
|
|
604
|
-
static
|
|
605
|
-
const ptr0 =
|
|
925
|
+
static initFromDeviceRecord(device_label, storage, transport, now_ms, device_signing_secret_key, expected_owners) {
|
|
926
|
+
const ptr0 = passStringToWasm0(device_label, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
606
927
|
const len0 = WASM_VECTOR_LEN;
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
var len2 = WASM_VECTOR_LEN;
|
|
611
|
-
const ret = wasm.pingclient_init(ptr0, len0, ptr1, len1, addHeapObject(storage), addHeapObject(transport), now_ms, ptr2, len2, addHeapObject(expected_owners));
|
|
928
|
+
var ptr1 = isLikeNone(device_signing_secret_key) ? 0 : passArray8ToWasm0(device_signing_secret_key, wasm.__wbindgen_export);
|
|
929
|
+
var len1 = WASM_VECTOR_LEN;
|
|
930
|
+
const ret = wasm.pingclient_initFromDeviceRecord(ptr0, len0, addHeapObject(storage), addHeapObject(transport), now_ms, ptr1, len1, addHeapObject(expected_owners));
|
|
612
931
|
return takeObject(ret);
|
|
613
932
|
}
|
|
614
933
|
/**
|
|
@@ -703,6 +1022,64 @@ export class PingClient {
|
|
|
703
1022
|
const ret = wasm.pingclient_leaveConversation(this.__wbg_ptr, ptr0, len0, now_ms);
|
|
704
1023
|
return takeObject(ret);
|
|
705
1024
|
}
|
|
1025
|
+
/**
|
|
1026
|
+
* `{ generation, generationSecret }` for the link-auth envelope,
|
|
1027
|
+
* version 6: answered only for a handshake whose version 3 ticket this
|
|
1028
|
+
* client built since it started. `generationSecret` is a SECRET.
|
|
1029
|
+
* @param {Uint8Array} payload
|
|
1030
|
+
* @param {string | null} [expected_code]
|
|
1031
|
+
* @param {Uint8Array | null} [expected_qr]
|
|
1032
|
+
* @returns {any}
|
|
1033
|
+
*/
|
|
1034
|
+
linkGenerationFor(payload, expected_code, expected_qr) {
|
|
1035
|
+
try {
|
|
1036
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1037
|
+
const ptr0 = passArray8ToWasm0(payload, wasm.__wbindgen_export);
|
|
1038
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1039
|
+
var ptr1 = isLikeNone(expected_code) ? 0 : passStringToWasm0(expected_code, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1040
|
+
var len1 = WASM_VECTOR_LEN;
|
|
1041
|
+
var ptr2 = isLikeNone(expected_qr) ? 0 : passArray8ToWasm0(expected_qr, wasm.__wbindgen_export);
|
|
1042
|
+
var len2 = WASM_VECTOR_LEN;
|
|
1043
|
+
wasm.pingclient_linkGenerationFor(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
1044
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1045
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1046
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1047
|
+
if (r2) {
|
|
1048
|
+
throw takeObject(r1);
|
|
1049
|
+
}
|
|
1050
|
+
return takeObject(r0);
|
|
1051
|
+
} finally {
|
|
1052
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1053
|
+
}
|
|
1054
|
+
}
|
|
1055
|
+
/**
|
|
1056
|
+
* The version 3 handshake payload this NEW device publishes: its own
|
|
1057
|
+
* signing key, the id derived from it, `hpke_public_key` (X-Wing, 1216
|
|
1058
|
+
* bytes) and a KeyPackage it just made. Show `linkCommitment` of exactly
|
|
1059
|
+
* these bytes and publish exactly these bytes.
|
|
1060
|
+
* @param {Uint8Array} hpke_public_key
|
|
1061
|
+
* @param {Uint8Array} key_package
|
|
1062
|
+
* @returns {Uint8Array}
|
|
1063
|
+
*/
|
|
1064
|
+
linkHandshakePayload(hpke_public_key, key_package) {
|
|
1065
|
+
try {
|
|
1066
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1067
|
+
const ptr0 = passArray8ToWasm0(hpke_public_key, wasm.__wbindgen_export);
|
|
1068
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1069
|
+
const ptr1 = passArray8ToWasm0(key_package, wasm.__wbindgen_export);
|
|
1070
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1071
|
+
wasm.pingclient_linkHandshakePayload(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
1072
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1073
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1074
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1075
|
+
if (r2) {
|
|
1076
|
+
throw takeObject(r1);
|
|
1077
|
+
}
|
|
1078
|
+
return takeObject(r0);
|
|
1079
|
+
} finally {
|
|
1080
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1081
|
+
}
|
|
1082
|
+
}
|
|
706
1083
|
/**
|
|
707
1084
|
* @returns {any}
|
|
708
1085
|
*/
|
|
@@ -721,6 +1098,30 @@ export class PingClient {
|
|
|
721
1098
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
722
1099
|
}
|
|
723
1100
|
}
|
|
1101
|
+
/**
|
|
1102
|
+
* The holes of one conversation's log on this device
|
|
1103
|
+
* (`MessagingClient::log_holes`): an array of `{ conversation_id,
|
|
1104
|
+
* from_server_seq, to_server_seq, reason, content_hashes, kept }`.
|
|
1105
|
+
* @param {Uint8Array} conv_id
|
|
1106
|
+
* @returns {any}
|
|
1107
|
+
*/
|
|
1108
|
+
logHoles(conv_id) {
|
|
1109
|
+
try {
|
|
1110
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1111
|
+
const ptr0 = passArray8ToWasm0(conv_id, wasm.__wbindgen_export);
|
|
1112
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1113
|
+
wasm.pingclient_logHoles(retptr, this.__wbg_ptr, ptr0, len0);
|
|
1114
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1115
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1116
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1117
|
+
if (r2) {
|
|
1118
|
+
throw takeObject(r1);
|
|
1119
|
+
}
|
|
1120
|
+
return takeObject(r0);
|
|
1121
|
+
} finally {
|
|
1122
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
724
1125
|
/**
|
|
725
1126
|
* This device's applied position in one conversation, or `null` when
|
|
726
1127
|
* it is not held.
|
|
@@ -825,14 +1226,43 @@ export class PingClient {
|
|
|
825
1226
|
}
|
|
826
1227
|
}
|
|
827
1228
|
/**
|
|
828
|
-
* @param {Function} cb
|
|
1229
|
+
* @param {Function} cb
|
|
1230
|
+
*/
|
|
1231
|
+
onMessage(cb) {
|
|
1232
|
+
wasm.pingclient_onMessage(this.__wbg_ptr, addHeapObject(cb));
|
|
1233
|
+
}
|
|
1234
|
+
/**
|
|
1235
|
+
* Open a transfer sealed to this device's published delivery key:
|
|
1236
|
+
* `{ bundle, not_yet_member }`. A bundle is returned ONCE; a replay is
|
|
1237
|
+
* `history refused: replayed`.
|
|
1238
|
+
* @param {Uint8Array} sealed
|
|
1239
|
+
* @param {boolean} own_account
|
|
1240
|
+
* @returns {Promise<any>}
|
|
1241
|
+
*/
|
|
1242
|
+
openHistoryBundleV3(sealed, own_account) {
|
|
1243
|
+
const ptr0 = passArray8ToWasm0(sealed, wasm.__wbindgen_export);
|
|
1244
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1245
|
+
const ret = wasm.pingclient_openHistoryBundleV3(this.__wbg_ptr, ptr0, len0, own_account);
|
|
1246
|
+
return takeObject(ret);
|
|
1247
|
+
}
|
|
1248
|
+
/**
|
|
1249
|
+
* The NEW device opens its link's own transfer with the seed of the
|
|
1250
|
+
* X-Wing key of the handshake it published.
|
|
1251
|
+
* @param {Uint8Array} sealed
|
|
1252
|
+
* @param {Uint8Array} recipient_priv
|
|
1253
|
+
* @returns {Promise<any>}
|
|
829
1254
|
*/
|
|
830
|
-
|
|
831
|
-
|
|
1255
|
+
openLinkHistoryBundle(sealed, recipient_priv) {
|
|
1256
|
+
const ptr0 = passArray8ToWasm0(sealed, wasm.__wbindgen_export);
|
|
1257
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1258
|
+
const ptr1 = passArray8ToWasm0(recipient_priv, wasm.__wbindgen_export);
|
|
1259
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1260
|
+
const ret = wasm.pingclient_openLinkHistoryBundle(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
1261
|
+
return takeObject(ret);
|
|
832
1262
|
}
|
|
833
1263
|
/**
|
|
834
1264
|
* [CR-5] Open the SDK **read-only**, for a second context that must read
|
|
835
|
-
* MLS state it does not own
|
|
1265
|
+
* MLS state it does not own: on web, the Service Worker decrypting a push
|
|
836
1266
|
* so the banner can show a sender and a preview instead of "New message".
|
|
837
1267
|
*
|
|
838
1268
|
* This is the web mirror of the iOS Notification Service Extension, and it
|
|
@@ -844,12 +1274,12 @@ export class PingClient {
|
|
|
844
1274
|
* snapshots the WHOLE `MemoryStorage` into one blob, so two writers
|
|
845
1275
|
* replace rather than merge. If the Service Worker opened the store
|
|
846
1276
|
* writable and checkpointed, it would clobber whatever the tab had
|
|
847
|
-
* advanced to
|
|
1277
|
+
* advanced to: silently rolling back epochs and losing messages. A
|
|
848
1278
|
* read-only open loads the tab's snapshot, never writes it back, and
|
|
849
1279
|
* `checkpoint` becomes a no-op, so the tab stays the single writer.
|
|
850
1280
|
*
|
|
851
1281
|
* Requirements, all enforced rather than documented:
|
|
852
|
-
* * the store must already hold a snapshot
|
|
1282
|
+
* * the store must already hold a snapshot: a reader that finds none is
|
|
853
1283
|
* an error, not a fresh identity, because "successfully decrypt
|
|
854
1284
|
* nothing" is the worst possible answer here;
|
|
855
1285
|
* * no `LocalDevice` means this installation does not exist yet, which
|
|
@@ -859,19 +1289,20 @@ export class PingClient {
|
|
|
859
1289
|
* Pair with [`previewEnvelope`](Self::preview_envelope). Give it a
|
|
860
1290
|
* read-only `JsStorage` too: this guards the MLS blob, not the host's own
|
|
861
1291
|
* key-value writes.
|
|
862
|
-
*
|
|
1292
|
+
*
|
|
1293
|
+
* The store is opened FROM THE DEVICE RECORD it holds: no account
|
|
1294
|
+
* identity is taken (2026-11-28). The Service Worker of a device opens
|
|
1295
|
+
* the store this way to preview a push.
|
|
863
1296
|
* @param {string} device_label
|
|
864
1297
|
* @param {JsStorage} storage
|
|
865
1298
|
* @param {JsTransport} transport
|
|
866
1299
|
* @param {number} now_ms
|
|
867
1300
|
* @returns {Promise<PingClient>}
|
|
868
1301
|
*/
|
|
869
|
-
static
|
|
870
|
-
const ptr0 =
|
|
1302
|
+
static openReadOnlyFromDeviceRecord(device_label, storage, transport, now_ms) {
|
|
1303
|
+
const ptr0 = passStringToWasm0(device_label, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
871
1304
|
const len0 = WASM_VECTOR_LEN;
|
|
872
|
-
const
|
|
873
|
-
const len1 = WASM_VECTOR_LEN;
|
|
874
|
-
const ret = wasm.pingclient_openReadOnly(ptr0, len0, ptr1, len1, addHeapObject(storage), addHeapObject(transport), now_ms);
|
|
1305
|
+
const ret = wasm.pingclient_openReadOnlyFromDeviceRecord(ptr0, len0, addHeapObject(storage), addHeapObject(transport), now_ms);
|
|
875
1306
|
return takeObject(ret);
|
|
876
1307
|
}
|
|
877
1308
|
/**
|
|
@@ -921,6 +1352,20 @@ export class PingClient {
|
|
|
921
1352
|
const ret = wasm.pingclient_pendingProposalsCommitRank(this.__wbg_ptr, ptr0, len0);
|
|
922
1353
|
return ret === Number.MAX_SAFE_INTEGER ? undefined : ret;
|
|
923
1354
|
}
|
|
1355
|
+
/**
|
|
1356
|
+
* Step 0 (`ping_recovery::plan_rotation`): rule R31 first, then who
|
|
1357
|
+
* may be kept. Answers `{ nextGeneration, offered: [{ deviceId, own }],
|
|
1358
|
+
* notOffered: [{ deviceId, reason }] }`, `reason` being
|
|
1359
|
+
* `"no-delivery-key"` or `"not-verified"`. Signs nothing.
|
|
1360
|
+
* @param {any} start
|
|
1361
|
+
* @param {any} devices
|
|
1362
|
+
* @param {number} root_part_generation
|
|
1363
|
+
* @returns {Promise<any>}
|
|
1364
|
+
*/
|
|
1365
|
+
planRotation(start, devices, root_part_generation) {
|
|
1366
|
+
const ret = wasm.pingclient_planRotation(this.__wbg_ptr, addHeapObject(start), addHeapObject(devices), root_part_generation);
|
|
1367
|
+
return takeObject(ret);
|
|
1368
|
+
}
|
|
924
1369
|
/**
|
|
925
1370
|
* [CR-5] Decrypt ONE envelope in memory for a preview, writing nothing.
|
|
926
1371
|
*
|
|
@@ -1034,6 +1479,16 @@ export class PingClient {
|
|
|
1034
1479
|
const ret = wasm.pingclient_processWelcomeAt(this.__wbg_ptr, addHeapObject(welcome), !isLikeNone(position), isLikeNone(position) ? 0 : position, now_ms);
|
|
1035
1480
|
return takeObject(ret);
|
|
1036
1481
|
}
|
|
1482
|
+
/**
|
|
1483
|
+
* This device's signed history delivery key: `{ device_id, counter,
|
|
1484
|
+
* public_key, signature }`. The key pair is made once, inside the SDK.
|
|
1485
|
+
* @param {number} counter_floor
|
|
1486
|
+
* @returns {Promise<any>}
|
|
1487
|
+
*/
|
|
1488
|
+
publishHistoryDeliveryKey(counter_floor) {
|
|
1489
|
+
const ret = wasm.pingclient_publishHistoryDeliveryKey(this.__wbg_ptr, counter_floor);
|
|
1490
|
+
return takeObject(ret);
|
|
1491
|
+
}
|
|
1037
1492
|
/**
|
|
1038
1493
|
* Re-admit a device that kept its signature key (`ping_core`
|
|
1039
1494
|
* `MessagingClient::re_admit_device`): one Commit removes the leaf with
|
|
@@ -1089,6 +1544,52 @@ export class PingClient {
|
|
|
1089
1544
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1090
1545
|
}
|
|
1091
1546
|
}
|
|
1547
|
+
/**
|
|
1548
|
+
* Rule H9: record a shipment the server accepted.
|
|
1549
|
+
* @param {Uint8Array} device_id
|
|
1550
|
+
* @returns {Promise<void>}
|
|
1551
|
+
*/
|
|
1552
|
+
recordHistoryShipped(device_id) {
|
|
1553
|
+
const ptr0 = passArray8ToWasm0(device_id, wasm.__wbindgen_export);
|
|
1554
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1555
|
+
const ret = wasm.pingclient_recordHistoryShipped(this.__wbg_ptr, ptr0, len0);
|
|
1556
|
+
return takeObject(ret);
|
|
1557
|
+
}
|
|
1558
|
+
/**
|
|
1559
|
+
* Create the DeviceGroup anew after a take-over
|
|
1560
|
+
* (`ping_recovery::recreate_device_group`). Call it ONLY after the
|
|
1561
|
+
* server answered the DeviceGroup reset with `200` or with the reason
|
|
1562
|
+
* `already_reset`, and before the rotation is finished. Ruling V160:
|
|
1563
|
+
* refused on a device whose store does not hold the take-over's
|
|
1564
|
+
* adopted rotation record, and on one that waits for its DeviceGroup.
|
|
1565
|
+
* @param {number} now_ms
|
|
1566
|
+
* @returns {Promise<void>}
|
|
1567
|
+
*/
|
|
1568
|
+
recreateDeviceGroup(now_ms) {
|
|
1569
|
+
const ret = wasm.pingclient_recreateDeviceGroup(this.__wbg_ptr, now_ms);
|
|
1570
|
+
return takeObject(ret);
|
|
1571
|
+
}
|
|
1572
|
+
/**
|
|
1573
|
+
* THE ONE CALL A HOST REMEMBERS FOR THE ANCHOR RECORD: the account's
|
|
1574
|
+
* state part written from the running client
|
|
1575
|
+
* (`ping_recovery::refresh_state_backup_from`). The record is rebuilt
|
|
1576
|
+
* from this client's own trees first, at every call (ruling V280; its
|
|
1577
|
+
* row is written only when the record changed), and the part carries
|
|
1578
|
+
* it. Answers `{ statePart,
|
|
1579
|
+
* droppedAnchors }`.
|
|
1580
|
+
* @param {Uint8Array} account_id
|
|
1581
|
+
* @param {Uint8Array} host_state
|
|
1582
|
+
* @param {number} now_ms
|
|
1583
|
+
* @returns {Promise<any>}
|
|
1584
|
+
*/
|
|
1585
|
+
refreshStateBackup(account_id, host_state, now_ms) {
|
|
1586
|
+
const ptr0 = passArray8ToWasm0(account_id, wasm.__wbindgen_export);
|
|
1587
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1588
|
+
const ptr1 = passArray8ToWasm0(host_state, wasm.__wbindgen_export);
|
|
1589
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1590
|
+
const ret = wasm.pingclient_refreshStateBackup(this.__wbg_ptr, ptr0, len0, ptr1, len1, now_ms);
|
|
1591
|
+
return takeObject(ret);
|
|
1592
|
+
}
|
|
1092
1593
|
/**
|
|
1093
1594
|
* Remove one of THIS account's devices from every group this client is
|
|
1094
1595
|
* in, the DeviceGroup included, never stopping at a failure (`ping_core`
|
|
@@ -1180,6 +1681,21 @@ export class PingClient {
|
|
|
1180
1681
|
const ret = wasm.pingclient_removeOwnOtherLeaves(this.__wbg_ptr, ptr0, len0, now_ms);
|
|
1181
1682
|
return takeObject(ret);
|
|
1182
1683
|
}
|
|
1684
|
+
/**
|
|
1685
|
+
* The host filled a range of a conversation's log from elsewhere
|
|
1686
|
+
* (`MessagingClient::resolve_log_hole`). Resolves `true` when a
|
|
1687
|
+
* recorded hole changed.
|
|
1688
|
+
* @param {Uint8Array} conv_id
|
|
1689
|
+
* @param {number} from_server_seq
|
|
1690
|
+
* @param {number} to_server_seq
|
|
1691
|
+
* @returns {Promise<boolean>}
|
|
1692
|
+
*/
|
|
1693
|
+
resolveLogHole(conv_id, from_server_seq, to_server_seq) {
|
|
1694
|
+
const ptr0 = passArray8ToWasm0(conv_id, wasm.__wbindgen_export);
|
|
1695
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1696
|
+
const ret = wasm.pingclient_resolveLogHole(this.__wbg_ptr, ptr0, len0, from_server_seq, to_server_seq);
|
|
1697
|
+
return takeObject(ret);
|
|
1698
|
+
}
|
|
1183
1699
|
/**
|
|
1184
1700
|
* Undo `suspendStorage`. Idempotent.
|
|
1185
1701
|
*/
|
|
@@ -1202,31 +1718,154 @@ export class PingClient {
|
|
|
1202
1718
|
return takeObject(ret);
|
|
1203
1719
|
}
|
|
1204
1720
|
/**
|
|
1205
|
-
*
|
|
1206
|
-
*
|
|
1207
|
-
*
|
|
1208
|
-
*
|
|
1209
|
-
*
|
|
1210
|
-
*
|
|
1721
|
+
* Step 1 with the backup as the root's source: the root part and the
|
|
1722
|
+
* CURRENT phrase, and the NEW phrase when the person asked for one.
|
|
1723
|
+
* Both phrases are UTF-8 BYTES (see [`phrase_in`]); this call's copies
|
|
1724
|
+
* are wiped when it ends, whatever it answers. No store is an
|
|
1725
|
+
* argument. Answers what [`build_out`] writes; a phrase that does not
|
|
1726
|
+
* open the root part is `account refused: backup-authentication`.
|
|
1727
|
+
* @param {Uint8Array} root_part
|
|
1728
|
+
* @param {Uint8Array} phrase
|
|
1729
|
+
* @param {Uint8Array | null | undefined} new_phrase
|
|
1730
|
+
* @param {any} start
|
|
1731
|
+
* @param {any} devices
|
|
1732
|
+
* @param {any} kept
|
|
1733
|
+
* @param {string} reason
|
|
1734
|
+
* @param {Uint8Array} account_id
|
|
1735
|
+
* @param {Uint8Array} host_state
|
|
1736
|
+
* @param {number} now_ms
|
|
1737
|
+
* @returns {Promise<any>}
|
|
1738
|
+
*/
|
|
1739
|
+
rotateGenerationWithBackup(root_part, phrase, new_phrase, start, devices, kept, reason, account_id, host_state, now_ms) {
|
|
1740
|
+
const ptr0 = passArray8ToWasm0(root_part, wasm.__wbindgen_export);
|
|
1741
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1742
|
+
const ptr1 = passArray8ToWasm0(phrase, wasm.__wbindgen_export);
|
|
1743
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1744
|
+
var ptr2 = isLikeNone(new_phrase) ? 0 : passArray8ToWasm0(new_phrase, wasm.__wbindgen_export);
|
|
1745
|
+
var len2 = WASM_VECTOR_LEN;
|
|
1746
|
+
const ptr3 = passStringToWasm0(reason, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1747
|
+
const len3 = WASM_VECTOR_LEN;
|
|
1748
|
+
const ptr4 = passArray8ToWasm0(account_id, wasm.__wbindgen_export);
|
|
1749
|
+
const len4 = WASM_VECTOR_LEN;
|
|
1750
|
+
const ptr5 = passArray8ToWasm0(host_state, wasm.__wbindgen_export);
|
|
1751
|
+
const len5 = WASM_VECTOR_LEN;
|
|
1752
|
+
const ret = wasm.pingclient_rotateGenerationWithBackup(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, addHeapObject(start), addHeapObject(devices), addHeapObject(kept), ptr3, len3, ptr4, len4, ptr5, len5, now_ms);
|
|
1753
|
+
return takeObject(ret);
|
|
1754
|
+
}
|
|
1755
|
+
/**
|
|
1756
|
+
* Step 1 with the pending item of `slot` as the root's source
|
|
1757
|
+
* (`ping_recovery::rotate_generation`; an account with no backup yet).
|
|
1758
|
+
* `pending` is the SDK's own store, built by the Worker that makes
|
|
1759
|
+
* this call for the length of it: the item is read behind the store's
|
|
1760
|
+
* own checks and never written or deleted. The request carries no root
|
|
1761
|
+
* part. Answers what [`build_out`] writes.
|
|
1762
|
+
* @param {JsPendingRootStore} pending
|
|
1763
|
+
* @param {string} slot
|
|
1764
|
+
* @param {any} start
|
|
1765
|
+
* @param {any} devices
|
|
1766
|
+
* @param {any} kept
|
|
1767
|
+
* @param {string} reason
|
|
1768
|
+
* @param {Uint8Array} account_id
|
|
1769
|
+
* @param {Uint8Array} host_state
|
|
1211
1770
|
* @param {number} now_ms
|
|
1212
1771
|
* @returns {Promise<any>}
|
|
1213
1772
|
*/
|
|
1214
|
-
|
|
1215
|
-
const ptr0 =
|
|
1773
|
+
rotateGenerationWithPending(pending, slot, start, devices, kept, reason, account_id, host_state, now_ms) {
|
|
1774
|
+
const ptr0 = passStringToWasm0(slot, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1216
1775
|
const len0 = WASM_VECTOR_LEN;
|
|
1217
|
-
const
|
|
1776
|
+
const ptr1 = passStringToWasm0(reason, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1777
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1778
|
+
const ptr2 = passArray8ToWasm0(account_id, wasm.__wbindgen_export);
|
|
1779
|
+
const len2 = WASM_VECTOR_LEN;
|
|
1780
|
+
const ptr3 = passArray8ToWasm0(host_state, wasm.__wbindgen_export);
|
|
1781
|
+
const len3 = WASM_VECTOR_LEN;
|
|
1782
|
+
const ret = wasm.pingclient_rotateGenerationWithPending(this.__wbg_ptr, addHeapObject(pending), ptr0, len0, addHeapObject(start), addHeapObject(devices), addHeapObject(kept), ptr1, len1, ptr2, len2, ptr3, len3, now_ms);
|
|
1783
|
+
return takeObject(ret);
|
|
1784
|
+
}
|
|
1785
|
+
/**
|
|
1786
|
+
* Verify `recipient` (the statement a server returned) in this device's
|
|
1787
|
+
* own tree, then sign the bundle with the device key and seal it to that
|
|
1788
|
+
* key. `own_account` is what the host believes and only ever a reason to
|
|
1789
|
+
* refuse.
|
|
1790
|
+
* @param {any} bundle
|
|
1791
|
+
* @param {any} recipient
|
|
1792
|
+
* @param {boolean} own_account
|
|
1793
|
+
* @returns {Promise<Uint8Array>}
|
|
1794
|
+
*/
|
|
1795
|
+
sealHistoryBundleV3(bundle, recipient, own_account) {
|
|
1796
|
+
const ret = wasm.pingclient_sealHistoryBundleV3(this.__wbg_ptr, addHeapObject(bundle), addHeapObject(recipient), own_account);
|
|
1218
1797
|
return takeObject(ret);
|
|
1219
1798
|
}
|
|
1220
1799
|
/**
|
|
1221
|
-
*
|
|
1800
|
+
* The link's own transfer. The handshake `payload` is VERIFIED HERE
|
|
1801
|
+
* against what this device was shown (`expected_code` or `expected_qr`,
|
|
1802
|
+
* exactly one), and the bundle is sealed to the verified handshake's
|
|
1803
|
+
* key: no key can be passed.
|
|
1804
|
+
* @param {any} bundle
|
|
1805
|
+
* @param {Uint8Array} payload
|
|
1806
|
+
* @param {string | null} [expected_code]
|
|
1807
|
+
* @param {Uint8Array | null} [expected_qr]
|
|
1808
|
+
* @returns {Uint8Array}
|
|
1809
|
+
*/
|
|
1810
|
+
sealLinkHistoryBundle(bundle, payload, expected_code, expected_qr) {
|
|
1811
|
+
try {
|
|
1812
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1813
|
+
const ptr0 = passArray8ToWasm0(payload, wasm.__wbindgen_export);
|
|
1814
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1815
|
+
var ptr1 = isLikeNone(expected_code) ? 0 : passStringToWasm0(expected_code, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1816
|
+
var len1 = WASM_VECTOR_LEN;
|
|
1817
|
+
var ptr2 = isLikeNone(expected_qr) ? 0 : passArray8ToWasm0(expected_qr, wasm.__wbindgen_export);
|
|
1818
|
+
var len2 = WASM_VECTOR_LEN;
|
|
1819
|
+
wasm.pingclient_sealLinkHistoryBundle(retptr, this.__wbg_ptr, addHeapObject(bundle), ptr0, len0, ptr1, len1, ptr2, len2);
|
|
1820
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1821
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1822
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1823
|
+
if (r2) {
|
|
1824
|
+
throw takeObject(r1);
|
|
1825
|
+
}
|
|
1826
|
+
return takeObject(r0);
|
|
1827
|
+
} finally {
|
|
1828
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1829
|
+
}
|
|
1830
|
+
}
|
|
1831
|
+
/**
|
|
1832
|
+
* Enter `conv_id` by this device's own act, from what the delivery
|
|
1833
|
+
* service returned for it (`ping_recovery::self_admit_entry`). While
|
|
1834
|
+
* the SDK is built without self-admission it answers `{ kind:
|
|
1835
|
+
* "refused", refusal: "notCompiled" }` and touches nothing. Rejects
|
|
1836
|
+
* only for an id of the wrong length.
|
|
1222
1837
|
* @param {Uint8Array} conv_id
|
|
1838
|
+
* @param {Uint8Array} blob
|
|
1839
|
+
* @param {Uint8Array} wrap
|
|
1840
|
+
* @param {number} wrap_count
|
|
1841
|
+
* @param {number | null | undefined} current_epoch
|
|
1223
1842
|
* @param {number} now_ms
|
|
1224
|
-
* @returns {Promise<
|
|
1843
|
+
* @returns {Promise<any>}
|
|
1225
1844
|
*/
|
|
1226
|
-
|
|
1845
|
+
selfAdmit(conv_id, blob, wrap, wrap_count, current_epoch, now_ms) {
|
|
1227
1846
|
const ptr0 = passArray8ToWasm0(conv_id, wasm.__wbindgen_export);
|
|
1228
1847
|
const len0 = WASM_VECTOR_LEN;
|
|
1229
|
-
const
|
|
1848
|
+
const ptr1 = passArray8ToWasm0(blob, wasm.__wbindgen_export);
|
|
1849
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1850
|
+
const ptr2 = passArray8ToWasm0(wrap, wasm.__wbindgen_export);
|
|
1851
|
+
const len2 = WASM_VECTOR_LEN;
|
|
1852
|
+
const ret = wasm.pingclient_selfAdmit(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, wrap_count, !isLikeNone(current_epoch), isLikeNone(current_epoch) ? 0 : current_epoch, now_ms);
|
|
1853
|
+
return takeObject(ret);
|
|
1854
|
+
}
|
|
1855
|
+
/**
|
|
1856
|
+
* Enter MANY conversations with few requests
|
|
1857
|
+
* (`ping_recovery::self_admit_many_entry`): `first` at the head, then
|
|
1858
|
+
* the order given, each once. Resolves to an array of `{
|
|
1859
|
+
* conversationId, result }`, `result` as `selfAdmit` answers.
|
|
1860
|
+
* @param {Uint8Array | null | undefined} first
|
|
1861
|
+
* @param {Array<any>} conversations
|
|
1862
|
+
* @param {number} now_ms
|
|
1863
|
+
* @returns {Promise<any>}
|
|
1864
|
+
*/
|
|
1865
|
+
selfAdmitMany(first, conversations, now_ms) {
|
|
1866
|
+
var ptr0 = isLikeNone(first) ? 0 : passArray8ToWasm0(first, wasm.__wbindgen_export);
|
|
1867
|
+
var len0 = WASM_VECTOR_LEN;
|
|
1868
|
+
const ret = wasm.pingclient_selfAdmitMany(this.__wbg_ptr, ptr0, len0, addHeapObject(conversations), now_ms);
|
|
1230
1869
|
return takeObject(ret);
|
|
1231
1870
|
}
|
|
1232
1871
|
/**
|
|
@@ -1424,6 +2063,64 @@ export function _start() {
|
|
|
1424
2063
|
wasm._start();
|
|
1425
2064
|
}
|
|
1426
2065
|
|
|
2066
|
+
/**
|
|
2067
|
+
* Rulings V212 and V227: abandon a rotation the SERVER REFUSED, at the
|
|
2068
|
+
* person's choice (`ping_recovery::abandon_rotation`). A record the server
|
|
2069
|
+
* never answered is refused (`RotationRefused`): its request is sent again.
|
|
2070
|
+
* @param {JsStorage} storage
|
|
2071
|
+
* @param {Uint8Array} record_id
|
|
2072
|
+
* @returns {Promise<void>}
|
|
2073
|
+
*/
|
|
2074
|
+
export function abandonRotation(storage, record_id) {
|
|
2075
|
+
const ptr0 = passArray8ToWasm0(record_id, wasm.__wbindgen_export);
|
|
2076
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2077
|
+
const ret = wasm.abandonRotation(addHeapObject(storage), ptr0, len0);
|
|
2078
|
+
return takeObject(ret);
|
|
2079
|
+
}
|
|
2080
|
+
|
|
2081
|
+
/**
|
|
2082
|
+
* Begin a set-up session in memory
|
|
2083
|
+
* (`ping_recovery::begin_account_setup_in_memory`).
|
|
2084
|
+
* @param {string | null | undefined} identity_state
|
|
2085
|
+
* @param {number} now_ms
|
|
2086
|
+
* @returns {AccountSetupSession}
|
|
2087
|
+
*/
|
|
2088
|
+
export function beginAccountSetupInMemory(identity_state, now_ms) {
|
|
2089
|
+
try {
|
|
2090
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2091
|
+
var ptr0 = isLikeNone(identity_state) ? 0 : passStringToWasm0(identity_state, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
2092
|
+
var len0 = WASM_VECTOR_LEN;
|
|
2093
|
+
wasm.beginAccountSetupInMemory(retptr, ptr0, len0, now_ms);
|
|
2094
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2095
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2096
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
2097
|
+
if (r2) {
|
|
2098
|
+
throw takeObject(r1);
|
|
2099
|
+
}
|
|
2100
|
+
return AccountSetupSession.__wrap(r0);
|
|
2101
|
+
} finally {
|
|
2102
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2103
|
+
}
|
|
2104
|
+
}
|
|
2105
|
+
|
|
2106
|
+
/**
|
|
2107
|
+
* Begin a link on a NEW device (ruling V109): draws the device key, records
|
|
2108
|
+
* "link begun", starts the staging client and builds the handshake payload
|
|
2109
|
+
* (`ping_recovery::begin_device_link`). No argument is a key. A repeat
|
|
2110
|
+
* answers the same key and the same handshake.
|
|
2111
|
+
* @param {string} device_label
|
|
2112
|
+
* @param {JsStorage} storage
|
|
2113
|
+
* @param {JsTransport} transport
|
|
2114
|
+
* @param {number} now_ms
|
|
2115
|
+
* @returns {Promise<DeviceLinkBegun>}
|
|
2116
|
+
*/
|
|
2117
|
+
export function beginDeviceLink(device_label, storage, transport, now_ms) {
|
|
2118
|
+
const ptr0 = passStringToWasm0(device_label, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
2119
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2120
|
+
const ret = wasm.beginDeviceLink(ptr0, len0, addHeapObject(storage), addHeapObject(transport), now_ms);
|
|
2121
|
+
return takeObject(ret);
|
|
2122
|
+
}
|
|
2123
|
+
|
|
1427
2124
|
/**
|
|
1428
2125
|
* Whether `mnemonicPhrase` opens `blob`, with THREE answers
|
|
1429
2126
|
* (`ping_recovery::check_backup_phrase`). Resolves
|
|
@@ -1436,8 +2133,7 @@ export function _start() {
|
|
|
1436
2133
|
*
|
|
1437
2134
|
* `authenticationFailed` is the only proof that the phrase does not open
|
|
1438
2135
|
* these bytes; every `couldNotCheck` is a doubt. Never throws for an answer
|
|
1439
|
-
* of the check, returns nothing of the backup, logs nothing.
|
|
1440
|
-
* is unchanged and still rejects with its one message.
|
|
2136
|
+
* of the check, returns nothing of the backup, logs nothing.
|
|
1441
2137
|
* @param {Uint8Array} blob
|
|
1442
2138
|
* @param {string} mnemonic_phrase
|
|
1443
2139
|
* @returns {any}
|
|
@@ -1463,52 +2159,61 @@ export function checkBackupPhrase(blob, mnemonic_phrase) {
|
|
|
1463
2159
|
}
|
|
1464
2160
|
|
|
1465
2161
|
/**
|
|
1466
|
-
*
|
|
1467
|
-
*
|
|
1468
|
-
*
|
|
1469
|
-
*
|
|
1470
|
-
*
|
|
1471
|
-
*
|
|
1472
|
-
*
|
|
1473
|
-
*
|
|
1474
|
-
*
|
|
1475
|
-
*
|
|
1476
|
-
* @param {Uint8Array} snapshot_bytes
|
|
1477
|
-
* @returns {any}
|
|
2162
|
+
* Step 3 of a rotation (`ping_recovery::complete_rotation`). `answer` is
|
|
2163
|
+
* the server's answer AS RECEIVED, `{ status, error?, generation?,
|
|
2164
|
+
* statement? }`, judged inside (ruling V161). Answers `{
|
|
2165
|
+
* outcome: "adopted", userId, deviceId, generation }`, `{ outcome:
|
|
2166
|
+
* "lost", pinnedStatement }`, or one of the outcomes that keep the record
|
|
2167
|
+
* (`outcome_out`).
|
|
2168
|
+
* @param {JsStorage} storage
|
|
2169
|
+
* @param {Uint8Array} record_id
|
|
2170
|
+
* @param {any} answer
|
|
2171
|
+
* @returns {Promise<any>}
|
|
1478
2172
|
*/
|
|
1479
|
-
export function
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
wasm.decodeCatchupSnapshot(retptr, ptr0, len0);
|
|
1485
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1486
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1487
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1488
|
-
if (r2) {
|
|
1489
|
-
throw takeObject(r1);
|
|
1490
|
-
}
|
|
1491
|
-
return takeObject(r0);
|
|
1492
|
-
} finally {
|
|
1493
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1494
|
-
}
|
|
2173
|
+
export function completeRotation(storage, record_id, answer) {
|
|
2174
|
+
const ptr0 = passArray8ToWasm0(record_id, wasm.__wbindgen_export);
|
|
2175
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2176
|
+
const ret = wasm.completeRotation(addHeapObject(storage), ptr0, len0, addHeapObject(answer));
|
|
2177
|
+
return takeObject(ret);
|
|
1495
2178
|
}
|
|
1496
2179
|
|
|
1497
2180
|
/**
|
|
1498
|
-
*
|
|
1499
|
-
*
|
|
1500
|
-
*
|
|
1501
|
-
*
|
|
2181
|
+
* Set a new account up: the pending item first, then the device record in
|
|
2182
|
+
* one write (`ping_recovery::create_account`). `persistentStorage` is the
|
|
2183
|
+
* browser's answer to the persistent-storage request, which the host asked
|
|
2184
|
+
* for before this call (ruling ID39), or `undefined`. `identityState` is
|
|
2185
|
+
* the sign-in body's `identity_state` field as the server sent it: only
|
|
2186
|
+
* the text `none_pinned` lets the call run (ruling V102).
|
|
2187
|
+
* @param {JsStorage} storage
|
|
2188
|
+
* @param {JsPendingRootStore} pending
|
|
2189
|
+
* @param {string} slot
|
|
2190
|
+
* @param {string | null | undefined} identity_state
|
|
2191
|
+
* @param {boolean | null | undefined} persistent_storage
|
|
2192
|
+
* @param {number} now_ms
|
|
2193
|
+
* @returns {Promise<any>}
|
|
2194
|
+
*/
|
|
2195
|
+
export function createAccount(storage, pending, slot, identity_state, persistent_storage, now_ms) {
|
|
2196
|
+
const ptr0 = passStringToWasm0(slot, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
2197
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2198
|
+
var ptr1 = isLikeNone(identity_state) ? 0 : passStringToWasm0(identity_state, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
2199
|
+
var len1 = WASM_VECTOR_LEN;
|
|
2200
|
+
const ret = wasm.createAccount(addHeapObject(storage), addHeapObject(pending), ptr0, len0, ptr1, len1, isLikeNone(persistent_storage) ? 0xFFFFFF : persistent_storage ? 1 : 0, now_ms);
|
|
2201
|
+
return takeObject(ret);
|
|
2202
|
+
}
|
|
2203
|
+
|
|
2204
|
+
/**
|
|
2205
|
+
* [CR-13] Decode the `catchup_snapshot` blob of a linking ticket. Pure
|
|
2206
|
+
* function; no client required. The new device calls this after the link
|
|
2207
|
+
* to populate its initial UI.
|
|
2208
|
+
* @param {Uint8Array} snapshot_bytes
|
|
1502
2209
|
* @returns {any}
|
|
1503
2210
|
*/
|
|
1504
|
-
export function
|
|
2211
|
+
export function decodeCatchupSnapshot(snapshot_bytes) {
|
|
1505
2212
|
try {
|
|
1506
2213
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1507
|
-
const ptr0 = passArray8ToWasm0(
|
|
2214
|
+
const ptr0 = passArray8ToWasm0(snapshot_bytes, wasm.__wbindgen_export);
|
|
1508
2215
|
const len0 = WASM_VECTOR_LEN;
|
|
1509
|
-
|
|
1510
|
-
const len1 = WASM_VECTOR_LEN;
|
|
1511
|
-
wasm.decryptBackup(retptr, ptr0, len0, ptr1, len1);
|
|
2216
|
+
wasm.decodeCatchupSnapshot(retptr, ptr0, len0);
|
|
1512
2217
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1513
2218
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1514
2219
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -1540,41 +2245,36 @@ export function deviceGroupIdFor(user_id) {
|
|
|
1540
2245
|
}
|
|
1541
2246
|
|
|
1542
2247
|
/**
|
|
1543
|
-
*
|
|
1544
|
-
* `
|
|
1545
|
-
*
|
|
1546
|
-
*
|
|
1547
|
-
*
|
|
1548
|
-
* @param {string}
|
|
1549
|
-
* @param {Uint8Array}
|
|
1550
|
-
* @
|
|
1551
|
-
* @param {Uint8Array} device_group_snapshot
|
|
1552
|
-
* @param {any} conversation_snapshots
|
|
1553
|
-
* @param {number} created_at_ms
|
|
1554
|
-
* @returns {Uint8Array}
|
|
2248
|
+
* End PENDING: delete the pending item, only against the proof on record
|
|
2249
|
+
* (`ping_recovery::end_pending`). `fingerprint` is what `proveBackup`
|
|
2250
|
+
* answered.
|
|
2251
|
+
* @param {JsStorage} storage
|
|
2252
|
+
* @param {JsPendingRootStore} pending
|
|
2253
|
+
* @param {string} slot
|
|
2254
|
+
* @param {Uint8Array} fingerprint
|
|
2255
|
+
* @returns {Promise<void>}
|
|
1555
2256
|
*/
|
|
1556
|
-
export function
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
}
|
|
2257
|
+
export function endPending(storage, pending, slot, fingerprint) {
|
|
2258
|
+
const ptr0 = passStringToWasm0(slot, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
2259
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2260
|
+
const ptr1 = passArray8ToWasm0(fingerprint, wasm.__wbindgen_export);
|
|
2261
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2262
|
+
const ret = wasm.endPending(addHeapObject(storage), addHeapObject(pending), ptr0, len0, ptr1, len1);
|
|
2263
|
+
return takeObject(ret);
|
|
2264
|
+
}
|
|
2265
|
+
|
|
2266
|
+
/**
|
|
2267
|
+
* Step 6: delete the record of an adopted rotation
|
|
2268
|
+
* (`ping_recovery::finish_rotation`).
|
|
2269
|
+
* @param {JsStorage} storage
|
|
2270
|
+
* @param {Uint8Array} record_id
|
|
2271
|
+
* @returns {Promise<void>}
|
|
2272
|
+
*/
|
|
2273
|
+
export function finishRotation(storage, record_id) {
|
|
2274
|
+
const ptr0 = passArray8ToWasm0(record_id, wasm.__wbindgen_export);
|
|
2275
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2276
|
+
const ret = wasm.finishRotation(addHeapObject(storage), ptr0, len0);
|
|
2277
|
+
return takeObject(ret);
|
|
1578
2278
|
}
|
|
1579
2279
|
|
|
1580
2280
|
/**
|
|
@@ -1837,13 +2537,75 @@ export function hpkeSeal(plaintext, recipient_pub, info) {
|
|
|
1837
2537
|
}
|
|
1838
2538
|
|
|
1839
2539
|
/**
|
|
1840
|
-
* Post-quantum HPKE-Base seal, CBOR-wrapped (`v: 2`). `recipientPub` is 1216 bytes.
|
|
2540
|
+
* Post-quantum HPKE-Base seal, CBOR-wrapped (`v: 2`). `recipientPub` is 1216 bytes.
|
|
2541
|
+
* @param {Uint8Array} plaintext
|
|
2542
|
+
* @param {Uint8Array} recipient_pub
|
|
2543
|
+
* @param {Uint8Array} info
|
|
2544
|
+
* @returns {Uint8Array}
|
|
2545
|
+
*/
|
|
2546
|
+
export function hpkeSealPq(plaintext, recipient_pub, info) {
|
|
2547
|
+
try {
|
|
2548
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2549
|
+
const ptr0 = passArray8ToWasm0(plaintext, wasm.__wbindgen_export);
|
|
2550
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2551
|
+
const ptr1 = passArray8ToWasm0(recipient_pub, wasm.__wbindgen_export);
|
|
2552
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2553
|
+
const ptr2 = passArray8ToWasm0(info, wasm.__wbindgen_export);
|
|
2554
|
+
const len2 = WASM_VECTOR_LEN;
|
|
2555
|
+
wasm.hpkeSealPq(retptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
2556
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2557
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2558
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
2559
|
+
if (r2) {
|
|
2560
|
+
throw takeObject(r1);
|
|
2561
|
+
}
|
|
2562
|
+
return takeObject(r0);
|
|
2563
|
+
} finally {
|
|
2564
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2565
|
+
}
|
|
2566
|
+
}
|
|
2567
|
+
|
|
2568
|
+
/**
|
|
2569
|
+
* HPKE-Base seal in the RFC 9180 CANONICAL layout, `enc || ct||tag`, no CBOR
|
|
2570
|
+
* wrapper. See `hpke_seal_raw` in `ping-link` for why this exists beside
|
|
2571
|
+
* [`hpke_seal`]: it is the layout iOS, Android, web and the third-party
|
|
2572
|
+
* `ping-notify` sender each hand-composed because the CBOR form could not read
|
|
2573
|
+
* it.
|
|
2574
|
+
* @param {Uint8Array} plaintext
|
|
2575
|
+
* @param {Uint8Array} recipient_pub
|
|
2576
|
+
* @param {Uint8Array} info
|
|
2577
|
+
* @returns {Uint8Array}
|
|
2578
|
+
*/
|
|
2579
|
+
export function hpkeSealRaw(plaintext, recipient_pub, info) {
|
|
2580
|
+
try {
|
|
2581
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2582
|
+
const ptr0 = passArray8ToWasm0(plaintext, wasm.__wbindgen_export);
|
|
2583
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2584
|
+
const ptr1 = passArray8ToWasm0(recipient_pub, wasm.__wbindgen_export);
|
|
2585
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2586
|
+
const ptr2 = passArray8ToWasm0(info, wasm.__wbindgen_export);
|
|
2587
|
+
const len2 = WASM_VECTOR_LEN;
|
|
2588
|
+
wasm.hpkeSealRaw(retptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
2589
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2590
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2591
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
2592
|
+
if (r2) {
|
|
2593
|
+
throw takeObject(r1);
|
|
2594
|
+
}
|
|
2595
|
+
return takeObject(r0);
|
|
2596
|
+
} finally {
|
|
2597
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2598
|
+
}
|
|
2599
|
+
}
|
|
2600
|
+
|
|
2601
|
+
/**
|
|
2602
|
+
* Post-quantum HPKE-Base seal in the RFC 9180 canonical layout, `enc(1120) || ct || tag`.
|
|
1841
2603
|
* @param {Uint8Array} plaintext
|
|
1842
2604
|
* @param {Uint8Array} recipient_pub
|
|
1843
2605
|
* @param {Uint8Array} info
|
|
1844
2606
|
* @returns {Uint8Array}
|
|
1845
2607
|
*/
|
|
1846
|
-
export function
|
|
2608
|
+
export function hpkeSealRawPq(plaintext, recipient_pub, info) {
|
|
1847
2609
|
try {
|
|
1848
2610
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1849
2611
|
const ptr0 = passArray8ToWasm0(plaintext, wasm.__wbindgen_export);
|
|
@@ -1852,7 +2614,7 @@ export function hpkeSealPq(plaintext, recipient_pub, info) {
|
|
|
1852
2614
|
const len1 = WASM_VECTOR_LEN;
|
|
1853
2615
|
const ptr2 = passArray8ToWasm0(info, wasm.__wbindgen_export);
|
|
1854
2616
|
const len2 = WASM_VECTOR_LEN;
|
|
1855
|
-
wasm.
|
|
2617
|
+
wasm.hpkeSealRawPq(retptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
1856
2618
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1857
2619
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1858
2620
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -1866,26 +2628,17 @@ export function hpkeSealPq(plaintext, recipient_pub, info) {
|
|
|
1866
2628
|
}
|
|
1867
2629
|
|
|
1868
2630
|
/**
|
|
1869
|
-
*
|
|
1870
|
-
*
|
|
1871
|
-
*
|
|
1872
|
-
*
|
|
1873
|
-
* it.
|
|
1874
|
-
* @param {Uint8Array} plaintext
|
|
1875
|
-
* @param {Uint8Array} recipient_pub
|
|
1876
|
-
* @param {Uint8Array} info
|
|
1877
|
-
* @returns {Uint8Array}
|
|
2631
|
+
* The commitment of a handshake payload: `[commitment (Uint8Array, 32),
|
|
2632
|
+
* qrText, code, codeDisplay]`. The JS facade names the parts.
|
|
2633
|
+
* @param {Uint8Array} payload
|
|
2634
|
+
* @returns {Array<any>}
|
|
1878
2635
|
*/
|
|
1879
|
-
export function
|
|
2636
|
+
export function linkCommitment(payload) {
|
|
1880
2637
|
try {
|
|
1881
2638
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1882
|
-
const ptr0 = passArray8ToWasm0(
|
|
2639
|
+
const ptr0 = passArray8ToWasm0(payload, wasm.__wbindgen_export);
|
|
1883
2640
|
const len0 = WASM_VECTOR_LEN;
|
|
1884
|
-
|
|
1885
|
-
const len1 = WASM_VECTOR_LEN;
|
|
1886
|
-
const ptr2 = passArray8ToWasm0(info, wasm.__wbindgen_export);
|
|
1887
|
-
const len2 = WASM_VECTOR_LEN;
|
|
1888
|
-
wasm.hpkeSealRaw(retptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
2641
|
+
wasm.linkCommitment(retptr, ptr0, len0);
|
|
1889
2642
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1890
2643
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1891
2644
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -1899,22 +2652,16 @@ export function hpkeSealRaw(plaintext, recipient_pub, info) {
|
|
|
1899
2652
|
}
|
|
1900
2653
|
|
|
1901
2654
|
/**
|
|
1902
|
-
*
|
|
1903
|
-
* @param {
|
|
1904
|
-
* @param {Uint8Array} recipient_pub
|
|
1905
|
-
* @param {Uint8Array} info
|
|
2655
|
+
* The 32 bytes of a QR text `{"v":3,"h":"..."}`.
|
|
2656
|
+
* @param {string} qr_text
|
|
1906
2657
|
* @returns {Uint8Array}
|
|
1907
2658
|
*/
|
|
1908
|
-
export function
|
|
2659
|
+
export function linkQrCommitment(qr_text) {
|
|
1909
2660
|
try {
|
|
1910
2661
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1911
|
-
const ptr0 =
|
|
2662
|
+
const ptr0 = passStringToWasm0(qr_text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1912
2663
|
const len0 = WASM_VECTOR_LEN;
|
|
1913
|
-
|
|
1914
|
-
const len1 = WASM_VECTOR_LEN;
|
|
1915
|
-
const ptr2 = passArray8ToWasm0(info, wasm.__wbindgen_export);
|
|
1916
|
-
const len2 = WASM_VECTOR_LEN;
|
|
1917
|
-
wasm.hpkeSealRawPq(retptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
2664
|
+
wasm.linkQrCommitment(retptr, ptr0, len0);
|
|
1918
2665
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1919
2666
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1920
2667
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -1928,18 +2675,42 @@ export function hpkeSealRawPq(plaintext, recipient_pub, info) {
|
|
|
1928
2675
|
}
|
|
1929
2676
|
|
|
1930
2677
|
/**
|
|
1931
|
-
*
|
|
1932
|
-
* @param {
|
|
2678
|
+
* The first backup of a PENDING account (`ping_recovery::make_backup`).
|
|
2679
|
+
* @param {JsStorage} storage
|
|
2680
|
+
* @param {JsPendingRootStore} pending
|
|
2681
|
+
* @param {string} slot
|
|
2682
|
+
* @param {Uint8Array} phrase
|
|
2683
|
+
* @param {Uint8Array} account_id
|
|
2684
|
+
* @param {Uint8Array} host_state
|
|
2685
|
+
* @param {number} now_ms
|
|
2686
|
+
* @returns {Promise<any>}
|
|
2687
|
+
*/
|
|
2688
|
+
export function makeBackup(storage, pending, slot, phrase, account_id, host_state, now_ms) {
|
|
2689
|
+
const ptr0 = passStringToWasm0(slot, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
2690
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2691
|
+
const ptr1 = passArray8ToWasm0(phrase, wasm.__wbindgen_export);
|
|
2692
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2693
|
+
const ptr2 = passArray8ToWasm0(account_id, wasm.__wbindgen_export);
|
|
2694
|
+
const len2 = WASM_VECTOR_LEN;
|
|
2695
|
+
const ptr3 = passArray8ToWasm0(host_state, wasm.__wbindgen_export);
|
|
2696
|
+
const len3 = WASM_VECTOR_LEN;
|
|
2697
|
+
const ret = wasm.makeBackup(addHeapObject(storage), addHeapObject(pending), ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, now_ms);
|
|
2698
|
+
return takeObject(ret);
|
|
2699
|
+
}
|
|
2700
|
+
|
|
2701
|
+
/**
|
|
2702
|
+
* THE normaliser of a typed link code: the 20 characters, or an error.
|
|
2703
|
+
* @param {string} typed
|
|
1933
2704
|
* @returns {string}
|
|
1934
2705
|
*/
|
|
1935
|
-
export function
|
|
2706
|
+
export function normalizeLinkCode(typed) {
|
|
1936
2707
|
let deferred3_0;
|
|
1937
2708
|
let deferred3_1;
|
|
1938
2709
|
try {
|
|
1939
2710
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1940
|
-
const ptr0 = passStringToWasm0(
|
|
2711
|
+
const ptr0 = passStringToWasm0(typed, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1941
2712
|
const len0 = WASM_VECTOR_LEN;
|
|
1942
|
-
wasm.
|
|
2713
|
+
wasm.normalizeLinkCode(retptr, ptr0, len0);
|
|
1943
2714
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1944
2715
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1945
2716
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -1960,53 +2731,59 @@ export function normalizeMnemonicPhrase(phrase) {
|
|
|
1960
2731
|
}
|
|
1961
2732
|
|
|
1962
2733
|
/**
|
|
1963
|
-
*
|
|
1964
|
-
*
|
|
1965
|
-
*
|
|
1966
|
-
* @param {Uint8Array} sealed
|
|
1967
|
-
* @param {Uint8Array} recipient_priv
|
|
1968
|
-
* @param {Uint8Array} sender_identity_pub
|
|
1969
|
-
* @returns {any}
|
|
2734
|
+
* Validate + canonicalise a user-entered phrase (BIP39 wordlist + checksum).
|
|
2735
|
+
* @param {string} phrase
|
|
2736
|
+
* @returns {string}
|
|
1970
2737
|
*/
|
|
1971
|
-
export function
|
|
2738
|
+
export function normalizeMnemonicPhrase(phrase) {
|
|
2739
|
+
let deferred3_0;
|
|
2740
|
+
let deferred3_1;
|
|
1972
2741
|
try {
|
|
1973
2742
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1974
|
-
const ptr0 =
|
|
2743
|
+
const ptr0 = passStringToWasm0(phrase, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1975
2744
|
const len0 = WASM_VECTOR_LEN;
|
|
1976
|
-
|
|
1977
|
-
const len1 = WASM_VECTOR_LEN;
|
|
1978
|
-
const ptr2 = passArray8ToWasm0(sender_identity_pub, wasm.__wbindgen_export);
|
|
1979
|
-
const len2 = WASM_VECTOR_LEN;
|
|
1980
|
-
wasm.openHistoryBundle(retptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
2745
|
+
wasm.normalizeMnemonicPhrase(retptr, ptr0, len0);
|
|
1981
2746
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1982
2747
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1983
2748
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1984
|
-
|
|
1985
|
-
|
|
2749
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
2750
|
+
var ptr2 = r0;
|
|
2751
|
+
var len2 = r1;
|
|
2752
|
+
if (r3) {
|
|
2753
|
+
ptr2 = 0; len2 = 0;
|
|
2754
|
+
throw takeObject(r2);
|
|
1986
2755
|
}
|
|
1987
|
-
|
|
2756
|
+
deferred3_0 = ptr2;
|
|
2757
|
+
deferred3_1 = len2;
|
|
2758
|
+
return getStringFromWasm0(ptr2, len2);
|
|
1988
2759
|
} finally {
|
|
1989
2760
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2761
|
+
wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1);
|
|
1990
2762
|
}
|
|
1991
2763
|
}
|
|
1992
2764
|
|
|
1993
2765
|
/**
|
|
1994
|
-
*
|
|
1995
|
-
*
|
|
1996
|
-
*
|
|
1997
|
-
* @param {Uint8Array}
|
|
2766
|
+
* Step 3 of a restore (`ping_recovery::open_backup_for_restore`). Answers
|
|
2767
|
+
* `{ userId, rootPublicKey, accountId, generation, hostState?,
|
|
2768
|
+
* anchoredConversations }`; writes nothing.
|
|
2769
|
+
* @param {Uint8Array} root_part
|
|
2770
|
+
* @param {Uint8Array} phrase
|
|
2771
|
+
* @param {Uint8Array | null | undefined} state_part
|
|
2772
|
+
* @param {Uint8Array} pinned_root_public_key
|
|
1998
2773
|
* @returns {any}
|
|
1999
2774
|
*/
|
|
2000
|
-
export function
|
|
2775
|
+
export function openBackupForRestore(root_part, phrase, state_part, pinned_root_public_key) {
|
|
2001
2776
|
try {
|
|
2002
2777
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2003
|
-
const ptr0 = passArray8ToWasm0(
|
|
2778
|
+
const ptr0 = passArray8ToWasm0(root_part, wasm.__wbindgen_export);
|
|
2004
2779
|
const len0 = WASM_VECTOR_LEN;
|
|
2005
|
-
const ptr1 = passArray8ToWasm0(
|
|
2780
|
+
const ptr1 = passArray8ToWasm0(phrase, wasm.__wbindgen_export);
|
|
2006
2781
|
const len1 = WASM_VECTOR_LEN;
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2782
|
+
var ptr2 = isLikeNone(state_part) ? 0 : passArray8ToWasm0(state_part, wasm.__wbindgen_export);
|
|
2783
|
+
var len2 = WASM_VECTOR_LEN;
|
|
2784
|
+
const ptr3 = passArray8ToWasm0(pinned_root_public_key, wasm.__wbindgen_export);
|
|
2785
|
+
const len3 = WASM_VECTOR_LEN;
|
|
2786
|
+
wasm.openBackupForRestore(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
2010
2787
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2011
2788
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2012
2789
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -2020,18 +2797,20 @@ export function openHistoryBundlePq(sealed, recipient_priv, sender_identity_pub)
|
|
|
2020
2797
|
}
|
|
2021
2798
|
|
|
2022
2799
|
/**
|
|
2800
|
+
* HPKE-open a sealed version 3 ticket with the new device's X-Wing seed.
|
|
2801
|
+
* NOT yet verified: `completeDeviceLink` runs every check. Opaque error.
|
|
2023
2802
|
* @param {Uint8Array} sealed
|
|
2024
2803
|
* @param {Uint8Array} new_device_priv
|
|
2025
2804
|
* @returns {any}
|
|
2026
2805
|
*/
|
|
2027
|
-
export function
|
|
2806
|
+
export function openLinkingTicketV3(sealed, new_device_priv) {
|
|
2028
2807
|
try {
|
|
2029
2808
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2030
2809
|
const ptr0 = passArray8ToWasm0(sealed, wasm.__wbindgen_export);
|
|
2031
2810
|
const len0 = WASM_VECTOR_LEN;
|
|
2032
2811
|
const ptr1 = passArray8ToWasm0(new_device_priv, wasm.__wbindgen_export);
|
|
2033
2812
|
const len1 = WASM_VECTOR_LEN;
|
|
2034
|
-
wasm.
|
|
2813
|
+
wasm.openLinkingTicketV3(retptr, ptr0, len0, ptr1, len1);
|
|
2035
2814
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2036
2815
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2037
2816
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -2045,30 +2824,18 @@ export function openLinkingTicket(sealed, new_device_priv) {
|
|
|
2045
2824
|
}
|
|
2046
2825
|
|
|
2047
2826
|
/**
|
|
2048
|
-
*
|
|
2049
|
-
*
|
|
2050
|
-
*
|
|
2051
|
-
* @param {
|
|
2052
|
-
* @
|
|
2827
|
+
* Open the account's state part with the generation secret this device
|
|
2828
|
+
* holds and keep its anchors (`ping_recovery::open_state_backup`).
|
|
2829
|
+
* Answers `{ hostState, anchoredConversations }`.
|
|
2830
|
+
* @param {JsStorage} storage
|
|
2831
|
+
* @param {Uint8Array} state_part
|
|
2832
|
+
* @returns {Promise<any>}
|
|
2053
2833
|
*/
|
|
2054
|
-
export function
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
const ptr1 = passArray8ToWasm0(new_device_priv, wasm.__wbindgen_export);
|
|
2060
|
-
const len1 = WASM_VECTOR_LEN;
|
|
2061
|
-
wasm.openLinkingTicketPq(retptr, ptr0, len0, ptr1, len1);
|
|
2062
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2063
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2064
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
2065
|
-
if (r2) {
|
|
2066
|
-
throw takeObject(r1);
|
|
2067
|
-
}
|
|
2068
|
-
return takeObject(r0);
|
|
2069
|
-
} finally {
|
|
2070
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2071
|
-
}
|
|
2834
|
+
export function openStateBackup(storage, state_part) {
|
|
2835
|
+
const ptr0 = passArray8ToWasm0(state_part, wasm.__wbindgen_export);
|
|
2836
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2837
|
+
const ret = wasm.openStateBackup(addHeapObject(storage), ptr0, len0);
|
|
2838
|
+
return takeObject(ret);
|
|
2072
2839
|
}
|
|
2073
2840
|
|
|
2074
2841
|
/**
|
|
@@ -2105,49 +2872,166 @@ export function pbkdf2Sha256(password, salt, iterations, out_len) {
|
|
|
2105
2872
|
}
|
|
2106
2873
|
|
|
2107
2874
|
/**
|
|
2108
|
-
*
|
|
2109
|
-
*
|
|
2110
|
-
*
|
|
2111
|
-
* @param {
|
|
2112
|
-
* @param {
|
|
2113
|
-
* @
|
|
2114
|
-
* @returns {Uint8Array}
|
|
2875
|
+
* `"present"`, `"absent"` or `"mismatch"` (a lost root), with no read of
|
|
2876
|
+
* the seed (`ping_recovery::pending_status`).
|
|
2877
|
+
* @param {JsStorage} storage
|
|
2878
|
+
* @param {JsPendingRootStore} pending
|
|
2879
|
+
* @param {string} slot
|
|
2880
|
+
* @returns {Promise<any>}
|
|
2115
2881
|
*/
|
|
2116
|
-
export function
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
const ptr1 = passArray8ToWasm0(sender_identity_secret, wasm.__wbindgen_export);
|
|
2122
|
-
const len1 = WASM_VECTOR_LEN;
|
|
2123
|
-
wasm.sealHistoryBundle(retptr, addHeapObject(bundle), ptr0, len0, ptr1, len1);
|
|
2124
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2125
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2126
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
2127
|
-
if (r2) {
|
|
2128
|
-
throw takeObject(r1);
|
|
2129
|
-
}
|
|
2130
|
-
return takeObject(r0);
|
|
2131
|
-
} finally {
|
|
2132
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2133
|
-
}
|
|
2882
|
+
export function pendingStatus(storage, pending, slot) {
|
|
2883
|
+
const ptr0 = passStringToWasm0(slot, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
2884
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2885
|
+
const ret = wasm.pendingStatus(addHeapObject(storage), addHeapObject(pending), ptr0, len0);
|
|
2886
|
+
return takeObject(ret);
|
|
2134
2887
|
}
|
|
2135
2888
|
|
|
2136
2889
|
/**
|
|
2137
|
-
*
|
|
2138
|
-
*
|
|
2139
|
-
* @param {
|
|
2140
|
-
* @param {Uint8Array}
|
|
2890
|
+
* Rule R10 (b): the root part READ BACK from its store opens to this
|
|
2891
|
+
* account (`ping_recovery::prove_backup`). Answers `{ fingerprint }`.
|
|
2892
|
+
* @param {JsStorage} storage
|
|
2893
|
+
* @param {Uint8Array} read_back_root_part
|
|
2894
|
+
* @param {Uint8Array} phrase
|
|
2895
|
+
* @returns {Promise<any>}
|
|
2896
|
+
*/
|
|
2897
|
+
export function proveBackup(storage, read_back_root_part, phrase) {
|
|
2898
|
+
const ptr0 = passArray8ToWasm0(read_back_root_part, wasm.__wbindgen_export);
|
|
2899
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2900
|
+
const ptr1 = passArray8ToWasm0(phrase, wasm.__wbindgen_export);
|
|
2901
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2902
|
+
const ret = wasm.proveBackup(addHeapObject(storage), ptr0, len0, ptr1, len1);
|
|
2903
|
+
return takeObject(ret);
|
|
2904
|
+
}
|
|
2905
|
+
|
|
2906
|
+
/**
|
|
2907
|
+
* Write the account's state part anew under the generation secret this
|
|
2908
|
+
* device holds (`ping_recovery::refresh_state_backup`). Answers `{
|
|
2909
|
+
* statePart, droppedAnchors }`.
|
|
2910
|
+
* @param {JsStorage} storage
|
|
2911
|
+
* @param {Uint8Array} account_id
|
|
2912
|
+
* @param {Uint8Array} host_state
|
|
2913
|
+
* @param {number} now_ms
|
|
2914
|
+
* @returns {Promise<any>}
|
|
2915
|
+
*/
|
|
2916
|
+
export function refreshStateBackup(storage, account_id, host_state, now_ms) {
|
|
2917
|
+
const ptr0 = passArray8ToWasm0(account_id, wasm.__wbindgen_export);
|
|
2918
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2919
|
+
const ptr1 = passArray8ToWasm0(host_state, wasm.__wbindgen_export);
|
|
2920
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2921
|
+
const ret = wasm.refreshStateBackup(addHeapObject(storage), ptr0, len0, ptr1, len1, now_ms);
|
|
2922
|
+
return takeObject(ret);
|
|
2923
|
+
}
|
|
2924
|
+
|
|
2925
|
+
/**
|
|
2926
|
+
* M2, join beside the devices that stay (`ping_recovery::restore_join`).
|
|
2927
|
+
* Answers `{ device, credential, hostState }`.
|
|
2928
|
+
* @param {JsStorage} storage
|
|
2929
|
+
* @param {Uint8Array} root_part
|
|
2930
|
+
* @param {Uint8Array} phrase
|
|
2931
|
+
* @param {Uint8Array} state_part
|
|
2932
|
+
* @param {any} start
|
|
2933
|
+
* @param {number} now_ms
|
|
2934
|
+
* @returns {Promise<any>}
|
|
2935
|
+
*/
|
|
2936
|
+
export function restoreJoin(storage, root_part, phrase, state_part, start, now_ms) {
|
|
2937
|
+
const ptr0 = passArray8ToWasm0(root_part, wasm.__wbindgen_export);
|
|
2938
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2939
|
+
const ptr1 = passArray8ToWasm0(phrase, wasm.__wbindgen_export);
|
|
2940
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2941
|
+
const ptr2 = passArray8ToWasm0(state_part, wasm.__wbindgen_export);
|
|
2942
|
+
const len2 = WASM_VECTOR_LEN;
|
|
2943
|
+
const ret = wasm.restoreJoin(addHeapObject(storage), ptr0, len0, ptr1, len1, ptr2, len2, addHeapObject(start), now_ms);
|
|
2944
|
+
return takeObject(ret);
|
|
2945
|
+
}
|
|
2946
|
+
|
|
2947
|
+
/**
|
|
2948
|
+
* M1, take the account over with the backup
|
|
2949
|
+
* (`ping_recovery::restore_take_over`). Answers `{ request, recordId,
|
|
2950
|
+
* newDevice }`.
|
|
2951
|
+
* @param {JsStorage} storage
|
|
2952
|
+
* @param {Uint8Array} root_part
|
|
2953
|
+
* @param {Uint8Array} phrase
|
|
2954
|
+
* @param {any} start
|
|
2955
|
+
* @param {Uint8Array | null | undefined} old_state_part
|
|
2956
|
+
* @param {Uint8Array} account_id
|
|
2957
|
+
* @param {Uint8Array} host_state
|
|
2958
|
+
* @param {number} now_ms
|
|
2959
|
+
* @returns {Promise<any>}
|
|
2960
|
+
*/
|
|
2961
|
+
export function restoreTakeOver(storage, root_part, phrase, start, old_state_part, account_id, host_state, now_ms) {
|
|
2962
|
+
const ptr0 = passArray8ToWasm0(root_part, wasm.__wbindgen_export);
|
|
2963
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2964
|
+
const ptr1 = passArray8ToWasm0(phrase, wasm.__wbindgen_export);
|
|
2965
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2966
|
+
var ptr2 = isLikeNone(old_state_part) ? 0 : passArray8ToWasm0(old_state_part, wasm.__wbindgen_export);
|
|
2967
|
+
var len2 = WASM_VECTOR_LEN;
|
|
2968
|
+
const ptr3 = passArray8ToWasm0(account_id, wasm.__wbindgen_export);
|
|
2969
|
+
const len3 = WASM_VECTOR_LEN;
|
|
2970
|
+
const ptr4 = passArray8ToWasm0(host_state, wasm.__wbindgen_export);
|
|
2971
|
+
const len4 = WASM_VECTOR_LEN;
|
|
2972
|
+
const ret = wasm.restoreTakeOver(addHeapObject(storage), ptr0, len0, ptr1, len1, addHeapObject(start), ptr2, len2, ptr3, len3, ptr4, len4, now_ms);
|
|
2973
|
+
return takeObject(ret);
|
|
2974
|
+
}
|
|
2975
|
+
|
|
2976
|
+
/**
|
|
2977
|
+
* The rotation this device built and has not finished, or `null`
|
|
2978
|
+
* (`ping_recovery::resume_rotation`).
|
|
2979
|
+
* @param {JsStorage} storage
|
|
2980
|
+
* @returns {Promise<any>}
|
|
2981
|
+
*/
|
|
2982
|
+
export function resumeRotation(storage) {
|
|
2983
|
+
const ret = wasm.resumeRotation(addHeapObject(storage));
|
|
2984
|
+
return takeObject(ret);
|
|
2985
|
+
}
|
|
2986
|
+
|
|
2987
|
+
/**
|
|
2988
|
+
* [`resume_rotation`] WITH THE HOST'S CLOCK (ruling V461;
|
|
2989
|
+
* `ping_recovery::resume_rotation_at`): a take-over the server never
|
|
2990
|
+
* answered loses the sealing seed it kept once 30 days have passed since
|
|
2991
|
+
* its record was made.
|
|
2992
|
+
* @param {JsStorage} storage
|
|
2993
|
+
* @param {number} now_ms
|
|
2994
|
+
* @returns {Promise<any>}
|
|
2995
|
+
*/
|
|
2996
|
+
export function resumeRotationAt(storage, now_ms) {
|
|
2997
|
+
const ret = wasm.resumeRotationAt(addHeapObject(storage), now_ms);
|
|
2998
|
+
return takeObject(ret);
|
|
2999
|
+
}
|
|
3000
|
+
|
|
3001
|
+
/**
|
|
3002
|
+
* Ruling V232: whether this store holds a rotation record and whether
|
|
3003
|
+
* the server refused it for good (`ping_recovery::rotation_record_state`).
|
|
3004
|
+
* Answers one of `"no_record"`, `"pending"`, `"adopted"`, `"refused"`,
|
|
3005
|
+
* `"root_part_required"`. One local read; no secret, no id, no request.
|
|
3006
|
+
* @param {JsStorage} storage
|
|
3007
|
+
* @returns {Promise<string>}
|
|
3008
|
+
*/
|
|
3009
|
+
export function rotationRecordState(storage) {
|
|
3010
|
+
const ret = wasm.rotationRecordState(addHeapObject(storage));
|
|
3011
|
+
return takeObject(ret);
|
|
3012
|
+
}
|
|
3013
|
+
|
|
3014
|
+
/**
|
|
3015
|
+
* HPKE-seal the device-linking auth envelope (`ping/link-auth/v2`) to the
|
|
3016
|
+
* X-Wing key of the handshake `payload`, verified here.
|
|
3017
|
+
* @param {Uint8Array} plaintext
|
|
3018
|
+
* @param {Uint8Array} payload
|
|
3019
|
+
* @param {string | null} [expected_code]
|
|
3020
|
+
* @param {Uint8Array | null} [expected_qr]
|
|
2141
3021
|
* @returns {Uint8Array}
|
|
2142
3022
|
*/
|
|
2143
|
-
export function
|
|
3023
|
+
export function sealLinkAuthFor(plaintext, payload, expected_code, expected_qr) {
|
|
2144
3024
|
try {
|
|
2145
3025
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2146
|
-
const ptr0 = passArray8ToWasm0(
|
|
3026
|
+
const ptr0 = passArray8ToWasm0(plaintext, wasm.__wbindgen_export);
|
|
2147
3027
|
const len0 = WASM_VECTOR_LEN;
|
|
2148
|
-
const ptr1 = passArray8ToWasm0(
|
|
3028
|
+
const ptr1 = passArray8ToWasm0(payload, wasm.__wbindgen_export);
|
|
2149
3029
|
const len1 = WASM_VECTOR_LEN;
|
|
2150
|
-
|
|
3030
|
+
var ptr2 = isLikeNone(expected_code) ? 0 : passStringToWasm0(expected_code, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
3031
|
+
var len2 = WASM_VECTOR_LEN;
|
|
3032
|
+
var ptr3 = isLikeNone(expected_qr) ? 0 : passArray8ToWasm0(expected_qr, wasm.__wbindgen_export);
|
|
3033
|
+
var len3 = WASM_VECTOR_LEN;
|
|
3034
|
+
wasm.sealLinkAuthFor(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
2151
3035
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2152
3036
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2153
3037
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -2161,21 +3045,25 @@ export function sealHistoryBundlePq(bundle, recipient_pub, sender_identity_secre
|
|
|
2161
3045
|
}
|
|
2162
3046
|
|
|
2163
3047
|
/**
|
|
2164
|
-
* HPKE-seal a
|
|
2165
|
-
* `
|
|
2166
|
-
*
|
|
2167
|
-
*
|
|
2168
|
-
* `new_device_pub` must be 32 bytes. Returns CBOR-encoded sealed bytes.
|
|
3048
|
+
* HPKE-seal a version 3 ticket to the X-Wing key of the handshake
|
|
3049
|
+
* `payload`, verified here (`ping/link/v2`). Refused when the ticket was
|
|
3050
|
+
* built for another device than the handshake's, or carries group state.
|
|
2169
3051
|
* @param {any} ticket
|
|
2170
|
-
* @param {Uint8Array}
|
|
3052
|
+
* @param {Uint8Array} payload
|
|
3053
|
+
* @param {string | null} [expected_code]
|
|
3054
|
+
* @param {Uint8Array | null} [expected_qr]
|
|
2171
3055
|
* @returns {Uint8Array}
|
|
2172
3056
|
*/
|
|
2173
|
-
export function
|
|
3057
|
+
export function sealLinkingTicketV3For(ticket, payload, expected_code, expected_qr) {
|
|
2174
3058
|
try {
|
|
2175
3059
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2176
|
-
const ptr0 = passArray8ToWasm0(
|
|
3060
|
+
const ptr0 = passArray8ToWasm0(payload, wasm.__wbindgen_export);
|
|
2177
3061
|
const len0 = WASM_VECTOR_LEN;
|
|
2178
|
-
|
|
3062
|
+
var ptr1 = isLikeNone(expected_code) ? 0 : passStringToWasm0(expected_code, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
3063
|
+
var len1 = WASM_VECTOR_LEN;
|
|
3064
|
+
var ptr2 = isLikeNone(expected_qr) ? 0 : passArray8ToWasm0(expected_qr, wasm.__wbindgen_export);
|
|
3065
|
+
var len2 = WASM_VECTOR_LEN;
|
|
3066
|
+
wasm.sealLinkingTicketV3For(retptr, addHeapObject(ticket), ptr0, len0, ptr1, len1, ptr2, len2);
|
|
2179
3067
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2180
3068
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2181
3069
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -2189,46 +3077,49 @@ export function sealLinkingTicket(ticket, new_device_pub) {
|
|
|
2189
3077
|
}
|
|
2190
3078
|
|
|
2191
3079
|
/**
|
|
2192
|
-
*
|
|
2193
|
-
*
|
|
2194
|
-
*
|
|
2195
|
-
* @
|
|
2196
|
-
* @returns {Uint8Array}
|
|
3080
|
+
* The one switch of self-admission as this module was compiled
|
|
3081
|
+
* (`ping_core::SELF_ADMISSION`, a constant of the source: the same value in
|
|
3082
|
+
* every artifact built from one commit). Read-only; nothing sets it.
|
|
3083
|
+
* @returns {boolean}
|
|
2197
3084
|
*/
|
|
2198
|
-
export function
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
3085
|
+
export function selfAdmissionCompiled() {
|
|
3086
|
+
const ret = wasm.selfAdmissionCompiled();
|
|
3087
|
+
return ret !== 0;
|
|
3088
|
+
}
|
|
3089
|
+
|
|
3090
|
+
/**
|
|
3091
|
+
* Move an adopted rotation forward (`ping_recovery::set_rotation_phase`):
|
|
3092
|
+
* `"device_group_done"` or `"queued"`.
|
|
3093
|
+
* @param {JsStorage} storage
|
|
3094
|
+
* @param {Uint8Array} record_id
|
|
3095
|
+
* @param {string} phase
|
|
3096
|
+
* @returns {Promise<void>}
|
|
3097
|
+
*/
|
|
3098
|
+
export function setRotationPhase(storage, record_id, phase) {
|
|
3099
|
+
const ptr0 = passArray8ToWasm0(record_id, wasm.__wbindgen_export);
|
|
3100
|
+
const len0 = WASM_VECTOR_LEN;
|
|
3101
|
+
const ptr1 = passStringToWasm0(phase, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
3102
|
+
const len1 = WASM_VECTOR_LEN;
|
|
3103
|
+
const ret = wasm.setRotationPhase(addHeapObject(storage), ptr0, len0, ptr1, len1);
|
|
3104
|
+
return takeObject(ret);
|
|
2214
3105
|
}
|
|
2215
3106
|
|
|
2216
3107
|
/**
|
|
2217
|
-
* Link verification v2, approving device: approve
|
|
2218
|
-
* server link session with this
|
|
2219
|
-
*
|
|
2220
|
-
*
|
|
2221
|
-
*
|
|
2222
|
-
* width, a non-canonical audience, a small-order or non-canonical new key and
|
|
2223
|
-
* the device's own key; errors name the rejected parameter, never a value.
|
|
3108
|
+
* Link verification v2, approving device: approve the new device of the
|
|
3109
|
+
* handshake `payload`, verified here, on ONE server link session with this
|
|
3110
|
+
* device's signing key. Returns `approver_device_id (32) || new_device_id
|
|
3111
|
+
* (32) || signature (64)`; the JS facade splits it. The signed bytes and
|
|
3112
|
+
* the refusals are `ping_core::device_link`'s.
|
|
2224
3113
|
* @param {Uint8Array} device_signing_secret_key
|
|
2225
3114
|
* @param {Uint8Array} approval_session_id
|
|
2226
3115
|
* @param {Uint8Array} account_id
|
|
2227
|
-
* @param {Uint8Array}
|
|
3116
|
+
* @param {Uint8Array} payload
|
|
3117
|
+
* @param {string | null | undefined} expected_code
|
|
3118
|
+
* @param {Uint8Array | null | undefined} expected_qr
|
|
2228
3119
|
* @param {string} audience
|
|
2229
3120
|
* @returns {Uint8Array}
|
|
2230
3121
|
*/
|
|
2231
|
-
export function
|
|
3122
|
+
export function signDeviceLinkApprovalFor(device_signing_secret_key, approval_session_id, account_id, payload, expected_code, expected_qr, audience) {
|
|
2232
3123
|
try {
|
|
2233
3124
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2234
3125
|
const ptr0 = passArray8ToWasm0(device_signing_secret_key, wasm.__wbindgen_export);
|
|
@@ -2237,11 +3128,15 @@ export function signDeviceLinkApproval(device_signing_secret_key, approval_sessi
|
|
|
2237
3128
|
const len1 = WASM_VECTOR_LEN;
|
|
2238
3129
|
const ptr2 = passArray8ToWasm0(account_id, wasm.__wbindgen_export);
|
|
2239
3130
|
const len2 = WASM_VECTOR_LEN;
|
|
2240
|
-
const ptr3 = passArray8ToWasm0(
|
|
3131
|
+
const ptr3 = passArray8ToWasm0(payload, wasm.__wbindgen_export);
|
|
2241
3132
|
const len3 = WASM_VECTOR_LEN;
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
3133
|
+
var ptr4 = isLikeNone(expected_code) ? 0 : passStringToWasm0(expected_code, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
3134
|
+
var len4 = WASM_VECTOR_LEN;
|
|
3135
|
+
var ptr5 = isLikeNone(expected_qr) ? 0 : passArray8ToWasm0(expected_qr, wasm.__wbindgen_export);
|
|
3136
|
+
var len5 = WASM_VECTOR_LEN;
|
|
3137
|
+
const ptr6 = passStringToWasm0(audience, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
3138
|
+
const len6 = WASM_VECTOR_LEN;
|
|
3139
|
+
wasm.signDeviceLinkApprovalFor(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5, ptr6, len6);
|
|
2245
3140
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2246
3141
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2247
3142
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -2328,6 +3223,69 @@ export function signDeviceReauth(device_signing_secret_key, challenge_id, nonce,
|
|
|
2328
3223
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2329
3224
|
}
|
|
2330
3225
|
}
|
|
3226
|
+
|
|
3227
|
+
/**
|
|
3228
|
+
* "Take your account back": the take-over with the pending item of
|
|
3229
|
+
* `slot` as the root. The item is read, never written and never deleted.
|
|
3230
|
+
* `old_state_part` is the account's state part as the escrow served it
|
|
3231
|
+
* (ruling V436): it gives its anchors only, as in `restoreTakeOver`.
|
|
3232
|
+
* ON AN EMPTY STORE EVERY JOIN IS UNCHECKED: never empty the SDK's store
|
|
3233
|
+
* on the service's word while the slot holds a pending item (ruling V538).
|
|
3234
|
+
* @param {JsStorage} storage
|
|
3235
|
+
* @param {JsPendingRootStore} pending
|
|
3236
|
+
* @param {string} slot
|
|
3237
|
+
* @param {any} start
|
|
3238
|
+
* @param {Uint8Array | null | undefined} old_state_part
|
|
3239
|
+
* @param {Uint8Array} account_id
|
|
3240
|
+
* @param {Uint8Array} host_state
|
|
3241
|
+
* @param {number} now_ms
|
|
3242
|
+
* @returns {Promise<any>}
|
|
3243
|
+
*/
|
|
3244
|
+
export function takeAccountBack(storage, pending, slot, start, old_state_part, account_id, host_state, now_ms) {
|
|
3245
|
+
const ptr0 = passStringToWasm0(slot, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
3246
|
+
const len0 = WASM_VECTOR_LEN;
|
|
3247
|
+
var ptr1 = isLikeNone(old_state_part) ? 0 : passArray8ToWasm0(old_state_part, wasm.__wbindgen_export);
|
|
3248
|
+
var len1 = WASM_VECTOR_LEN;
|
|
3249
|
+
const ptr2 = passArray8ToWasm0(account_id, wasm.__wbindgen_export);
|
|
3250
|
+
const len2 = WASM_VECTOR_LEN;
|
|
3251
|
+
const ptr3 = passArray8ToWasm0(host_state, wasm.__wbindgen_export);
|
|
3252
|
+
const len3 = WASM_VECTOR_LEN;
|
|
3253
|
+
const ret = wasm.takeAccountBack(addHeapObject(storage), addHeapObject(pending), ptr0, len0, addHeapObject(start), ptr1, len1, ptr2, len2, ptr3, len3, now_ms);
|
|
3254
|
+
return takeObject(ret);
|
|
3255
|
+
}
|
|
3256
|
+
|
|
3257
|
+
/**
|
|
3258
|
+
* Verify the handshake a relay returned. Returns `device_id (32) ||
|
|
3259
|
+
* device_signing_pubkey (32) || commitment (32) || by_qr (1)`; the JS facade
|
|
3260
|
+
* splits it. `link commitment mismatch` when the payload is not the one the
|
|
3261
|
+
* code or the QR commits to. A host shows nothing of a handshake and sends
|
|
3262
|
+
* nothing for it before this call succeeded.
|
|
3263
|
+
* @param {Uint8Array} payload
|
|
3264
|
+
* @param {string | null} [expected_code]
|
|
3265
|
+
* @param {Uint8Array | null} [expected_qr]
|
|
3266
|
+
* @returns {Uint8Array}
|
|
3267
|
+
*/
|
|
3268
|
+
export function verifyLinkHandshake(payload, expected_code, expected_qr) {
|
|
3269
|
+
try {
|
|
3270
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
3271
|
+
const ptr0 = passArray8ToWasm0(payload, wasm.__wbindgen_export);
|
|
3272
|
+
const len0 = WASM_VECTOR_LEN;
|
|
3273
|
+
var ptr1 = isLikeNone(expected_code) ? 0 : passStringToWasm0(expected_code, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
3274
|
+
var len1 = WASM_VECTOR_LEN;
|
|
3275
|
+
var ptr2 = isLikeNone(expected_qr) ? 0 : passArray8ToWasm0(expected_qr, wasm.__wbindgen_export);
|
|
3276
|
+
var len2 = WASM_VECTOR_LEN;
|
|
3277
|
+
wasm.verifyLinkHandshake(retptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
3278
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
3279
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
3280
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
3281
|
+
if (r2) {
|
|
3282
|
+
throw takeObject(r1);
|
|
3283
|
+
}
|
|
3284
|
+
return takeObject(r0);
|
|
3285
|
+
} finally {
|
|
3286
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
3287
|
+
}
|
|
3288
|
+
}
|
|
2331
3289
|
function __wbg_get_imports() {
|
|
2332
3290
|
const import0 = {
|
|
2333
3291
|
__proto__: null,
|
|
@@ -2421,7 +3379,7 @@ function __wbg_get_imports() {
|
|
|
2421
3379
|
__wbg__wbg_cb_unref_be22cc64ae6946a0: function(arg0) {
|
|
2422
3380
|
getObject(arg0)._wbg_cb_unref();
|
|
2423
3381
|
},
|
|
2424
|
-
|
|
3382
|
+
__wbg_applyBatch_87e314ccaf20865a: function(arg0, arg1, arg2, arg3, arg4) {
|
|
2425
3383
|
const ret = getObject(arg0).applyBatch(getStringFromWasm0(arg1, arg2), takeObject(arg3), takeObject(arg4));
|
|
2426
3384
|
return addHeapObject(ret);
|
|
2427
3385
|
},
|
|
@@ -2437,11 +3395,19 @@ function __wbg_get_imports() {
|
|
|
2437
3395
|
const ret = getObject(arg0).crypto;
|
|
2438
3396
|
return addHeapObject(ret);
|
|
2439
3397
|
},
|
|
2440
|
-
|
|
3398
|
+
__wbg_del_0c479d62cb407e87: function(arg0, arg1, arg2) {
|
|
3399
|
+
const ret = getObject(arg0).del(getStringFromWasm0(arg1, arg2));
|
|
3400
|
+
return addHeapObject(ret);
|
|
3401
|
+
},
|
|
3402
|
+
__wbg_del_78c266b84aedc16d: function(arg0, arg1, arg2, arg3, arg4) {
|
|
2441
3403
|
const ret = getObject(arg0).del(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
|
|
2442
3404
|
return addHeapObject(ret);
|
|
2443
3405
|
},
|
|
2444
|
-
|
|
3406
|
+
__wbg_devicelinkbegun_new: function(arg0) {
|
|
3407
|
+
const ret = DeviceLinkBegun.__wrap(arg0);
|
|
3408
|
+
return addHeapObject(ret);
|
|
3409
|
+
},
|
|
3410
|
+
__wbg_discoverDevices_31d4118f78ad23cc: function(arg0, arg1) {
|
|
2445
3411
|
const ret = getObject(arg0).discoverDevices(takeObject(arg1));
|
|
2446
3412
|
return addHeapObject(ret);
|
|
2447
3413
|
},
|
|
@@ -2464,18 +3430,34 @@ function __wbg_get_imports() {
|
|
|
2464
3430
|
wasm.__wbindgen_export4(deferred0_0, deferred0_1, 1);
|
|
2465
3431
|
}
|
|
2466
3432
|
},
|
|
2467
|
-
|
|
3433
|
+
__wbg_fetchLogHeads_c29edad7548a54c0: function(arg0) {
|
|
2468
3434
|
const ret = getObject(arg0).fetchLogHeads();
|
|
2469
3435
|
return addHeapObject(ret);
|
|
2470
3436
|
},
|
|
2471
|
-
|
|
3437
|
+
__wbg_fetchLogSince_c3aca07414e7ddee: function(arg0, arg1, arg2) {
|
|
2472
3438
|
const ret = getObject(arg0).fetchLogSince(takeObject(arg1), arg2 >>> 0);
|
|
2473
3439
|
return addHeapObject(ret);
|
|
2474
3440
|
},
|
|
2475
|
-
|
|
3441
|
+
__wbg_fetchSealedGroupInfos_c3906c6f7dec8d44: function(arg0, arg1) {
|
|
3442
|
+
const ret = getObject(arg0).fetchSealedGroupInfos(takeObject(arg1));
|
|
3443
|
+
return addHeapObject(ret);
|
|
3444
|
+
},
|
|
3445
|
+
__wbg_fetchSealingStatements_25636a0c5ae5c743: function(arg0, arg1, arg2) {
|
|
3446
|
+
const ret = getObject(arg0).fetchSealingStatements(takeObject(arg1), takeObject(arg2));
|
|
3447
|
+
return addHeapObject(ret);
|
|
3448
|
+
},
|
|
3449
|
+
__wbg_fetchSelfAdmissionStates_0674e51820be330b: function(arg0, arg1, arg2) {
|
|
3450
|
+
const ret = getObject(arg0).fetchSelfAdmissionStates(takeObject(arg1), takeObject(arg2));
|
|
3451
|
+
return addHeapObject(ret);
|
|
3452
|
+
},
|
|
3453
|
+
__wbg_fetchSince_03e1f48808f5d794: function(arg0, arg1, arg2, arg3) {
|
|
2476
3454
|
const ret = getObject(arg0).fetchSince(takeObject(arg1), takeObject(arg2), arg3 >>> 0);
|
|
2477
3455
|
return addHeapObject(ret);
|
|
2478
3456
|
},
|
|
3457
|
+
__wbg_fill_36c70ae56a83e4f3: function(arg0, arg1, arg2, arg3) {
|
|
3458
|
+
const ret = getObject(arg0).fill(arg1, arg2 >>> 0, arg3 >>> 0);
|
|
3459
|
+
return addHeapObject(ret);
|
|
3460
|
+
},
|
|
2479
3461
|
__wbg_from_74f3d90e0ff11240: function(arg0) {
|
|
2480
3462
|
const ret = Array.from(getObject(arg0));
|
|
2481
3463
|
return addHeapObject(ret);
|
|
@@ -2489,7 +3471,7 @@ function __wbg_get_imports() {
|
|
|
2489
3471
|
__wbg_getRandomValues_c44a50d8cfdaebeb: function() { return handleError(function (arg0, arg1) {
|
|
2490
3472
|
getObject(arg0).getRandomValues(getObject(arg1));
|
|
2491
3473
|
}, arguments); },
|
|
2492
|
-
|
|
3474
|
+
__wbg_get_86edb429c585742d: function(arg0, arg1, arg2, arg3, arg4) {
|
|
2493
3475
|
const ret = getObject(arg0).get(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
|
|
2494
3476
|
return addHeapObject(ret);
|
|
2495
3477
|
},
|
|
@@ -2523,6 +3505,16 @@ function __wbg_get_imports() {
|
|
|
2523
3505
|
const ret = result;
|
|
2524
3506
|
return ret;
|
|
2525
3507
|
},
|
|
3508
|
+
__wbg_instanceof_Map_9a4d6ead180ae3a9: function(arg0) {
|
|
3509
|
+
let result;
|
|
3510
|
+
try {
|
|
3511
|
+
result = getObject(arg0) instanceof Map;
|
|
3512
|
+
} catch (_) {
|
|
3513
|
+
result = false;
|
|
3514
|
+
}
|
|
3515
|
+
const ret = result;
|
|
3516
|
+
return ret;
|
|
3517
|
+
},
|
|
2526
3518
|
__wbg_instanceof_Uint8Array_f935dbb0aa7cdeed: function(arg0) {
|
|
2527
3519
|
let result;
|
|
2528
3520
|
try {
|
|
@@ -2553,11 +3545,11 @@ function __wbg_get_imports() {
|
|
|
2553
3545
|
const ret = getObject(arg0).length;
|
|
2554
3546
|
return ret;
|
|
2555
3547
|
},
|
|
2556
|
-
|
|
3548
|
+
__wbg_listEntries_6107c472b52ebc4d: function(arg0, arg1, arg2, arg3, arg4) {
|
|
2557
3549
|
const ret = getObject(arg0).listEntries(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
|
|
2558
3550
|
return addHeapObject(ret);
|
|
2559
3551
|
},
|
|
2560
|
-
|
|
3552
|
+
__wbg_listKeys_e46828597abcbc4b: function(arg0, arg1, arg2, arg3, arg4) {
|
|
2561
3553
|
const ret = getObject(arg0).listKeys(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
|
|
2562
3554
|
return addHeapObject(ret);
|
|
2563
3555
|
},
|
|
@@ -2592,7 +3584,7 @@ function __wbg_get_imports() {
|
|
|
2592
3584
|
const a = state0.a;
|
|
2593
3585
|
state0.a = 0;
|
|
2594
3586
|
try {
|
|
2595
|
-
return
|
|
3587
|
+
return __wasm_bindgen_func_elem_6271(a, state0.b, arg0, arg1);
|
|
2596
3588
|
} finally {
|
|
2597
3589
|
state0.a = a;
|
|
2598
3590
|
}
|
|
@@ -2634,11 +3626,19 @@ function __wbg_get_imports() {
|
|
|
2634
3626
|
__wbg_prototypesetcall_de8e0d9553586985: function(arg0, arg1, arg2) {
|
|
2635
3627
|
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
|
|
2636
3628
|
},
|
|
3629
|
+
__wbg_publicKey_6adfa2715b24929b: function(arg0, arg1, arg2) {
|
|
3630
|
+
const ret = getObject(arg0).publicKey(getStringFromWasm0(arg1, arg2));
|
|
3631
|
+
return addHeapObject(ret);
|
|
3632
|
+
},
|
|
3633
|
+
__wbg_publishSealedGroupInfo_466a199b9c751e37: function(arg0, arg1) {
|
|
3634
|
+
const ret = getObject(arg0).publishSealedGroupInfo(takeObject(arg1));
|
|
3635
|
+
return addHeapObject(ret);
|
|
3636
|
+
},
|
|
2637
3637
|
__wbg_push_adb0107829f02d75: function(arg0, arg1) {
|
|
2638
3638
|
const ret = getObject(arg0).push(getObject(arg1));
|
|
2639
3639
|
return ret;
|
|
2640
3640
|
},
|
|
2641
|
-
|
|
3641
|
+
__wbg_put_231456dda8b5e17b: function(arg0, arg1, arg2, arg3, arg4, arg5) {
|
|
2642
3642
|
const ret = getObject(arg0).put(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4), takeObject(arg5));
|
|
2643
3643
|
return addHeapObject(ret);
|
|
2644
3644
|
},
|
|
@@ -2652,6 +3652,10 @@ function __wbg_get_imports() {
|
|
|
2652
3652
|
__wbg_randomFillSync_6c25eac9869eb53c: function() { return handleError(function (arg0, arg1) {
|
|
2653
3653
|
getObject(arg0).randomFillSync(takeObject(arg1));
|
|
2654
3654
|
}, arguments); },
|
|
3655
|
+
__wbg_read_980d05de52edc730: function(arg0, arg1, arg2) {
|
|
3656
|
+
const ret = getObject(arg0).read(getStringFromWasm0(arg1, arg2));
|
|
3657
|
+
return addHeapObject(ret);
|
|
3658
|
+
},
|
|
2655
3659
|
__wbg_require_b4edbdcf3e2a1ef0: function() { return handleError(function () {
|
|
2656
3660
|
const ret = module.require;
|
|
2657
3661
|
return addHeapObject(ret);
|
|
@@ -2660,15 +3664,23 @@ function __wbg_get_imports() {
|
|
|
2660
3664
|
const ret = Promise.resolve(getObject(arg0));
|
|
2661
3665
|
return addHeapObject(ret);
|
|
2662
3666
|
},
|
|
2663
|
-
|
|
3667
|
+
__wbg_sendBatch_f2d35a2e7f724c57: function(arg0, arg1) {
|
|
2664
3668
|
const ret = getObject(arg0).sendBatch(takeObject(arg1));
|
|
2665
3669
|
return addHeapObject(ret);
|
|
2666
3670
|
},
|
|
2667
|
-
|
|
3671
|
+
__wbg_sendExternalCommit_f79b36a96c496667: function(arg0, arg1) {
|
|
3672
|
+
const ret = getObject(arg0).sendExternalCommit(takeObject(arg1));
|
|
3673
|
+
return addHeapObject(ret);
|
|
3674
|
+
},
|
|
3675
|
+
__wbg_sendExternalCommits_1a0e192e2f010b41: function(arg0, arg1) {
|
|
3676
|
+
const ret = getObject(arg0).sendExternalCommits(takeObject(arg1));
|
|
3677
|
+
return addHeapObject(ret);
|
|
3678
|
+
},
|
|
3679
|
+
__wbg_send_f805121ec757e485: function(arg0, arg1) {
|
|
2668
3680
|
const ret = getObject(arg0).send(takeObject(arg1));
|
|
2669
3681
|
return addHeapObject(ret);
|
|
2670
3682
|
},
|
|
2671
|
-
|
|
3683
|
+
__wbg_setNextWelcomeRecipients_5dd2b60720fdd3d6: function(arg0, arg1, arg2) {
|
|
2672
3684
|
const ret = getObject(arg0).setNextWelcomeRecipients(takeObject(arg1), takeObject(arg2));
|
|
2673
3685
|
return addHeapObject(ret);
|
|
2674
3686
|
},
|
|
@@ -2725,9 +3737,13 @@ function __wbg_get_imports() {
|
|
|
2725
3737
|
const ret = getObject(arg0).versions;
|
|
2726
3738
|
return addHeapObject(ret);
|
|
2727
3739
|
},
|
|
3740
|
+
__wbg_write_0b23eb5a609d198c: function(arg0, arg1, arg2, arg3, arg4, arg5) {
|
|
3741
|
+
const ret = getObject(arg0).write(getStringFromWasm0(arg1, arg2), getObject(arg3), takeObject(arg4), takeObject(arg5));
|
|
3742
|
+
return addHeapObject(ret);
|
|
3743
|
+
},
|
|
2728
3744
|
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
2729
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx:
|
|
2730
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
3745
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 1380, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
3746
|
+
const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_6256);
|
|
2731
3747
|
return addHeapObject(ret);
|
|
2732
3748
|
},
|
|
2733
3749
|
__wbindgen_cast_0000000000000002: function(arg0) {
|
|
@@ -2735,22 +3751,27 @@ function __wbg_get_imports() {
|
|
|
2735
3751
|
const ret = arg0;
|
|
2736
3752
|
return addHeapObject(ret);
|
|
2737
3753
|
},
|
|
2738
|
-
__wbindgen_cast_0000000000000003: function(arg0
|
|
3754
|
+
__wbindgen_cast_0000000000000003: function(arg0) {
|
|
3755
|
+
// Cast intrinsic for `I64 -> Externref`.
|
|
3756
|
+
const ret = arg0;
|
|
3757
|
+
return addHeapObject(ret);
|
|
3758
|
+
},
|
|
3759
|
+
__wbindgen_cast_0000000000000004: function(arg0, arg1) {
|
|
2739
3760
|
// Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
|
|
2740
3761
|
const ret = getArrayU8FromWasm0(arg0, arg1);
|
|
2741
3762
|
return addHeapObject(ret);
|
|
2742
3763
|
},
|
|
2743
|
-
|
|
3764
|
+
__wbindgen_cast_0000000000000005: function(arg0, arg1) {
|
|
2744
3765
|
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
2745
3766
|
const ret = getStringFromWasm0(arg0, arg1);
|
|
2746
3767
|
return addHeapObject(ret);
|
|
2747
3768
|
},
|
|
2748
|
-
|
|
3769
|
+
__wbindgen_cast_0000000000000006: function(arg0) {
|
|
2749
3770
|
// Cast intrinsic for `U64 -> Externref`.
|
|
2750
3771
|
const ret = BigInt.asUintN(64, arg0);
|
|
2751
3772
|
return addHeapObject(ret);
|
|
2752
3773
|
},
|
|
2753
|
-
|
|
3774
|
+
__wbindgen_cast_0000000000000007: function(arg0, arg1) {
|
|
2754
3775
|
var v0 = getArrayU8FromWasm0(arg0, arg1).slice();
|
|
2755
3776
|
wasm.__wbindgen_export4(arg0, arg1 * 1, 1);
|
|
2756
3777
|
// Cast intrinsic for `Vector(U8) -> Externref`.
|
|
@@ -2771,10 +3792,10 @@ function __wbg_get_imports() {
|
|
|
2771
3792
|
};
|
|
2772
3793
|
}
|
|
2773
3794
|
|
|
2774
|
-
function
|
|
3795
|
+
function __wasm_bindgen_func_elem_6256(arg0, arg1, arg2) {
|
|
2775
3796
|
try {
|
|
2776
3797
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2777
|
-
wasm.
|
|
3798
|
+
wasm.__wasm_bindgen_func_elem_6256(retptr, arg0, arg1, addHeapObject(arg2));
|
|
2778
3799
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2779
3800
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2780
3801
|
if (r1) {
|
|
@@ -2785,10 +3806,16 @@ function __wasm_bindgen_func_elem_4223(arg0, arg1, arg2) {
|
|
|
2785
3806
|
}
|
|
2786
3807
|
}
|
|
2787
3808
|
|
|
2788
|
-
function
|
|
2789
|
-
wasm.
|
|
3809
|
+
function __wasm_bindgen_func_elem_6271(arg0, arg1, arg2, arg3) {
|
|
3810
|
+
wasm.__wasm_bindgen_func_elem_6271(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
2790
3811
|
}
|
|
2791
3812
|
|
|
3813
|
+
const AccountSetupSessionFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
3814
|
+
? { register: () => {}, unregister: () => {} }
|
|
3815
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_accountsetupsession_free(ptr, 1));
|
|
3816
|
+
const DeviceLinkBegunFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
3817
|
+
? { register: () => {}, unregister: () => {} }
|
|
3818
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_devicelinkbegun_free(ptr, 1));
|
|
2792
3819
|
const PingClientFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
2793
3820
|
? { register: () => {}, unregister: () => {} }
|
|
2794
3821
|
: new FinalizationRegistry(ptr => wasm.__wbg_pingclient_free(ptr, 1));
|