@ping-app/ping-openmls-sdk 0.10.2 → 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 +1401 -266
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +999 -145
- package/dist/index.d.ts +999 -145
- package/dist/index.js +1360 -263
- 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-gAmJFSC-.d.cts → types-omhvRjtq.d.cts} +343 -45
- package/dist/{types-gAmJFSC-.d.ts → types-omhvRjtq.d.ts} +343 -45
- package/dist/worker.cjs +686 -69
- package/dist/worker.cjs.map +1 -1
- package/dist/worker.js +716 -80
- package/dist/worker.js.map +1 -1
- package/package.json +1 -1
- package/wasm/package.json +1 -1
- package/wasm/ping_wasm.d.ts +539 -112
- package/wasm/ping_wasm.js +1387 -322
- package/wasm/ping_wasm_bg.wasm +0 -0
- package/wasm/ping_wasm_bg.wasm.d.ts +74 -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
|
/**
|
|
@@ -704,12 +1023,94 @@ export class PingClient {
|
|
|
704
1023
|
return takeObject(ret);
|
|
705
1024
|
}
|
|
706
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
|
+
}
|
|
1083
|
+
/**
|
|
1084
|
+
* @returns {any}
|
|
1085
|
+
*/
|
|
1086
|
+
listConversations() {
|
|
1087
|
+
try {
|
|
1088
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1089
|
+
wasm.pingclient_listConversations(retptr, this.__wbg_ptr);
|
|
1090
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1091
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1092
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1093
|
+
if (r2) {
|
|
1094
|
+
throw takeObject(r1);
|
|
1095
|
+
}
|
|
1096
|
+
return takeObject(r0);
|
|
1097
|
+
} finally {
|
|
1098
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1099
|
+
}
|
|
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
|
|
707
1106
|
* @returns {any}
|
|
708
1107
|
*/
|
|
709
|
-
|
|
1108
|
+
logHoles(conv_id) {
|
|
710
1109
|
try {
|
|
711
1110
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
712
|
-
|
|
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);
|
|
713
1114
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
714
1115
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
715
1116
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -830,9 +1231,38 @@ export class PingClient {
|
|
|
830
1231
|
onMessage(cb) {
|
|
831
1232
|
wasm.pingclient_onMessage(this.__wbg_ptr, addHeapObject(cb));
|
|
832
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>}
|
|
1254
|
+
*/
|
|
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);
|
|
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
|
|
1211
1736
|
* @param {number} now_ms
|
|
1212
1737
|
* @returns {Promise<any>}
|
|
1213
1738
|
*/
|
|
1214
|
-
|
|
1215
|
-
const ptr0 = passArray8ToWasm0(
|
|
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);
|
|
1216
1741
|
const len0 = WASM_VECTOR_LEN;
|
|
1217
|
-
const
|
|
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
|
|
1770
|
+
* @param {number} now_ms
|
|
1771
|
+
* @returns {Promise<any>}
|
|
1772
|
+
*/
|
|
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);
|
|
1775
|
+
const len0 = WASM_VECTOR_LEN;
|
|
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
|
/**
|
|
@@ -1425,52 +2064,88 @@ export function _start() {
|
|
|
1425
2064
|
}
|
|
1426
2065
|
|
|
1427
2066
|
/**
|
|
1428
|
-
*
|
|
1429
|
-
*
|
|
1430
|
-
* (
|
|
1431
|
-
*
|
|
1432
|
-
*
|
|
1433
|
-
*
|
|
1434
|
-
* "tampered ciphertext".
|
|
1435
|
-
* [CR-13] Decode a `LinkingTicket.catchup_snapshot` blob. Pure function; no client
|
|
1436
|
-
* required. The new device calls this after `consumeLinkingTicket` to populate its
|
|
1437
|
-
* initial UI.
|
|
1438
|
-
* @param {Uint8Array} snapshot_bytes
|
|
1439
|
-
* @returns {any}
|
|
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>}
|
|
1440
2073
|
*/
|
|
1441
|
-
export function
|
|
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) {
|
|
1442
2089
|
try {
|
|
1443
2090
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
wasm.
|
|
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);
|
|
1447
2094
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1448
2095
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1449
2096
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1450
2097
|
if (r2) {
|
|
1451
2098
|
throw takeObject(r1);
|
|
1452
2099
|
}
|
|
1453
|
-
return
|
|
2100
|
+
return AccountSetupSession.__wrap(r0);
|
|
1454
2101
|
} finally {
|
|
1455
2102
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1456
2103
|
}
|
|
1457
2104
|
}
|
|
1458
2105
|
|
|
1459
2106
|
/**
|
|
1460
|
-
*
|
|
1461
|
-
*
|
|
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
|
+
|
|
2124
|
+
/**
|
|
2125
|
+
* Whether `mnemonicPhrase` opens `blob`, with THREE answers
|
|
2126
|
+
* (`ping_recovery::check_backup_phrase`). Resolves
|
|
2127
|
+
* `{ outcome: "opens" | "authenticationFailed" | "couldNotCheck", reason? }`,
|
|
2128
|
+
* where `reason` is set exactly for `couldNotCheck`: `"invalidPhrase"`,
|
|
2129
|
+
* `"unsupportedVersion"`, `"malformed"`, `"undecodable"` or `"internal"`. The
|
|
2130
|
+
* codes are the core's (`outcome_code`, `BackupCheckFailure::code`), pinned
|
|
2131
|
+
* there and replayed from one table by `sdk/js`
|
|
2132
|
+
* (`backup-phrase-check.test.ts`).
|
|
2133
|
+
*
|
|
2134
|
+
* `authenticationFailed` is the only proof that the phrase does not open
|
|
2135
|
+
* these bytes; every `couldNotCheck` is a doubt. Never throws for an answer
|
|
2136
|
+
* of the check, returns nothing of the backup, logs nothing.
|
|
1462
2137
|
* @param {Uint8Array} blob
|
|
1463
2138
|
* @param {string} mnemonic_phrase
|
|
1464
2139
|
* @returns {any}
|
|
1465
2140
|
*/
|
|
1466
|
-
export function
|
|
2141
|
+
export function checkBackupPhrase(blob, mnemonic_phrase) {
|
|
1467
2142
|
try {
|
|
1468
2143
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1469
2144
|
const ptr0 = passArray8ToWasm0(blob, wasm.__wbindgen_export);
|
|
1470
2145
|
const len0 = WASM_VECTOR_LEN;
|
|
1471
2146
|
const ptr1 = passStringToWasm0(mnemonic_phrase, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1472
2147
|
const len1 = WASM_VECTOR_LEN;
|
|
1473
|
-
wasm.
|
|
2148
|
+
wasm.checkBackupPhrase(retptr, ptr0, len0, ptr1, len1);
|
|
1474
2149
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1475
2150
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1476
2151
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -1484,49 +2159,61 @@ export function decryptBackup(blob, mnemonic_phrase) {
|
|
|
1484
2159
|
}
|
|
1485
2160
|
|
|
1486
2161
|
/**
|
|
1487
|
-
*
|
|
1488
|
-
* the
|
|
1489
|
-
*
|
|
1490
|
-
*
|
|
1491
|
-
*
|
|
1492
|
-
*
|
|
1493
|
-
*
|
|
1494
|
-
* @param {Uint8Array}
|
|
1495
|
-
* @
|
|
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>}
|
|
1496
2172
|
*/
|
|
1497
|
-
export function
|
|
1498
|
-
const ptr0 = passArray8ToWasm0(
|
|
2173
|
+
export function completeRotation(storage, record_id, answer) {
|
|
2174
|
+
const ptr0 = passArray8ToWasm0(record_id, wasm.__wbindgen_export);
|
|
1499
2175
|
const len0 = WASM_VECTOR_LEN;
|
|
1500
|
-
const ret = wasm.
|
|
2176
|
+
const ret = wasm.completeRotation(addHeapObject(storage), ptr0, len0, addHeapObject(answer));
|
|
1501
2177
|
return takeObject(ret);
|
|
1502
2178
|
}
|
|
1503
2179
|
|
|
1504
2180
|
/**
|
|
1505
|
-
*
|
|
1506
|
-
*
|
|
1507
|
-
*
|
|
1508
|
-
*
|
|
1509
|
-
*
|
|
1510
|
-
*
|
|
1511
|
-
* @param {
|
|
1512
|
-
* @param {
|
|
1513
|
-
* @param {
|
|
1514
|
-
* @param {
|
|
1515
|
-
* @param {
|
|
1516
|
-
* @
|
|
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
|
|
2209
|
+
* @returns {any}
|
|
1517
2210
|
*/
|
|
1518
|
-
export function
|
|
2211
|
+
export function decodeCatchupSnapshot(snapshot_bytes) {
|
|
1519
2212
|
try {
|
|
1520
2213
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1521
|
-
const ptr0 =
|
|
2214
|
+
const ptr0 = passArray8ToWasm0(snapshot_bytes, wasm.__wbindgen_export);
|
|
1522
2215
|
const len0 = WASM_VECTOR_LEN;
|
|
1523
|
-
|
|
1524
|
-
const len1 = WASM_VECTOR_LEN;
|
|
1525
|
-
const ptr2 = passArray8ToWasm0(identity_export, wasm.__wbindgen_export);
|
|
1526
|
-
const len2 = WASM_VECTOR_LEN;
|
|
1527
|
-
const ptr3 = passArray8ToWasm0(device_group_snapshot, wasm.__wbindgen_export);
|
|
1528
|
-
const len3 = WASM_VECTOR_LEN;
|
|
1529
|
-
wasm.encryptBackup(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, addHeapObject(conversation_snapshots), created_at_ms);
|
|
2216
|
+
wasm.decodeCatchupSnapshot(retptr, ptr0, len0);
|
|
1530
2217
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1531
2218
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1532
2219
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -1539,6 +2226,57 @@ export function encryptBackup(mnemonic_phrase, account_id, identity_export, devi
|
|
|
1539
2226
|
}
|
|
1540
2227
|
}
|
|
1541
2228
|
|
|
2229
|
+
/**
|
|
2230
|
+
* The id (16 bytes) of an account's DeviceGroup, the private sync group of
|
|
2231
|
+
* the account's own devices, derived by the core from the account's MLS
|
|
2232
|
+
* user id (`core::device_group_id_for`). `user_id` is `userId()` (32
|
|
2233
|
+
* bytes), NOT the server's account id. Deterministic: every device of the
|
|
2234
|
+
* account derives the same id, so a host recognises the DeviceGroup
|
|
2235
|
+
* without copying the derivation. Pure, never throws; bytes that are not
|
|
2236
|
+
* an MLS user id derive an id no device uses.
|
|
2237
|
+
* @param {Uint8Array} user_id
|
|
2238
|
+
* @returns {Uint8Array}
|
|
2239
|
+
*/
|
|
2240
|
+
export function deviceGroupIdFor(user_id) {
|
|
2241
|
+
const ptr0 = passArray8ToWasm0(user_id, wasm.__wbindgen_export);
|
|
2242
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2243
|
+
const ret = wasm.deviceGroupIdFor(ptr0, len0);
|
|
2244
|
+
return takeObject(ret);
|
|
2245
|
+
}
|
|
2246
|
+
|
|
2247
|
+
/**
|
|
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>}
|
|
2256
|
+
*/
|
|
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);
|
|
2278
|
+
}
|
|
2279
|
+
|
|
1542
2280
|
/**
|
|
1543
2281
|
* Generate a fresh 12-word BIP39 mnemonic, returned as its canonical phrase string.
|
|
1544
2282
|
* @returns {string}
|
|
@@ -1828,26 +2566,79 @@ export function hpkeSealPq(plaintext, recipient_pub, info) {
|
|
|
1828
2566
|
}
|
|
1829
2567
|
|
|
1830
2568
|
/**
|
|
1831
|
-
* HPKE-Base seal in the RFC 9180 CANONICAL layout, `enc || ct||tag`, no CBOR
|
|
1832
|
-
* wrapper. See `hpke_seal_raw` in `ping-link` for why this exists beside
|
|
1833
|
-
* [`hpke_seal`]: it is the layout iOS, Android, web and the third-party
|
|
1834
|
-
* `ping-notify` sender each hand-composed because the CBOR form could not read
|
|
1835
|
-
* it.
|
|
1836
|
-
* @param {Uint8Array} plaintext
|
|
1837
|
-
* @param {Uint8Array} recipient_pub
|
|
1838
|
-
* @param {Uint8Array} info
|
|
1839
|
-
* @returns {Uint8Array}
|
|
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`.
|
|
2603
|
+
* @param {Uint8Array} plaintext
|
|
2604
|
+
* @param {Uint8Array} recipient_pub
|
|
2605
|
+
* @param {Uint8Array} info
|
|
2606
|
+
* @returns {Uint8Array}
|
|
2607
|
+
*/
|
|
2608
|
+
export function hpkeSealRawPq(plaintext, recipient_pub, info) {
|
|
2609
|
+
try {
|
|
2610
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2611
|
+
const ptr0 = passArray8ToWasm0(plaintext, wasm.__wbindgen_export);
|
|
2612
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2613
|
+
const ptr1 = passArray8ToWasm0(recipient_pub, wasm.__wbindgen_export);
|
|
2614
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2615
|
+
const ptr2 = passArray8ToWasm0(info, wasm.__wbindgen_export);
|
|
2616
|
+
const len2 = WASM_VECTOR_LEN;
|
|
2617
|
+
wasm.hpkeSealRawPq(retptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
2618
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2619
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2620
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
2621
|
+
if (r2) {
|
|
2622
|
+
throw takeObject(r1);
|
|
2623
|
+
}
|
|
2624
|
+
return takeObject(r0);
|
|
2625
|
+
} finally {
|
|
2626
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2627
|
+
}
|
|
2628
|
+
}
|
|
2629
|
+
|
|
2630
|
+
/**
|
|
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>}
|
|
1840
2635
|
*/
|
|
1841
|
-
export function
|
|
2636
|
+
export function linkCommitment(payload) {
|
|
1842
2637
|
try {
|
|
1843
2638
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1844
|
-
const ptr0 = passArray8ToWasm0(
|
|
2639
|
+
const ptr0 = passArray8ToWasm0(payload, wasm.__wbindgen_export);
|
|
1845
2640
|
const len0 = WASM_VECTOR_LEN;
|
|
1846
|
-
|
|
1847
|
-
const len1 = WASM_VECTOR_LEN;
|
|
1848
|
-
const ptr2 = passArray8ToWasm0(info, wasm.__wbindgen_export);
|
|
1849
|
-
const len2 = WASM_VECTOR_LEN;
|
|
1850
|
-
wasm.hpkeSealRaw(retptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
2641
|
+
wasm.linkCommitment(retptr, ptr0, len0);
|
|
1851
2642
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1852
2643
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1853
2644
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -1861,22 +2652,16 @@ export function hpkeSealRaw(plaintext, recipient_pub, info) {
|
|
|
1861
2652
|
}
|
|
1862
2653
|
|
|
1863
2654
|
/**
|
|
1864
|
-
*
|
|
1865
|
-
* @param {
|
|
1866
|
-
* @param {Uint8Array} recipient_pub
|
|
1867
|
-
* @param {Uint8Array} info
|
|
2655
|
+
* The 32 bytes of a QR text `{"v":3,"h":"..."}`.
|
|
2656
|
+
* @param {string} qr_text
|
|
1868
2657
|
* @returns {Uint8Array}
|
|
1869
2658
|
*/
|
|
1870
|
-
export function
|
|
2659
|
+
export function linkQrCommitment(qr_text) {
|
|
1871
2660
|
try {
|
|
1872
2661
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1873
|
-
const ptr0 =
|
|
2662
|
+
const ptr0 = passStringToWasm0(qr_text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1874
2663
|
const len0 = WASM_VECTOR_LEN;
|
|
1875
|
-
|
|
1876
|
-
const len1 = WASM_VECTOR_LEN;
|
|
1877
|
-
const ptr2 = passArray8ToWasm0(info, wasm.__wbindgen_export);
|
|
1878
|
-
const len2 = WASM_VECTOR_LEN;
|
|
1879
|
-
wasm.hpkeSealRawPq(retptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
2664
|
+
wasm.linkQrCommitment(retptr, ptr0, len0);
|
|
1880
2665
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1881
2666
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1882
2667
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -1890,18 +2675,42 @@ export function hpkeSealRawPq(plaintext, recipient_pub, info) {
|
|
|
1890
2675
|
}
|
|
1891
2676
|
|
|
1892
2677
|
/**
|
|
1893
|
-
*
|
|
1894
|
-
* @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
|
|
1895
2704
|
* @returns {string}
|
|
1896
2705
|
*/
|
|
1897
|
-
export function
|
|
2706
|
+
export function normalizeLinkCode(typed) {
|
|
1898
2707
|
let deferred3_0;
|
|
1899
2708
|
let deferred3_1;
|
|
1900
2709
|
try {
|
|
1901
2710
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1902
|
-
const ptr0 = passStringToWasm0(
|
|
2711
|
+
const ptr0 = passStringToWasm0(typed, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1903
2712
|
const len0 = WASM_VECTOR_LEN;
|
|
1904
|
-
wasm.
|
|
2713
|
+
wasm.normalizeLinkCode(retptr, ptr0, len0);
|
|
1905
2714
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1906
2715
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1907
2716
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -1922,53 +2731,59 @@ export function normalizeMnemonicPhrase(phrase) {
|
|
|
1922
2731
|
}
|
|
1923
2732
|
|
|
1924
2733
|
/**
|
|
1925
|
-
*
|
|
1926
|
-
*
|
|
1927
|
-
*
|
|
1928
|
-
* @param {Uint8Array} sealed
|
|
1929
|
-
* @param {Uint8Array} recipient_priv
|
|
1930
|
-
* @param {Uint8Array} sender_identity_pub
|
|
1931
|
-
* @returns {any}
|
|
2734
|
+
* Validate + canonicalise a user-entered phrase (BIP39 wordlist + checksum).
|
|
2735
|
+
* @param {string} phrase
|
|
2736
|
+
* @returns {string}
|
|
1932
2737
|
*/
|
|
1933
|
-
export function
|
|
2738
|
+
export function normalizeMnemonicPhrase(phrase) {
|
|
2739
|
+
let deferred3_0;
|
|
2740
|
+
let deferred3_1;
|
|
1934
2741
|
try {
|
|
1935
2742
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1936
|
-
const ptr0 =
|
|
2743
|
+
const ptr0 = passStringToWasm0(phrase, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1937
2744
|
const len0 = WASM_VECTOR_LEN;
|
|
1938
|
-
|
|
1939
|
-
const len1 = WASM_VECTOR_LEN;
|
|
1940
|
-
const ptr2 = passArray8ToWasm0(sender_identity_pub, wasm.__wbindgen_export);
|
|
1941
|
-
const len2 = WASM_VECTOR_LEN;
|
|
1942
|
-
wasm.openHistoryBundle(retptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
2745
|
+
wasm.normalizeMnemonicPhrase(retptr, ptr0, len0);
|
|
1943
2746
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1944
2747
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1945
2748
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1946
|
-
|
|
1947
|
-
|
|
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);
|
|
1948
2755
|
}
|
|
1949
|
-
|
|
2756
|
+
deferred3_0 = ptr2;
|
|
2757
|
+
deferred3_1 = len2;
|
|
2758
|
+
return getStringFromWasm0(ptr2, len2);
|
|
1950
2759
|
} finally {
|
|
1951
2760
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2761
|
+
wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1);
|
|
1952
2762
|
}
|
|
1953
2763
|
}
|
|
1954
2764
|
|
|
1955
2765
|
/**
|
|
1956
|
-
*
|
|
1957
|
-
*
|
|
1958
|
-
*
|
|
1959
|
-
* @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
|
|
1960
2773
|
* @returns {any}
|
|
1961
2774
|
*/
|
|
1962
|
-
export function
|
|
2775
|
+
export function openBackupForRestore(root_part, phrase, state_part, pinned_root_public_key) {
|
|
1963
2776
|
try {
|
|
1964
2777
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1965
|
-
const ptr0 = passArray8ToWasm0(
|
|
2778
|
+
const ptr0 = passArray8ToWasm0(root_part, wasm.__wbindgen_export);
|
|
1966
2779
|
const len0 = WASM_VECTOR_LEN;
|
|
1967
|
-
const ptr1 = passArray8ToWasm0(
|
|
2780
|
+
const ptr1 = passArray8ToWasm0(phrase, wasm.__wbindgen_export);
|
|
1968
2781
|
const len1 = WASM_VECTOR_LEN;
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
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);
|
|
1972
2787
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1973
2788
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1974
2789
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -1982,18 +2797,20 @@ export function openHistoryBundlePq(sealed, recipient_priv, sender_identity_pub)
|
|
|
1982
2797
|
}
|
|
1983
2798
|
|
|
1984
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.
|
|
1985
2802
|
* @param {Uint8Array} sealed
|
|
1986
2803
|
* @param {Uint8Array} new_device_priv
|
|
1987
2804
|
* @returns {any}
|
|
1988
2805
|
*/
|
|
1989
|
-
export function
|
|
2806
|
+
export function openLinkingTicketV3(sealed, new_device_priv) {
|
|
1990
2807
|
try {
|
|
1991
2808
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1992
2809
|
const ptr0 = passArray8ToWasm0(sealed, wasm.__wbindgen_export);
|
|
1993
2810
|
const len0 = WASM_VECTOR_LEN;
|
|
1994
2811
|
const ptr1 = passArray8ToWasm0(new_device_priv, wasm.__wbindgen_export);
|
|
1995
2812
|
const len1 = WASM_VECTOR_LEN;
|
|
1996
|
-
wasm.
|
|
2813
|
+
wasm.openLinkingTicketV3(retptr, ptr0, len0, ptr1, len1);
|
|
1997
2814
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1998
2815
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1999
2816
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -2007,30 +2824,18 @@ export function openLinkingTicket(sealed, new_device_priv) {
|
|
|
2007
2824
|
}
|
|
2008
2825
|
|
|
2009
2826
|
/**
|
|
2010
|
-
*
|
|
2011
|
-
*
|
|
2012
|
-
*
|
|
2013
|
-
* @param {
|
|
2014
|
-
* @
|
|
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>}
|
|
2015
2833
|
*/
|
|
2016
|
-
export function
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
const ptr1 = passArray8ToWasm0(new_device_priv, wasm.__wbindgen_export);
|
|
2022
|
-
const len1 = WASM_VECTOR_LEN;
|
|
2023
|
-
wasm.openLinkingTicketPq(retptr, ptr0, len0, ptr1, len1);
|
|
2024
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2025
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2026
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
2027
|
-
if (r2) {
|
|
2028
|
-
throw takeObject(r1);
|
|
2029
|
-
}
|
|
2030
|
-
return takeObject(r0);
|
|
2031
|
-
} finally {
|
|
2032
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2033
|
-
}
|
|
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);
|
|
2034
2839
|
}
|
|
2035
2840
|
|
|
2036
2841
|
/**
|
|
@@ -2067,49 +2872,166 @@ export function pbkdf2Sha256(password, salt, iterations, out_len) {
|
|
|
2067
2872
|
}
|
|
2068
2873
|
|
|
2069
2874
|
/**
|
|
2070
|
-
*
|
|
2071
|
-
*
|
|
2072
|
-
*
|
|
2073
|
-
* @param {
|
|
2074
|
-
* @param {
|
|
2075
|
-
* @
|
|
2076
|
-
* @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>}
|
|
2077
2881
|
*/
|
|
2078
|
-
export function
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
const ptr1 = passArray8ToWasm0(sender_identity_secret, wasm.__wbindgen_export);
|
|
2084
|
-
const len1 = WASM_VECTOR_LEN;
|
|
2085
|
-
wasm.sealHistoryBundle(retptr, addHeapObject(bundle), ptr0, len0, ptr1, len1);
|
|
2086
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2087
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2088
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
2089
|
-
if (r2) {
|
|
2090
|
-
throw takeObject(r1);
|
|
2091
|
-
}
|
|
2092
|
-
return takeObject(r0);
|
|
2093
|
-
} finally {
|
|
2094
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2095
|
-
}
|
|
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);
|
|
2096
2887
|
}
|
|
2097
2888
|
|
|
2098
2889
|
/**
|
|
2099
|
-
*
|
|
2100
|
-
*
|
|
2101
|
-
* @param {
|
|
2102
|
-
* @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]
|
|
2103
3021
|
* @returns {Uint8Array}
|
|
2104
3022
|
*/
|
|
2105
|
-
export function
|
|
3023
|
+
export function sealLinkAuthFor(plaintext, payload, expected_code, expected_qr) {
|
|
2106
3024
|
try {
|
|
2107
3025
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2108
|
-
const ptr0 = passArray8ToWasm0(
|
|
3026
|
+
const ptr0 = passArray8ToWasm0(plaintext, wasm.__wbindgen_export);
|
|
2109
3027
|
const len0 = WASM_VECTOR_LEN;
|
|
2110
|
-
const ptr1 = passArray8ToWasm0(
|
|
3028
|
+
const ptr1 = passArray8ToWasm0(payload, wasm.__wbindgen_export);
|
|
2111
3029
|
const len1 = WASM_VECTOR_LEN;
|
|
2112
|
-
|
|
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);
|
|
2113
3035
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2114
3036
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2115
3037
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -2123,21 +3045,25 @@ export function sealHistoryBundlePq(bundle, recipient_pub, sender_identity_secre
|
|
|
2123
3045
|
}
|
|
2124
3046
|
|
|
2125
3047
|
/**
|
|
2126
|
-
* HPKE-seal a
|
|
2127
|
-
* `
|
|
2128
|
-
*
|
|
2129
|
-
*
|
|
2130
|
-
* `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.
|
|
2131
3051
|
* @param {any} ticket
|
|
2132
|
-
* @param {Uint8Array}
|
|
3052
|
+
* @param {Uint8Array} payload
|
|
3053
|
+
* @param {string | null} [expected_code]
|
|
3054
|
+
* @param {Uint8Array | null} [expected_qr]
|
|
2133
3055
|
* @returns {Uint8Array}
|
|
2134
3056
|
*/
|
|
2135
|
-
export function
|
|
3057
|
+
export function sealLinkingTicketV3For(ticket, payload, expected_code, expected_qr) {
|
|
2136
3058
|
try {
|
|
2137
3059
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2138
|
-
const ptr0 = passArray8ToWasm0(
|
|
3060
|
+
const ptr0 = passArray8ToWasm0(payload, wasm.__wbindgen_export);
|
|
2139
3061
|
const len0 = WASM_VECTOR_LEN;
|
|
2140
|
-
|
|
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);
|
|
2141
3067
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2142
3068
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2143
3069
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -2151,46 +3077,49 @@ export function sealLinkingTicket(ticket, new_device_pub) {
|
|
|
2151
3077
|
}
|
|
2152
3078
|
|
|
2153
3079
|
/**
|
|
2154
|
-
*
|
|
2155
|
-
*
|
|
2156
|
-
*
|
|
2157
|
-
* @
|
|
2158
|
-
* @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}
|
|
2159
3084
|
*/
|
|
2160
|
-
export function
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
const ptr0 = passArray8ToWasm0(new_device_pub, wasm.__wbindgen_export);
|
|
2164
|
-
const len0 = WASM_VECTOR_LEN;
|
|
2165
|
-
wasm.sealLinkingTicketPq(retptr, addHeapObject(ticket), ptr0, len0);
|
|
2166
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2167
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2168
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
2169
|
-
if (r2) {
|
|
2170
|
-
throw takeObject(r1);
|
|
2171
|
-
}
|
|
2172
|
-
return takeObject(r0);
|
|
2173
|
-
} finally {
|
|
2174
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2175
|
-
}
|
|
3085
|
+
export function selfAdmissionCompiled() {
|
|
3086
|
+
const ret = wasm.selfAdmissionCompiled();
|
|
3087
|
+
return ret !== 0;
|
|
2176
3088
|
}
|
|
2177
3089
|
|
|
2178
3090
|
/**
|
|
2179
|
-
*
|
|
2180
|
-
*
|
|
2181
|
-
*
|
|
2182
|
-
*
|
|
2183
|
-
*
|
|
2184
|
-
*
|
|
2185
|
-
|
|
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);
|
|
3105
|
+
}
|
|
3106
|
+
|
|
3107
|
+
/**
|
|
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.
|
|
2186
3113
|
* @param {Uint8Array} device_signing_secret_key
|
|
2187
3114
|
* @param {Uint8Array} approval_session_id
|
|
2188
3115
|
* @param {Uint8Array} account_id
|
|
2189
|
-
* @param {Uint8Array}
|
|
3116
|
+
* @param {Uint8Array} payload
|
|
3117
|
+
* @param {string | null | undefined} expected_code
|
|
3118
|
+
* @param {Uint8Array | null | undefined} expected_qr
|
|
2190
3119
|
* @param {string} audience
|
|
2191
3120
|
* @returns {Uint8Array}
|
|
2192
3121
|
*/
|
|
2193
|
-
export function
|
|
3122
|
+
export function signDeviceLinkApprovalFor(device_signing_secret_key, approval_session_id, account_id, payload, expected_code, expected_qr, audience) {
|
|
2194
3123
|
try {
|
|
2195
3124
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2196
3125
|
const ptr0 = passArray8ToWasm0(device_signing_secret_key, wasm.__wbindgen_export);
|
|
@@ -2199,11 +3128,15 @@ export function signDeviceLinkApproval(device_signing_secret_key, approval_sessi
|
|
|
2199
3128
|
const len1 = WASM_VECTOR_LEN;
|
|
2200
3129
|
const ptr2 = passArray8ToWasm0(account_id, wasm.__wbindgen_export);
|
|
2201
3130
|
const len2 = WASM_VECTOR_LEN;
|
|
2202
|
-
const ptr3 = passArray8ToWasm0(
|
|
3131
|
+
const ptr3 = passArray8ToWasm0(payload, wasm.__wbindgen_export);
|
|
2203
3132
|
const len3 = WASM_VECTOR_LEN;
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
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);
|
|
2207
3140
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2208
3141
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2209
3142
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -2290,6 +3223,69 @@ export function signDeviceReauth(device_signing_secret_key, challenge_id, nonce,
|
|
|
2290
3223
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2291
3224
|
}
|
|
2292
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
|
+
}
|
|
2293
3289
|
function __wbg_get_imports() {
|
|
2294
3290
|
const import0 = {
|
|
2295
3291
|
__proto__: null,
|
|
@@ -2383,7 +3379,7 @@ function __wbg_get_imports() {
|
|
|
2383
3379
|
__wbg__wbg_cb_unref_be22cc64ae6946a0: function(arg0) {
|
|
2384
3380
|
getObject(arg0)._wbg_cb_unref();
|
|
2385
3381
|
},
|
|
2386
|
-
|
|
3382
|
+
__wbg_applyBatch_87e314ccaf20865a: function(arg0, arg1, arg2, arg3, arg4) {
|
|
2387
3383
|
const ret = getObject(arg0).applyBatch(getStringFromWasm0(arg1, arg2), takeObject(arg3), takeObject(arg4));
|
|
2388
3384
|
return addHeapObject(ret);
|
|
2389
3385
|
},
|
|
@@ -2399,11 +3395,19 @@ function __wbg_get_imports() {
|
|
|
2399
3395
|
const ret = getObject(arg0).crypto;
|
|
2400
3396
|
return addHeapObject(ret);
|
|
2401
3397
|
},
|
|
2402
|
-
|
|
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) {
|
|
2403
3403
|
const ret = getObject(arg0).del(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
|
|
2404
3404
|
return addHeapObject(ret);
|
|
2405
3405
|
},
|
|
2406
|
-
|
|
3406
|
+
__wbg_devicelinkbegun_new: function(arg0) {
|
|
3407
|
+
const ret = DeviceLinkBegun.__wrap(arg0);
|
|
3408
|
+
return addHeapObject(ret);
|
|
3409
|
+
},
|
|
3410
|
+
__wbg_discoverDevices_31d4118f78ad23cc: function(arg0, arg1) {
|
|
2407
3411
|
const ret = getObject(arg0).discoverDevices(takeObject(arg1));
|
|
2408
3412
|
return addHeapObject(ret);
|
|
2409
3413
|
},
|
|
@@ -2426,18 +3430,34 @@ function __wbg_get_imports() {
|
|
|
2426
3430
|
wasm.__wbindgen_export4(deferred0_0, deferred0_1, 1);
|
|
2427
3431
|
}
|
|
2428
3432
|
},
|
|
2429
|
-
|
|
3433
|
+
__wbg_fetchLogHeads_c29edad7548a54c0: function(arg0) {
|
|
2430
3434
|
const ret = getObject(arg0).fetchLogHeads();
|
|
2431
3435
|
return addHeapObject(ret);
|
|
2432
3436
|
},
|
|
2433
|
-
|
|
3437
|
+
__wbg_fetchLogSince_c3aca07414e7ddee: function(arg0, arg1, arg2) {
|
|
2434
3438
|
const ret = getObject(arg0).fetchLogSince(takeObject(arg1), arg2 >>> 0);
|
|
2435
3439
|
return addHeapObject(ret);
|
|
2436
3440
|
},
|
|
2437
|
-
|
|
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) {
|
|
2438
3454
|
const ret = getObject(arg0).fetchSince(takeObject(arg1), takeObject(arg2), arg3 >>> 0);
|
|
2439
3455
|
return addHeapObject(ret);
|
|
2440
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
|
+
},
|
|
2441
3461
|
__wbg_from_74f3d90e0ff11240: function(arg0) {
|
|
2442
3462
|
const ret = Array.from(getObject(arg0));
|
|
2443
3463
|
return addHeapObject(ret);
|
|
@@ -2451,6 +3471,10 @@ function __wbg_get_imports() {
|
|
|
2451
3471
|
__wbg_getRandomValues_c44a50d8cfdaebeb: function() { return handleError(function (arg0, arg1) {
|
|
2452
3472
|
getObject(arg0).getRandomValues(getObject(arg1));
|
|
2453
3473
|
}, arguments); },
|
|
3474
|
+
__wbg_get_86edb429c585742d: function(arg0, arg1, arg2, arg3, arg4) {
|
|
3475
|
+
const ret = getObject(arg0).get(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
|
|
3476
|
+
return addHeapObject(ret);
|
|
3477
|
+
},
|
|
2454
3478
|
__wbg_get_971a0c45d172643f: function() { return handleError(function (arg0, arg1) {
|
|
2455
3479
|
const ret = Reflect.get(getObject(arg0), getObject(arg1));
|
|
2456
3480
|
return addHeapObject(ret);
|
|
@@ -2463,10 +3487,6 @@ function __wbg_get_imports() {
|
|
|
2463
3487
|
const ret = Reflect.get(getObject(arg0), getObject(arg1));
|
|
2464
3488
|
return addHeapObject(ret);
|
|
2465
3489
|
}, arguments); },
|
|
2466
|
-
__wbg_get_fda3c223a9e9bd0c: function(arg0, arg1, arg2, arg3, arg4) {
|
|
2467
|
-
const ret = getObject(arg0).get(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
|
|
2468
|
-
return addHeapObject(ret);
|
|
2469
|
-
},
|
|
2470
3490
|
__wbg_get_unchecked_e20b893aeafc3fca: function(arg0, arg1) {
|
|
2471
3491
|
const ret = getObject(arg0)[arg1 >>> 0];
|
|
2472
3492
|
return addHeapObject(ret);
|
|
@@ -2485,6 +3505,16 @@ function __wbg_get_imports() {
|
|
|
2485
3505
|
const ret = result;
|
|
2486
3506
|
return ret;
|
|
2487
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
|
+
},
|
|
2488
3518
|
__wbg_instanceof_Uint8Array_f935dbb0aa7cdeed: function(arg0) {
|
|
2489
3519
|
let result;
|
|
2490
3520
|
try {
|
|
@@ -2515,11 +3545,11 @@ function __wbg_get_imports() {
|
|
|
2515
3545
|
const ret = getObject(arg0).length;
|
|
2516
3546
|
return ret;
|
|
2517
3547
|
},
|
|
2518
|
-
|
|
3548
|
+
__wbg_listEntries_6107c472b52ebc4d: function(arg0, arg1, arg2, arg3, arg4) {
|
|
2519
3549
|
const ret = getObject(arg0).listEntries(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
|
|
2520
3550
|
return addHeapObject(ret);
|
|
2521
3551
|
},
|
|
2522
|
-
|
|
3552
|
+
__wbg_listKeys_e46828597abcbc4b: function(arg0, arg1, arg2, arg3, arg4) {
|
|
2523
3553
|
const ret = getObject(arg0).listKeys(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
|
|
2524
3554
|
return addHeapObject(ret);
|
|
2525
3555
|
},
|
|
@@ -2554,7 +3584,7 @@ function __wbg_get_imports() {
|
|
|
2554
3584
|
const a = state0.a;
|
|
2555
3585
|
state0.a = 0;
|
|
2556
3586
|
try {
|
|
2557
|
-
return
|
|
3587
|
+
return __wasm_bindgen_func_elem_6271(a, state0.b, arg0, arg1);
|
|
2558
3588
|
} finally {
|
|
2559
3589
|
state0.a = a;
|
|
2560
3590
|
}
|
|
@@ -2596,11 +3626,19 @@ function __wbg_get_imports() {
|
|
|
2596
3626
|
__wbg_prototypesetcall_de8e0d9553586985: function(arg0, arg1, arg2) {
|
|
2597
3627
|
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
|
|
2598
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
|
+
},
|
|
2599
3637
|
__wbg_push_adb0107829f02d75: function(arg0, arg1) {
|
|
2600
3638
|
const ret = getObject(arg0).push(getObject(arg1));
|
|
2601
3639
|
return ret;
|
|
2602
3640
|
},
|
|
2603
|
-
|
|
3641
|
+
__wbg_put_231456dda8b5e17b: function(arg0, arg1, arg2, arg3, arg4, arg5) {
|
|
2604
3642
|
const ret = getObject(arg0).put(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4), takeObject(arg5));
|
|
2605
3643
|
return addHeapObject(ret);
|
|
2606
3644
|
},
|
|
@@ -2614,6 +3652,10 @@ function __wbg_get_imports() {
|
|
|
2614
3652
|
__wbg_randomFillSync_6c25eac9869eb53c: function() { return handleError(function (arg0, arg1) {
|
|
2615
3653
|
getObject(arg0).randomFillSync(takeObject(arg1));
|
|
2616
3654
|
}, arguments); },
|
|
3655
|
+
__wbg_read_980d05de52edc730: function(arg0, arg1, arg2) {
|
|
3656
|
+
const ret = getObject(arg0).read(getStringFromWasm0(arg1, arg2));
|
|
3657
|
+
return addHeapObject(ret);
|
|
3658
|
+
},
|
|
2617
3659
|
__wbg_require_b4edbdcf3e2a1ef0: function() { return handleError(function () {
|
|
2618
3660
|
const ret = module.require;
|
|
2619
3661
|
return addHeapObject(ret);
|
|
@@ -2622,15 +3664,23 @@ function __wbg_get_imports() {
|
|
|
2622
3664
|
const ret = Promise.resolve(getObject(arg0));
|
|
2623
3665
|
return addHeapObject(ret);
|
|
2624
3666
|
},
|
|
2625
|
-
|
|
3667
|
+
__wbg_sendBatch_f2d35a2e7f724c57: function(arg0, arg1) {
|
|
2626
3668
|
const ret = getObject(arg0).sendBatch(takeObject(arg1));
|
|
2627
3669
|
return addHeapObject(ret);
|
|
2628
3670
|
},
|
|
2629
|
-
|
|
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) {
|
|
2630
3680
|
const ret = getObject(arg0).send(takeObject(arg1));
|
|
2631
3681
|
return addHeapObject(ret);
|
|
2632
3682
|
},
|
|
2633
|
-
|
|
3683
|
+
__wbg_setNextWelcomeRecipients_5dd2b60720fdd3d6: function(arg0, arg1, arg2) {
|
|
2634
3684
|
const ret = getObject(arg0).setNextWelcomeRecipients(takeObject(arg1), takeObject(arg2));
|
|
2635
3685
|
return addHeapObject(ret);
|
|
2636
3686
|
},
|
|
@@ -2687,9 +3737,13 @@ function __wbg_get_imports() {
|
|
|
2687
3737
|
const ret = getObject(arg0).versions;
|
|
2688
3738
|
return addHeapObject(ret);
|
|
2689
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
|
+
},
|
|
2690
3744
|
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
2691
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx:
|
|
2692
|
-
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);
|
|
2693
3747
|
return addHeapObject(ret);
|
|
2694
3748
|
},
|
|
2695
3749
|
__wbindgen_cast_0000000000000002: function(arg0) {
|
|
@@ -2697,22 +3751,27 @@ function __wbg_get_imports() {
|
|
|
2697
3751
|
const ret = arg0;
|
|
2698
3752
|
return addHeapObject(ret);
|
|
2699
3753
|
},
|
|
2700
|
-
__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) {
|
|
2701
3760
|
// Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
|
|
2702
3761
|
const ret = getArrayU8FromWasm0(arg0, arg1);
|
|
2703
3762
|
return addHeapObject(ret);
|
|
2704
3763
|
},
|
|
2705
|
-
|
|
3764
|
+
__wbindgen_cast_0000000000000005: function(arg0, arg1) {
|
|
2706
3765
|
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
2707
3766
|
const ret = getStringFromWasm0(arg0, arg1);
|
|
2708
3767
|
return addHeapObject(ret);
|
|
2709
3768
|
},
|
|
2710
|
-
|
|
3769
|
+
__wbindgen_cast_0000000000000006: function(arg0) {
|
|
2711
3770
|
// Cast intrinsic for `U64 -> Externref`.
|
|
2712
3771
|
const ret = BigInt.asUintN(64, arg0);
|
|
2713
3772
|
return addHeapObject(ret);
|
|
2714
3773
|
},
|
|
2715
|
-
|
|
3774
|
+
__wbindgen_cast_0000000000000007: function(arg0, arg1) {
|
|
2716
3775
|
var v0 = getArrayU8FromWasm0(arg0, arg1).slice();
|
|
2717
3776
|
wasm.__wbindgen_export4(arg0, arg1 * 1, 1);
|
|
2718
3777
|
// Cast intrinsic for `Vector(U8) -> Externref`.
|
|
@@ -2733,10 +3792,10 @@ function __wbg_get_imports() {
|
|
|
2733
3792
|
};
|
|
2734
3793
|
}
|
|
2735
3794
|
|
|
2736
|
-
function
|
|
3795
|
+
function __wasm_bindgen_func_elem_6256(arg0, arg1, arg2) {
|
|
2737
3796
|
try {
|
|
2738
3797
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2739
|
-
wasm.
|
|
3798
|
+
wasm.__wasm_bindgen_func_elem_6256(retptr, arg0, arg1, addHeapObject(arg2));
|
|
2740
3799
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2741
3800
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2742
3801
|
if (r1) {
|
|
@@ -2747,10 +3806,16 @@ function __wasm_bindgen_func_elem_4220(arg0, arg1, arg2) {
|
|
|
2747
3806
|
}
|
|
2748
3807
|
}
|
|
2749
3808
|
|
|
2750
|
-
function
|
|
2751
|
-
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));
|
|
2752
3811
|
}
|
|
2753
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));
|
|
2754
3819
|
const PingClientFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
2755
3820
|
? { register: () => {}, unregister: () => {} }
|
|
2756
3821
|
: new FinalizationRegistry(ptr => wasm.__wbg_pingclient_free(ptr, 1));
|