ping-openmls-sdk 0.6.8 → 0.6.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -220,8 +220,22 @@ export function generateMnemonicPhrase(): string;
220
220
  */
221
221
  export function normalizeMnemonicPhrase(phrase: string): string;
222
222
 
223
+ /**
224
+ * Open+verify a history bundle. `recipientPriv` (X25519, 32 bytes) +
225
+ * `senderIdentityPub` (Ed25519, 32 bytes). Throws if the signature doesn't
226
+ * verify or the blob is malformed.
227
+ */
228
+ export function openHistoryBundle(sealed: Uint8Array, recipient_priv: Uint8Array, sender_identity_pub: Uint8Array): any;
229
+
223
230
  export function openLinkingTicket(sealed: Uint8Array, new_device_priv: Uint8Array): any;
224
231
 
232
+ /**
233
+ * Seal+sign a history bundle for device linking / peer re-add. `bundle` is a JS
234
+ * object; `recipientPub` (X25519, 32 bytes) + `senderIdentitySecret` (Ed25519
235
+ * seed, 32 bytes) are Uint8Arrays. Authenticated (sign-then-encrypt).
236
+ */
237
+ export function sealHistoryBundle(bundle: any, recipient_pub: Uint8Array, sender_identity_secret: Uint8Array): Uint8Array;
238
+
225
239
  /**
226
240
  * HPKE-seal a `LinkingTicket` ([CR-3]). Pure function — does not need an initialized
227
241
  * `PingClient`, so it's exported at module scope and the JS facade can call it from an
@@ -241,6 +255,7 @@ export interface InitOutput {
241
255
  readonly encryptBackup: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number) => void;
242
256
  readonly generateMnemonicPhrase: (a: number) => void;
243
257
  readonly normalizeMnemonicPhrase: (a: number, b: number, c: number) => void;
258
+ readonly openHistoryBundle: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
244
259
  readonly openLinkingTicket: (a: number, b: number, c: number, d: number, e: number) => void;
245
260
  readonly pingclient_addMembers: (a: number, b: number, c: number, d: number, e: number) => number;
246
261
  readonly pingclient_admitDeviceToChats: (a: number, b: number, c: number, d: number, e: number) => number;
@@ -263,6 +278,7 @@ export interface InitOutput {
263
278
  readonly pingclient_send: (a: number, b: number, c: number, d: number, e: number, f: number) => number;
264
279
  readonly pingclient_syncConversations: (a: number, b: number) => number;
265
280
  readonly pingclient_userId: (a: number, b: number) => void;
281
+ readonly sealHistoryBundle: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
266
282
  readonly sealLinkingTicket: (a: number, b: number, c: number, d: number) => void;
267
283
  readonly _start: () => void;
268
284
  readonly __wbg_wasmbindgentestcontext_free: (a: number, b: number) => void;
@@ -280,9 +296,9 @@ export interface InitOutput {
280
296
  readonly wasmbindgentestcontext_include_ignored: (a: number, b: number) => void;
281
297
  readonly wasmbindgentestcontext_new: (a: number) => number;
282
298
  readonly wasmbindgentestcontext_run: (a: number, b: number, c: number) => number;
283
- readonly __wasm_bindgen_func_elem_2773: (a: number, b: number, c: number, d: number, e: number) => void;
284
- readonly __wasm_bindgen_func_elem_2759: (a: number, b: number, c: number, d: number) => void;
285
- readonly __wasm_bindgen_func_elem_2783: (a: number, b: number, c: number, d: number) => void;
299
+ readonly __wasm_bindgen_func_elem_2820: (a: number, b: number, c: number, d: number, e: number) => void;
300
+ readonly __wasm_bindgen_func_elem_2806: (a: number, b: number, c: number, d: number) => void;
301
+ readonly __wasm_bindgen_func_elem_2830: (a: number, b: number, c: number, d: number) => void;
286
302
  readonly __wbindgen_export: (a: number, b: number) => number;
287
303
  readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
288
304
  readonly __wbindgen_export3: (a: number) => void;
package/wasm/ping_wasm.js CHANGED
@@ -751,6 +751,37 @@ export function normalizeMnemonicPhrase(phrase) {
751
751
  }
752
752
  }
753
753
 
754
+ /**
755
+ * Open+verify a history bundle. `recipientPriv` (X25519, 32 bytes) +
756
+ * `senderIdentityPub` (Ed25519, 32 bytes). Throws if the signature doesn't
757
+ * verify or the blob is malformed.
758
+ * @param {Uint8Array} sealed
759
+ * @param {Uint8Array} recipient_priv
760
+ * @param {Uint8Array} sender_identity_pub
761
+ * @returns {any}
762
+ */
763
+ export function openHistoryBundle(sealed, recipient_priv, sender_identity_pub) {
764
+ try {
765
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
766
+ const ptr0 = passArray8ToWasm0(sealed, wasm.__wbindgen_export);
767
+ const len0 = WASM_VECTOR_LEN;
768
+ const ptr1 = passArray8ToWasm0(recipient_priv, wasm.__wbindgen_export);
769
+ const len1 = WASM_VECTOR_LEN;
770
+ const ptr2 = passArray8ToWasm0(sender_identity_pub, wasm.__wbindgen_export);
771
+ const len2 = WASM_VECTOR_LEN;
772
+ wasm.openHistoryBundle(retptr, ptr0, len0, ptr1, len1, ptr2, len2);
773
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
774
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
775
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
776
+ if (r2) {
777
+ throw takeObject(r1);
778
+ }
779
+ return takeObject(r0);
780
+ } finally {
781
+ wasm.__wbindgen_add_to_stack_pointer(16);
782
+ }
783
+ }
784
+
754
785
  /**
755
786
  * @param {Uint8Array} sealed
756
787
  * @param {Uint8Array} new_device_priv
@@ -776,6 +807,35 @@ export function openLinkingTicket(sealed, new_device_priv) {
776
807
  }
777
808
  }
778
809
 
810
+ /**
811
+ * Seal+sign a history bundle for device linking / peer re-add. `bundle` is a JS
812
+ * object; `recipientPub` (X25519, 32 bytes) + `senderIdentitySecret` (Ed25519
813
+ * seed, 32 bytes) are Uint8Arrays. Authenticated (sign-then-encrypt).
814
+ * @param {any} bundle
815
+ * @param {Uint8Array} recipient_pub
816
+ * @param {Uint8Array} sender_identity_secret
817
+ * @returns {Uint8Array}
818
+ */
819
+ export function sealHistoryBundle(bundle, recipient_pub, sender_identity_secret) {
820
+ try {
821
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
822
+ const ptr0 = passArray8ToWasm0(recipient_pub, wasm.__wbindgen_export);
823
+ const len0 = WASM_VECTOR_LEN;
824
+ const ptr1 = passArray8ToWasm0(sender_identity_secret, wasm.__wbindgen_export);
825
+ const len1 = WASM_VECTOR_LEN;
826
+ wasm.sealHistoryBundle(retptr, addHeapObject(bundle), ptr0, len0, ptr1, len1);
827
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
828
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
829
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
830
+ if (r2) {
831
+ throw takeObject(r1);
832
+ }
833
+ return takeObject(r0);
834
+ } finally {
835
+ wasm.__wbindgen_add_to_stack_pointer(16);
836
+ }
837
+ }
838
+
779
839
  /**
780
840
  * HPKE-seal a `LinkingTicket` ([CR-3]). Pure function — does not need an initialized
781
841
  * `PingClient`, so it's exported at module scope and the JS facade can call it from an
@@ -929,11 +989,11 @@ function __wbg_get_imports() {
929
989
  const ret = getObject(arg0).crypto;
930
990
  return addHeapObject(ret);
931
991
  },
932
- __wbg_del_dd892521518399ee: function(arg0, arg1, arg2, arg3, arg4) {
992
+ __wbg_del_7c42c3919a54029a: function(arg0, arg1, arg2, arg3, arg4) {
933
993
  const ret = getObject(arg0).del(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
934
994
  return addHeapObject(ret);
935
995
  },
936
- __wbg_discoverDevices_71844b4a7278884f: function(arg0, arg1) {
996
+ __wbg_discoverDevices_3ca0041ec2fecf6b: function(arg0, arg1) {
937
997
  const ret = getObject(arg0).discoverDevices(takeObject(arg1));
938
998
  return addHeapObject(ret);
939
999
  },
@@ -959,7 +1019,7 @@ function __wbg_get_imports() {
959
1019
  wasm.__wbindgen_export4(deferred0_0, deferred0_1, 1);
960
1020
  }
961
1021
  },
962
- __wbg_fetchSince_26646a05d0087e09: function(arg0, arg1, arg2, arg3) {
1022
+ __wbg_fetchSince_01e0bdb75906d05c: function(arg0, arg1, arg2, arg3) {
963
1023
  const ret = getObject(arg0).fetchSince(takeObject(arg1), takeObject(arg2), arg3 >>> 0);
964
1024
  return addHeapObject(ret);
965
1025
  },
@@ -970,7 +1030,7 @@ function __wbg_get_imports() {
970
1030
  const a = state0.a;
971
1031
  state0.a = 0;
972
1032
  try {
973
- return __wasm_bindgen_func_elem_2773(a, state0.b, arg0, arg1, arg2);
1033
+ return __wasm_bindgen_func_elem_2820(a, state0.b, arg0, arg1, arg2);
974
1034
  } finally {
975
1035
  state0.a = a;
976
1036
  }
@@ -1002,7 +1062,7 @@ function __wbg_get_imports() {
1002
1062
  const ret = Reflect.get(getObject(arg0), getObject(arg1));
1003
1063
  return addHeapObject(ret);
1004
1064
  }, arguments); },
1005
- __wbg_get_e22763f546129c48: function(arg0, arg1, arg2, arg3, arg4) {
1065
+ __wbg_get_9edb05485756d89a: function(arg0, arg1, arg2, arg3, arg4) {
1006
1066
  const ret = getObject(arg0).get(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
1007
1067
  return addHeapObject(ret);
1008
1068
  },
@@ -1054,7 +1114,7 @@ function __wbg_get_imports() {
1054
1114
  const ret = getObject(arg0).length;
1055
1115
  return ret;
1056
1116
  },
1057
- __wbg_listKeys_43d7d522a7f24fe2: function(arg0, arg1, arg2, arg3, arg4) {
1117
+ __wbg_listKeys_054817a8580975b4: function(arg0, arg1, arg2, arg3, arg4) {
1058
1118
  const ret = getObject(arg0).listKeys(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
1059
1119
  return addHeapObject(ret);
1060
1120
  },
@@ -1111,7 +1171,7 @@ function __wbg_get_imports() {
1111
1171
  const a = state0.a;
1112
1172
  state0.a = 0;
1113
1173
  try {
1114
- return __wasm_bindgen_func_elem_2783(a, state0.b, arg0, arg1);
1174
+ return __wasm_bindgen_func_elem_2830(a, state0.b, arg0, arg1);
1115
1175
  } finally {
1116
1176
  state0.a = a;
1117
1177
  }
@@ -1161,7 +1221,7 @@ function __wbg_get_imports() {
1161
1221
  __wbg_prototypesetcall_fd4050e806e1d519: function(arg0, arg1, arg2) {
1162
1222
  Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
1163
1223
  },
1164
- __wbg_put_74e12966d856a853: function(arg0, arg1, arg2, arg3, arg4, arg5) {
1224
+ __wbg_put_b126f07545ff849f: function(arg0, arg1, arg2, arg3, arg4, arg5) {
1165
1225
  const ret = getObject(arg0).put(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4), takeObject(arg5));
1166
1226
  return addHeapObject(ret);
1167
1227
  },
@@ -1187,11 +1247,11 @@ function __wbg_get_imports() {
1187
1247
  const ret = getObject(arg0).self;
1188
1248
  return isLikeNone(ret) ? 0 : addHeapObject(ret);
1189
1249
  },
1190
- __wbg_send_c848975ec4aa009e: function(arg0, arg1) {
1250
+ __wbg_send_656081fbfb0b7425: function(arg0, arg1) {
1191
1251
  const ret = getObject(arg0).send(takeObject(arg1));
1192
1252
  return addHeapObject(ret);
1193
1253
  },
1194
- __wbg_setNextWelcomeRecipients_a4fdc30ee7a97d64: function(arg0, arg1, arg2) {
1254
+ __wbg_setNextWelcomeRecipients_da54b6cfcbd6e32a: function(arg0, arg1, arg2) {
1195
1255
  const ret = getObject(arg0).setNextWelcomeRecipients(takeObject(arg1), takeObject(arg2));
1196
1256
  return addHeapObject(ret);
1197
1257
  },
@@ -1288,8 +1348,8 @@ function __wbg_get_imports() {
1288
1348
  return addHeapObject(ret);
1289
1349
  },
1290
1350
  __wbindgen_cast_0000000000000001: function(arg0, arg1) {
1291
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 776, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1292
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_2759);
1351
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 780, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1352
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_2806);
1293
1353
  return addHeapObject(ret);
1294
1354
  },
1295
1355
  __wbindgen_cast_0000000000000002: function(arg0) {
@@ -1333,10 +1393,10 @@ function __wbg_get_imports() {
1333
1393
  };
1334
1394
  }
1335
1395
 
1336
- function __wasm_bindgen_func_elem_2759(arg0, arg1, arg2) {
1396
+ function __wasm_bindgen_func_elem_2806(arg0, arg1, arg2) {
1337
1397
  try {
1338
1398
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1339
- wasm.__wasm_bindgen_func_elem_2759(retptr, arg0, arg1, addHeapObject(arg2));
1399
+ wasm.__wasm_bindgen_func_elem_2806(retptr, arg0, arg1, addHeapObject(arg2));
1340
1400
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1341
1401
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1342
1402
  if (r1) {
@@ -1347,12 +1407,12 @@ function __wasm_bindgen_func_elem_2759(arg0, arg1, arg2) {
1347
1407
  }
1348
1408
  }
1349
1409
 
1350
- function __wasm_bindgen_func_elem_2783(arg0, arg1, arg2, arg3) {
1351
- wasm.__wasm_bindgen_func_elem_2783(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
1410
+ function __wasm_bindgen_func_elem_2830(arg0, arg1, arg2, arg3) {
1411
+ wasm.__wasm_bindgen_func_elem_2830(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
1352
1412
  }
1353
1413
 
1354
- function __wasm_bindgen_func_elem_2773(arg0, arg1, arg2, arg3, arg4) {
1355
- wasm.__wasm_bindgen_func_elem_2773(arg0, arg1, addHeapObject(arg2), arg3, addHeapObject(arg4));
1414
+ function __wasm_bindgen_func_elem_2820(arg0, arg1, arg2, arg3, arg4) {
1415
+ wasm.__wasm_bindgen_func_elem_2820(arg0, arg1, addHeapObject(arg2), arg3, addHeapObject(arg4));
1356
1416
  }
1357
1417
 
1358
1418
  const WasmBindgenTestContextFinalization = (typeof FinalizationRegistry === 'undefined')
Binary file
@@ -7,6 +7,7 @@ export const decryptBackup: (a: number, b: number, c: number, d: number, e: numb
7
7
  export const encryptBackup: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number) => void;
8
8
  export const generateMnemonicPhrase: (a: number) => void;
9
9
  export const normalizeMnemonicPhrase: (a: number, b: number, c: number) => void;
10
+ export const openHistoryBundle: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
10
11
  export const openLinkingTicket: (a: number, b: number, c: number, d: number, e: number) => void;
11
12
  export const pingclient_addMembers: (a: number, b: number, c: number, d: number, e: number) => number;
12
13
  export const pingclient_admitDeviceToChats: (a: number, b: number, c: number, d: number, e: number) => number;
@@ -29,6 +30,7 @@ export const pingclient_revokeDevice: (a: number, b: number, c: number, d: numbe
29
30
  export const pingclient_send: (a: number, b: number, c: number, d: number, e: number, f: number) => number;
30
31
  export const pingclient_syncConversations: (a: number, b: number) => number;
31
32
  export const pingclient_userId: (a: number, b: number) => void;
33
+ export const sealHistoryBundle: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
32
34
  export const sealLinkingTicket: (a: number, b: number, c: number, d: number) => void;
33
35
  export const _start: () => void;
34
36
  export const __wbg_wasmbindgentestcontext_free: (a: number, b: number) => void;
@@ -46,9 +48,9 @@ export const wasmbindgentestcontext_filtered_count: (a: number, b: number) => vo
46
48
  export const wasmbindgentestcontext_include_ignored: (a: number, b: number) => void;
47
49
  export const wasmbindgentestcontext_new: (a: number) => number;
48
50
  export const wasmbindgentestcontext_run: (a: number, b: number, c: number) => number;
49
- export const __wasm_bindgen_func_elem_2773: (a: number, b: number, c: number, d: number, e: number) => void;
50
- export const __wasm_bindgen_func_elem_2759: (a: number, b: number, c: number, d: number) => void;
51
- export const __wasm_bindgen_func_elem_2783: (a: number, b: number, c: number, d: number) => void;
51
+ export const __wasm_bindgen_func_elem_2820: (a: number, b: number, c: number, d: number, e: number) => void;
52
+ export const __wasm_bindgen_func_elem_2806: (a: number, b: number, c: number, d: number) => void;
53
+ export const __wasm_bindgen_func_elem_2830: (a: number, b: number, c: number, d: number) => void;
52
54
  export const __wbindgen_export: (a: number, b: number) => number;
53
55
  export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
54
56
  export const __wbindgen_export3: (a: number) => void;