@ping-app/ping-openmls-sdk 0.10.0 → 0.10.2
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/dist/index.cjs +51 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +20 -4
- package/dist/index.d.ts +20 -4
- package/dist/index.js +50 -0
- package/dist/index.js.map +1 -1
- package/dist/notification-preview.cjs +25 -0
- package/dist/notification-preview.cjs.map +1 -1
- package/dist/notification-preview.d.cts +41 -2
- package/dist/notification-preview.d.ts +41 -2
- package/dist/notification-preview.js +23 -0
- package/dist/notification-preview.js.map +1 -1
- package/dist/storage/indexeddb.d.cts +1 -1
- package/dist/storage/indexeddb.d.ts +1 -1
- package/dist/transport/websocket.d.cts +1 -1
- package/dist/transport/websocket.d.ts +1 -1
- package/dist/{types-B1GFwNXa.d.cts → types-gAmJFSC-.d.cts} +11 -1
- package/dist/{types-B1GFwNXa.d.ts → types-gAmJFSC-.d.ts} +11 -1
- package/dist/worker.cjs +13 -0
- package/dist/worker.cjs.map +1 -1
- package/dist/worker.js +13 -0
- package/dist/worker.js.map +1 -1
- package/package.json +1 -1
- package/wasm/package.json +1 -1
- package/wasm/ping_wasm.d.ts +44 -2
- package/wasm/ping_wasm.js +106 -19
- package/wasm/ping_wasm_bg.wasm +0 -0
- package/wasm/ping_wasm_bg.wasm.d.ts +4 -2
package/wasm/ping_wasm.js
CHANGED
|
@@ -432,6 +432,46 @@ export class PingClient {
|
|
|
432
432
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
433
433
|
}
|
|
434
434
|
}
|
|
435
|
+
/**
|
|
436
|
+
* `exportConversationSecret` together with the MLS epoch the secret was
|
|
437
|
+
* exported at, from one read under one lock in the core
|
|
438
|
+
* (`MessagingClient::export_conversation_secret_with_epoch`): resolves
|
|
439
|
+
* `{ epoch: number, secret: Uint8Array }`, and the pair can never disagree
|
|
440
|
+
* across a Commit.
|
|
441
|
+
*
|
|
442
|
+
* Same derivation, same arguments and the same errors as
|
|
443
|
+
* `exportConversationSecret`; at one epoch both return the same bytes. The
|
|
444
|
+
* same boundary rule too: the core's `Zeroizing` copy is wiped when it
|
|
445
|
+
* drops here, the `Uint8Array` is the caller's to clear (`u8.fill(0)`).
|
|
446
|
+
* `epoch` is a plain number (an epoch beyond `Number.MAX_SAFE_INTEGER` is
|
|
447
|
+
* refused, never rounded).
|
|
448
|
+
* @param {Uint8Array} conv_id
|
|
449
|
+
* @param {string} label
|
|
450
|
+
* @param {Uint8Array} context
|
|
451
|
+
* @param {number} length
|
|
452
|
+
* @returns {any}
|
|
453
|
+
*/
|
|
454
|
+
exportConversationSecretWithEpoch(conv_id, label, context, length) {
|
|
455
|
+
try {
|
|
456
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
457
|
+
const ptr0 = passArray8ToWasm0(conv_id, wasm.__wbindgen_export);
|
|
458
|
+
const len0 = WASM_VECTOR_LEN;
|
|
459
|
+
const ptr1 = passStringToWasm0(label, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
460
|
+
const len1 = WASM_VECTOR_LEN;
|
|
461
|
+
const ptr2 = passArray8ToWasm0(context, wasm.__wbindgen_export);
|
|
462
|
+
const len2 = WASM_VECTOR_LEN;
|
|
463
|
+
wasm.pingclient_exportConversationSecretWithEpoch(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, length);
|
|
464
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
465
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
466
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
467
|
+
if (r2) {
|
|
468
|
+
throw takeObject(r1);
|
|
469
|
+
}
|
|
470
|
+
return takeObject(r0);
|
|
471
|
+
} finally {
|
|
472
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
473
|
+
}
|
|
474
|
+
}
|
|
435
475
|
/**
|
|
436
476
|
* [CR-7] Export the MLS state snapshot for one conversation.
|
|
437
477
|
* @param {Uint8Array} conv_id
|
|
@@ -911,6 +951,49 @@ export class PingClient {
|
|
|
911
951
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
912
952
|
}
|
|
913
953
|
}
|
|
954
|
+
/**
|
|
955
|
+
* [`previewEnvelope`](Self::preview_envelope) for a message the stored
|
|
956
|
+
* snapshot cannot read yet: the first message of a conversation whose
|
|
957
|
+
* Welcome is still waiting on the server, or one sealed after a
|
|
958
|
+
* membership change the page has not applied.
|
|
959
|
+
*
|
|
960
|
+
* `prerequisites` is an array of envelopes: this device's pending Welcome
|
|
961
|
+
* for the conversation, and the Commits and Proposals that follow it in
|
|
962
|
+
* the log, in log order. They are applied to this client's private copy
|
|
963
|
+
* of the MLS state (the Welcome under the same rules as a real join),
|
|
964
|
+
* the envelope is decrypted, and all of it is discarded with the client.
|
|
965
|
+
* Nothing is written: the page still joins from the same Welcome and
|
|
966
|
+
* decrypts the same message when it next runs.
|
|
967
|
+
*
|
|
968
|
+
* Envelopes for another conversation and kinds other than welcome,
|
|
969
|
+
* commit and proposal are ignored; a commit or proposal that does not
|
|
970
|
+
* apply is skipped. At most 64 prerequisites; more rejects. Resolves
|
|
971
|
+
* `null` when there is nothing to show, and rejects with the join error
|
|
972
|
+
* when a Welcome was offered, none joined, and the conversation is still
|
|
973
|
+
* not held.
|
|
974
|
+
*
|
|
975
|
+
* Rejects on a client that did not come from
|
|
976
|
+
* [`openReadOnly`](Self::open_read_only).
|
|
977
|
+
* @param {any} prerequisites
|
|
978
|
+
* @param {any} envelope
|
|
979
|
+
* @param {number} now_ms
|
|
980
|
+
* @returns {any}
|
|
981
|
+
*/
|
|
982
|
+
previewEnvelopeWithPrerequisites(prerequisites, envelope, now_ms) {
|
|
983
|
+
try {
|
|
984
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
985
|
+
wasm.pingclient_previewEnvelopeWithPrerequisites(retptr, this.__wbg_ptr, addHeapObject(prerequisites), addHeapObject(envelope), now_ms);
|
|
986
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
987
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
988
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
989
|
+
if (r2) {
|
|
990
|
+
throw takeObject(r1);
|
|
991
|
+
}
|
|
992
|
+
return takeObject(r0);
|
|
993
|
+
} finally {
|
|
994
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
995
|
+
}
|
|
996
|
+
}
|
|
914
997
|
/**
|
|
915
998
|
* @param {any} env
|
|
916
999
|
* @param {number} now_ms
|
|
@@ -2300,7 +2383,7 @@ function __wbg_get_imports() {
|
|
|
2300
2383
|
__wbg__wbg_cb_unref_be22cc64ae6946a0: function(arg0) {
|
|
2301
2384
|
getObject(arg0)._wbg_cb_unref();
|
|
2302
2385
|
},
|
|
2303
|
-
|
|
2386
|
+
__wbg_applyBatch_49455bfc62c24da5: function(arg0, arg1, arg2, arg3, arg4) {
|
|
2304
2387
|
const ret = getObject(arg0).applyBatch(getStringFromWasm0(arg1, arg2), takeObject(arg3), takeObject(arg4));
|
|
2305
2388
|
return addHeapObject(ret);
|
|
2306
2389
|
},
|
|
@@ -2316,11 +2399,11 @@ function __wbg_get_imports() {
|
|
|
2316
2399
|
const ret = getObject(arg0).crypto;
|
|
2317
2400
|
return addHeapObject(ret);
|
|
2318
2401
|
},
|
|
2319
|
-
|
|
2402
|
+
__wbg_del_5d543e37d6646ef8: function(arg0, arg1, arg2, arg3, arg4) {
|
|
2320
2403
|
const ret = getObject(arg0).del(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
|
|
2321
2404
|
return addHeapObject(ret);
|
|
2322
2405
|
},
|
|
2323
|
-
|
|
2406
|
+
__wbg_discoverDevices_a5117e18236c0bc2: function(arg0, arg1) {
|
|
2324
2407
|
const ret = getObject(arg0).discoverDevices(takeObject(arg1));
|
|
2325
2408
|
return addHeapObject(ret);
|
|
2326
2409
|
},
|
|
@@ -2343,15 +2426,15 @@ function __wbg_get_imports() {
|
|
|
2343
2426
|
wasm.__wbindgen_export4(deferred0_0, deferred0_1, 1);
|
|
2344
2427
|
}
|
|
2345
2428
|
},
|
|
2346
|
-
|
|
2429
|
+
__wbg_fetchLogHeads_21ae8776237c0351: function(arg0) {
|
|
2347
2430
|
const ret = getObject(arg0).fetchLogHeads();
|
|
2348
2431
|
return addHeapObject(ret);
|
|
2349
2432
|
},
|
|
2350
|
-
|
|
2433
|
+
__wbg_fetchLogSince_28f5fbd4105bd3cd: function(arg0, arg1, arg2) {
|
|
2351
2434
|
const ret = getObject(arg0).fetchLogSince(takeObject(arg1), arg2 >>> 0);
|
|
2352
2435
|
return addHeapObject(ret);
|
|
2353
2436
|
},
|
|
2354
|
-
|
|
2437
|
+
__wbg_fetchSince_a6a1dce942b3a4ed: function(arg0, arg1, arg2, arg3) {
|
|
2355
2438
|
const ret = getObject(arg0).fetchSince(takeObject(arg1), takeObject(arg2), arg3 >>> 0);
|
|
2356
2439
|
return addHeapObject(ret);
|
|
2357
2440
|
},
|
|
@@ -2380,7 +2463,7 @@ function __wbg_get_imports() {
|
|
|
2380
2463
|
const ret = Reflect.get(getObject(arg0), getObject(arg1));
|
|
2381
2464
|
return addHeapObject(ret);
|
|
2382
2465
|
}, arguments); },
|
|
2383
|
-
|
|
2466
|
+
__wbg_get_fda3c223a9e9bd0c: function(arg0, arg1, arg2, arg3, arg4) {
|
|
2384
2467
|
const ret = getObject(arg0).get(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
|
|
2385
2468
|
return addHeapObject(ret);
|
|
2386
2469
|
},
|
|
@@ -2432,11 +2515,11 @@ function __wbg_get_imports() {
|
|
|
2432
2515
|
const ret = getObject(arg0).length;
|
|
2433
2516
|
return ret;
|
|
2434
2517
|
},
|
|
2435
|
-
|
|
2518
|
+
__wbg_listEntries_67448432badf0048: function(arg0, arg1, arg2, arg3, arg4) {
|
|
2436
2519
|
const ret = getObject(arg0).listEntries(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
|
|
2437
2520
|
return addHeapObject(ret);
|
|
2438
2521
|
},
|
|
2439
|
-
|
|
2522
|
+
__wbg_listKeys_58b63137eca68a71: function(arg0, arg1, arg2, arg3, arg4) {
|
|
2440
2523
|
const ret = getObject(arg0).listKeys(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
|
|
2441
2524
|
return addHeapObject(ret);
|
|
2442
2525
|
},
|
|
@@ -2471,7 +2554,7 @@ function __wbg_get_imports() {
|
|
|
2471
2554
|
const a = state0.a;
|
|
2472
2555
|
state0.a = 0;
|
|
2473
2556
|
try {
|
|
2474
|
-
return
|
|
2557
|
+
return __wasm_bindgen_func_elem_4235(a, state0.b, arg0, arg1);
|
|
2475
2558
|
} finally {
|
|
2476
2559
|
state0.a = a;
|
|
2477
2560
|
}
|
|
@@ -2517,7 +2600,7 @@ function __wbg_get_imports() {
|
|
|
2517
2600
|
const ret = getObject(arg0).push(getObject(arg1));
|
|
2518
2601
|
return ret;
|
|
2519
2602
|
},
|
|
2520
|
-
|
|
2603
|
+
__wbg_put_6fae0d33b0377492: function(arg0, arg1, arg2, arg3, arg4, arg5) {
|
|
2521
2604
|
const ret = getObject(arg0).put(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4), takeObject(arg5));
|
|
2522
2605
|
return addHeapObject(ret);
|
|
2523
2606
|
},
|
|
@@ -2539,21 +2622,25 @@ function __wbg_get_imports() {
|
|
|
2539
2622
|
const ret = Promise.resolve(getObject(arg0));
|
|
2540
2623
|
return addHeapObject(ret);
|
|
2541
2624
|
},
|
|
2542
|
-
|
|
2625
|
+
__wbg_sendBatch_2c2929270b2a95a5: function(arg0, arg1) {
|
|
2543
2626
|
const ret = getObject(arg0).sendBatch(takeObject(arg1));
|
|
2544
2627
|
return addHeapObject(ret);
|
|
2545
2628
|
},
|
|
2546
|
-
|
|
2629
|
+
__wbg_send_fd5dc20e2f35b75e: function(arg0, arg1) {
|
|
2547
2630
|
const ret = getObject(arg0).send(takeObject(arg1));
|
|
2548
2631
|
return addHeapObject(ret);
|
|
2549
2632
|
},
|
|
2550
|
-
|
|
2633
|
+
__wbg_setNextWelcomeRecipients_d349893dfc2640c6: function(arg0, arg1, arg2) {
|
|
2551
2634
|
const ret = getObject(arg0).setNextWelcomeRecipients(takeObject(arg1), takeObject(arg2));
|
|
2552
2635
|
return addHeapObject(ret);
|
|
2553
2636
|
},
|
|
2554
2637
|
__wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
|
|
2555
2638
|
getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
|
|
2556
2639
|
},
|
|
2640
|
+
__wbg_set_8155bb79a948541b: function() { return handleError(function (arg0, arg1, arg2) {
|
|
2641
|
+
const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
|
|
2642
|
+
return ret;
|
|
2643
|
+
}, arguments); },
|
|
2557
2644
|
__wbg_set_a80955eb93b145c6: function(arg0, arg1, arg2) {
|
|
2558
2645
|
getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
|
|
2559
2646
|
},
|
|
@@ -2602,7 +2689,7 @@ function __wbg_get_imports() {
|
|
|
2602
2689
|
},
|
|
2603
2690
|
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
2604
2691
|
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 1048, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
2605
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
2692
|
+
const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_4220);
|
|
2606
2693
|
return addHeapObject(ret);
|
|
2607
2694
|
},
|
|
2608
2695
|
__wbindgen_cast_0000000000000002: function(arg0) {
|
|
@@ -2646,10 +2733,10 @@ function __wbg_get_imports() {
|
|
|
2646
2733
|
};
|
|
2647
2734
|
}
|
|
2648
2735
|
|
|
2649
|
-
function
|
|
2736
|
+
function __wasm_bindgen_func_elem_4220(arg0, arg1, arg2) {
|
|
2650
2737
|
try {
|
|
2651
2738
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2652
|
-
wasm.
|
|
2739
|
+
wasm.__wasm_bindgen_func_elem_4220(retptr, arg0, arg1, addHeapObject(arg2));
|
|
2653
2740
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2654
2741
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2655
2742
|
if (r1) {
|
|
@@ -2660,8 +2747,8 @@ function __wasm_bindgen_func_elem_4208(arg0, arg1, arg2) {
|
|
|
2660
2747
|
}
|
|
2661
2748
|
}
|
|
2662
2749
|
|
|
2663
|
-
function
|
|
2664
|
-
wasm.
|
|
2750
|
+
function __wasm_bindgen_func_elem_4235(arg0, arg1, arg2, arg3) {
|
|
2751
|
+
wasm.__wasm_bindgen_func_elem_4235(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
2665
2752
|
}
|
|
2666
2753
|
|
|
2667
2754
|
const PingClientFinalization = (typeof FinalizationRegistry === 'undefined')
|
package/wasm/ping_wasm_bg.wasm
CHANGED
|
Binary file
|
|
@@ -46,6 +46,7 @@ export const pingclient_createConversation: (a: number, b: number, c: number, d:
|
|
|
46
46
|
export const pingclient_deviceId: (a: number, b: number) => void;
|
|
47
47
|
export const pingclient_dropConversationLocal: (a: number, b: number, c: number) => number;
|
|
48
48
|
export const pingclient_exportConversationSecret: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
|
|
49
|
+
export const pingclient_exportConversationSecretWithEpoch: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
|
|
49
50
|
export const pingclient_exportConversationStateSnapshot: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
50
51
|
export const pingclient_exportIdentity: (a: number, b: number) => void;
|
|
51
52
|
export const pingclient_freshKeyPackage: (a: number) => number;
|
|
@@ -68,6 +69,7 @@ export const pingclient_openReadOnly: (a: number, b: number, c: number, d: numbe
|
|
|
68
69
|
export const pingclient_pendingApplies: (a: number, b: number) => void;
|
|
69
70
|
export const pingclient_pendingProposalsCommitRank: (a: number, b: number, c: number) => number;
|
|
70
71
|
export const pingclient_previewEnvelope: (a: number, b: number, c: number, d: number) => void;
|
|
72
|
+
export const pingclient_previewEnvelopeWithPrerequisites: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
71
73
|
export const pingclient_processEnvelope: (a: number, b: number, c: number) => number;
|
|
72
74
|
export const pingclient_processSequencedBatch: (a: number, b: number, c: number) => number;
|
|
73
75
|
export const pingclient_processWelcomeAt: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
@@ -101,8 +103,8 @@ export const signDeviceLinkApproval: (a: number, b: number, c: number, d: number
|
|
|
101
103
|
export const signDeviceLinkPossession: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
|
|
102
104
|
export const signDeviceReauth: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number) => void;
|
|
103
105
|
export const _start: () => void;
|
|
104
|
-
export const
|
|
105
|
-
export const
|
|
106
|
+
export const __wasm_bindgen_func_elem_4220: (a: number, b: number, c: number, d: number) => void;
|
|
107
|
+
export const __wasm_bindgen_func_elem_4235: (a: number, b: number, c: number, d: number) => void;
|
|
106
108
|
export const __wbindgen_export: (a: number, b: number) => number;
|
|
107
109
|
export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
108
110
|
export const __wbindgen_export3: (a: number) => void;
|