Refactor/repo hardening 01 (#462)

* BinaryProtocol: add optional padding control; BitchatPacket API for padded/unpadded bytes; BLEService: use unpadded encoding and remove ad-hoc unpadding on BLE writes

* BLEService: balance BLE padding — pad Noise handshake/encrypted frames; leave public/announce/leave unpadded; keep fragmentation consistent with chosen padding

* BLEService: replace Timer with DispatchSourceTimer on bleQueue; NostrTransport: cache placeholder NoiseEncryptionService to avoid reallocation

* Unify peerID validation: InputValidator handles 16-hex, 64-hex, or alnum-/_; NoiseSecurityValidator now delegates to InputValidator

* UI: use standard green for geohash toolbar badge and count (less bright in light mode)

* UI: standardize geohash sheet green to app standard (dark: system green, light: darker green) for buttons and checkmark

* Docs: align BinaryProtocol compression docs to zlib; Logs: reduce NostrTransport DELIVERED ack logs to debug to cut noise

* Tests: add InputValidator peerID coverage and BinaryProtocol padding round-trip/length tests

* Project: ensure Xcode project reflects new tests (references added)

---------

Co-authored-by: jack <jackjackbits@users.noreply.github.com>
This commit is contained in:
jack
2025-08-20 13:29:53 +02:00
committed by GitHub
co-authored by jack
parent bdbcbb5d2b
commit 3074fa0fcb
11 changed files with 174 additions and 51 deletions
+11 -3
View File
@@ -6,6 +6,7 @@ struct LocationChannelsSheet: View {
@Binding var isPresented: Bool
@ObservedObject private var manager = LocationChannelManager.shared
@EnvironmentObject var viewModel: ChatViewModel
@Environment(\.colorScheme) var colorScheme
@State private var customGeohash: String = ""
@State private var customError: String? = nil
@@ -24,10 +25,10 @@ struct LocationChannelsSheet: View {
Button(action: { manager.enableLocationChannels() }) {
Text("get location and my geohashes")
.font(.system(size: 12, design: .monospaced))
.foregroundColor(Color.green)
.foregroundColor(standardGreen)
.frame(maxWidth: .infinity)
.padding(.vertical, 6)
.background(Color.green.opacity(0.12))
.background(standardGreen.opacity(0.12))
.cornerRadius(6)
}
.buttonStyle(.plain)
@@ -220,7 +221,7 @@ struct LocationChannelsSheet: View {
if isSelected {
Text("✔︎")
.font(.system(size: 16, design: .monospaced))
.foregroundColor(.green)
.foregroundColor(standardGreen)
}
}
.frame(maxWidth: .infinity, alignment: .leading)
@@ -274,4 +275,11 @@ struct LocationChannelsSheet: View {
}
}
// MARK: - Standardized Colors
extension LocationChannelsSheet {
private var standardGreen: Color {
(colorScheme == .dark) ? Color.green : Color(red: 0, green: 0.5, blue: 0)
}
}
#endif