@agentvault/agentvault 0.14.24 → 0.14.25

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
@@ -47159,6 +47159,28 @@ var init_channel = __esm({
47159
47159
  throw new Error("Channel not initialized");
47160
47160
  }
47161
47161
  await libsodium_wrappers_default.ready;
47162
+ if (roomData.forceRekey) {
47163
+ let cleared = 0;
47164
+ const existingRoom = this._persisted.rooms?.[roomData.roomId];
47165
+ if (existingRoom) {
47166
+ for (const convId of existingRoom.conversationIds) {
47167
+ if (this._sessions.has(convId)) {
47168
+ this._sessions.delete(convId);
47169
+ cleared++;
47170
+ }
47171
+ delete this._persisted.sessions[convId];
47172
+ }
47173
+ }
47174
+ this._senderKeyChains.delete(roomData.roomId);
47175
+ this._senderKeyStates.delete(roomData.roomId);
47176
+ if (existingRoom) {
47177
+ delete existingRoom.ownSenderKeyChain;
47178
+ delete existingRoom.peerSenderKeyState;
47179
+ }
47180
+ console.log(
47181
+ `[SecureChannel] Force rekey: cleared ${cleared} sessions for room ${roomData.roomId.slice(0, 8)}...`
47182
+ );
47183
+ }
47162
47184
  const identity = this._persisted.identityKeypair;
47163
47185
  const ephemeral = this._persisted.ephemeralKeypair;
47164
47186
  const myDeviceId = this._deviceId;
@@ -48152,7 +48174,8 @@ var init_channel = __esm({
48152
48174
  id: c2.id,
48153
48175
  participantA: c2.participant_a,
48154
48176
  participantB: c2.participant_b
48155
- }))
48177
+ })),
48178
+ forceRekey: d2.force_rekey === true
48156
48179
  }).catch((err) => this.emit("error", err));
48157
48180
  }
48158
48181
  if (data.event === "room_message") {