Refine panic mode to regenerate identities immediately (#624)

Co-authored-by: jack <jackjackbits@users.noreply.github.com>
This commit is contained in:
jack
2025-09-15 21:39:39 +02:00
committed by GitHub
co-authored by jack
parent f684c452b2
commit 00ff5fd31c
9 changed files with 136 additions and 39 deletions
@@ -210,6 +210,15 @@ final class NoiseRateLimiter {
self.messageTimestamps.removeValue(forKey: peerID)
}
}
func resetAll() {
queue.async(flags: .barrier) {
self.handshakeTimestamps.removeAll()
self.messageTimestamps.removeAll()
self.globalHandshakeTimestamps.removeAll()
self.globalMessageTimestamps.removeAll()
}
}
}
// MARK: - Security Errors
+9
View File
@@ -308,6 +308,15 @@ final class NoiseSessionManager {
_ = sessions.removeValue(forKey: peerID)
}
}
func removeAllSessions() {
managerQueue.sync(flags: .barrier) {
for (_, session) in sessions {
session.reset()
}
sessions.removeAll()
}
}
func getEstablishedSessions() -> [String: NoiseSession] {
return managerQueue.sync {