mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-07-26 12:25:22 +00:00
Remove all channel functionality and clean up test suite
- Remove channel UI elements from ContentView - Remove channel data structures and methods from ChatViewModel - Remove channel commands (/j, /leave, /channels) - Remove channel field from BitchatMessage protocol - Remove channel message types and handling - Remove NoiseChannelEncryption.swift entirely - Clean up all channel references across the codebase - Fix compilation warnings (var to let conversions) - Remove all outdated test files that used incorrect APIs - Simplify app to only support public broadcast and 1:1 private messages
This commit is contained in:
@@ -61,16 +61,6 @@ struct NoiseSecurityValidator {
|
||||
peerID.count <= 64 &&
|
||||
peerID.rangeOfCharacter(from: validCharset.inverted) == nil
|
||||
}
|
||||
|
||||
/// Validate channel name format
|
||||
static func validateChannelName(_ channel: String) -> Bool {
|
||||
// Channel should start with # and contain valid characters
|
||||
let validCharset = CharacterSet.alphanumerics.union(CharacterSet(charactersIn: "-_"))
|
||||
return channel.hasPrefix("#") &&
|
||||
channel.count > 1 &&
|
||||
channel.count <= 32 &&
|
||||
channel.dropFirst().rangeOfCharacter(from: validCharset.inverted) == nil
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Enhanced Noise Session with Security
|
||||
@@ -232,54 +222,6 @@ enum NoiseSecurityError: Error {
|
||||
case sessionExhausted
|
||||
case messageTooLarge
|
||||
case invalidPeerID
|
||||
case invalidChannelName
|
||||
case rateLimitExceeded
|
||||
case handshakeTimeout
|
||||
}
|
||||
|
||||
// MARK: - Security Audit Checklist
|
||||
|
||||
/*
|
||||
SECURITY AUDIT CHECKLIST:
|
||||
|
||||
1. KEY MANAGEMENT
|
||||
✓ Static keys stored in Keychain (most secure iOS storage)
|
||||
✓ Keys cleared on panic mode
|
||||
✓ Ephemeral keys generated per session
|
||||
✓ No key reuse across sessions
|
||||
|
||||
2. PROTOCOL SECURITY
|
||||
✓ Using Noise XX pattern for mutual authentication
|
||||
✓ Forward secrecy via ephemeral keys
|
||||
✓ Replay protection via nonce counter
|
||||
✓ AEAD encryption (ChaCha20-Poly1305)
|
||||
✓ SHA-256 for hashing
|
||||
|
||||
3. IMPLEMENTATION SECURITY
|
||||
✓ Message size limits to prevent DoS
|
||||
✓ Session timeout to limit exposure
|
||||
✓ Message count limits to prevent nonce reuse
|
||||
✓ Rate limiting for handshakes and messages
|
||||
✓ Input validation for all user data
|
||||
✓ Thread-safe operations
|
||||
|
||||
4. NETWORK SECURITY
|
||||
✓ Messages padded to standard sizes for traffic analysis resistance
|
||||
✓ Cover traffic for anonymity
|
||||
✓ No metadata leakage in protocol
|
||||
✓ Fingerprint verification for identity
|
||||
|
||||
5. EDGE CASES HANDLED
|
||||
✓ Incomplete handshakes timeout
|
||||
✓ Duplicate handshake messages ignored
|
||||
✓ Session renegotiation when needed
|
||||
✓ Graceful handling of decryption failures
|
||||
✓ Memory limits on message sizes
|
||||
|
||||
6. FUTURE IMPROVEMENTS
|
||||
- Implement post-quantum key exchange (when available)
|
||||
- Add perfect forward secrecy for channel keys
|
||||
- Implement key rotation for long-lived channels
|
||||
- Add security event logging
|
||||
- Implement secure key backup/restore
|
||||
*/
|
||||
Reference in New Issue
Block a user