@agentvault/agentvault 0.14.27 → 0.14.29

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
@@ -47176,6 +47176,8 @@ var init_channel = __esm({
47176
47176
  if (existingRoom) {
47177
47177
  delete existingRoom.ownSenderKeyChain;
47178
47178
  delete existingRoom.peerSenderKeyState;
47179
+ delete existingRoom.encryptionMode;
47180
+ existingRoom.distributedTo = [];
47179
47181
  }
47180
47182
  if (this._persisted) {
47181
47183
  this._persisted.lastMessageTimestamp = (/* @__PURE__ */ new Date()).toISOString();
@@ -49370,11 +49372,16 @@ ${messageText}`;
49370
49372
  ciphertext: data.ciphertext
49371
49373
  });
49372
49374
  let distJson;
49375
+ const ratchetSnapshot = session.ratchet.serialize();
49373
49376
  try {
49374
49377
  distJson = session.ratchet.decrypt(encrypted);
49375
49378
  } catch (err) {
49379
+ session.ratchet = DoubleRatchet.deserialize(ratchetSnapshot);
49380
+ if (this._persisted?.sessions[convId]) {
49381
+ this._persisted.sessions[convId].ratchetState = ratchetSnapshot;
49382
+ }
49376
49383
  console.warn(
49377
- `[SecureChannel] Failed to decrypt sender key distribution from ${data.sender_device_id.slice(0, 8)}...:`,
49384
+ `[SecureChannel] Failed to decrypt sender key distribution from ${data.sender_device_id.slice(0, 8)}... (ratchet restored):`,
49378
49385
  err
49379
49386
  );
49380
49387
  return;