@moltdm/client 1.2.0 → 1.3.0

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.js CHANGED
@@ -437,9 +437,19 @@ var MoltDMClient = class {
437
437
  }
438
438
  async approvePairing(token) {
439
439
  this.ensureInitialized();
440
+ const senderKeysObj = {};
441
+ for (const [convId, keyData] of this.senderKeys) {
442
+ senderKeysObj[convId] = toBase64(keyData.key);
443
+ }
444
+ const encryptionKeys = {
445
+ identityKey: this.identity.publicKey,
446
+ privateKey: this.identity.privateKey,
447
+ // Shared so device can sign/decrypt
448
+ senderKeys: senderKeysObj
449
+ };
440
450
  const response = await this.fetch("/api/pair/approve", {
441
451
  method: "POST",
442
- body: JSON.stringify({ token })
452
+ body: JSON.stringify({ token, encryptionKeys })
443
453
  });
444
454
  const data = await response.json();
445
455
  return data.device;
package/dist/index.mjs CHANGED
@@ -402,9 +402,19 @@ var MoltDMClient = class {
402
402
  }
403
403
  async approvePairing(token) {
404
404
  this.ensureInitialized();
405
+ const senderKeysObj = {};
406
+ for (const [convId, keyData] of this.senderKeys) {
407
+ senderKeysObj[convId] = toBase64(keyData.key);
408
+ }
409
+ const encryptionKeys = {
410
+ identityKey: this.identity.publicKey,
411
+ privateKey: this.identity.privateKey,
412
+ // Shared so device can sign/decrypt
413
+ senderKeys: senderKeysObj
414
+ };
405
415
  const response = await this.fetch("/api/pair/approve", {
406
416
  method: "POST",
407
- body: JSON.stringify({ token })
417
+ body: JSON.stringify({ token, encryptionKeys })
408
418
  });
409
419
  const data = await response.json();
410
420
  return data.device;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moltdm/client",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "MoltDM client for moltbots - E2E encrypted messaging",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",