Implement handshake request notifications for pending messages (#321)

- Add handshakeRequest packet type (0x25) to notify recipients about queued messages
- Create HandshakeRequest struct with binary encoding for efficient transmission
- Send handshake requests when messages are queued due to missing session
- Display notifications when someone wants to send messages
- Fix verification persistence bug by adding forceSave on app termination
- Update UI to handle optional encryption icons (hide when no handshake attempted)

Co-authored-by: jack <jackjackbits@users.noreply.github.com>
This commit is contained in:
jack
2025-07-25 14:55:26 +02:00
committed by GitHub
co-authored by jack
parent 07c5e2e097
commit 3513228736
7 changed files with 416 additions and 149 deletions
+11 -6
View File
@@ -13,15 +13,18 @@ import os.log
// MARK: - Encryption Status
enum EncryptionStatus: Equatable {
case none
case noiseHandshaking
case noiseSecured
case noiseVerified
case none // Failed or incompatible
case noHandshake // No handshake attempted yet
case noiseHandshaking // Currently establishing
case noiseSecured // Established but not verified
case noiseVerified // Established and verified
var icon: String {
var icon: String? { // Made optional to hide icon when no handshake
switch self {
case .none:
return "lock.slash"
return "lock.slash" // Failed handshake
case .noHandshake:
return nil // No icon when no handshake attempted
case .noiseHandshaking:
return "lock.rotation"
case .noiseSecured:
@@ -34,6 +37,8 @@ enum EncryptionStatus: Equatable {
var description: String {
switch self {
case .none:
return "Encryption failed"
case .noHandshake:
return "Not encrypted"
case .noiseHandshaking:
return "Establishing encryption..."