mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-07-26 18:25:21 +00:00
Harden what a locked or seized device gives away
The realistic compromise for many of the people this app is built for is not interception but a phone taken, and often unlocked under coercion. Content encryption is in good shape; these are the gaps around it. Hide notification previews, by default. Notification content is rendered by the system on the lock screen, so it was readable without unlocking: DM alerts carried the sender's nickname and the full message body, and geohash alerts put the geohash in the title. Alerts now state that a DM, mention, or location-channel activity arrived and withhold the rest until the app is opened. userInfo still carries the routing peer ID and deep link, neither of which the system displays, so taps land where they did. A settings toggle restores full previews for anyone who wants them. Default-on is the deliberate part: a phone face-up on a table should not narrate conversations, and someone who wants previews can say so. Cover the window on willResignActive, so the snapshot iOS stores for the app switcher shows a placeholder rather than an open conversation. Opaque rather than blurred, because blurred large text stays partly legible and the snapshot goes to disk. Added synchronously from a UIKit notification with queue: nil, since the capture follows shortly after and an OperationQueue hop or a SwiftUI state change can lose that race. Panic wipe already deleted snapshots already on disk; this stops new ones from being worth deleting. Bound media by age as well as size. The 100 MB quota only ever considered incoming files, so outgoing media had no lifetime at all and a received photo could outlive its conversation indefinitely. A launch-time sweep now deletes managed media older than seven days, incoming and outgoing, with the same exemptions quota eviction honors: in-flight live captures and files reserved by a delivery or deletion in progress. Make /clear tell the truth on the mesh timeline. It recorded an echo watermark and left the gossip archive on disk for up to 6 hours, so someone who cleared before a police stop had deleted nothing. Clearing now erases the archive too. The watermark still matters: it suppresses pre-clear messages this device hears again from peers. The cost is that the device stops serving recent public backlog until it hears fresh traffic, which is a fair reading of what clearing a timeline means. Documented in PRIVACY_POLICY.md and the privacy assessment, including a new section on what is deliberately NOT addressed: there is still no duress mechanism of any kind (no decoy passphrase, no wipe-on-failed-auth, no app lock), macOS gets no file-protection classes, and media is not sealed at the app layer. The duress question is a product decision as much as an engineering one, since in some jurisdictions destroying data on demand is itself an offence and hiding may protect someone better than destroying, so it is called out rather than guessed at. Three findings from the audit that prompted this work turned out to be already fixed on main and are not included: keychain accessibility is AfterFirstUnlockThisDeviceOnly with a retrying migration, the panic media wipe uses a two-location durable marker transaction, and panic already discards staged share-extension content. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
+5
-2
@@ -40,7 +40,7 @@ bitchat is designed for private, account-free communication. This policy describ
|
||||
|
||||
6. **Media attachments**
|
||||
- Voice notes and images you send or receive can be stored under Application Support so they remain playable while referenced by the app.
|
||||
- Incoming media is subject to a 100 MB quota with oldest-file eviction. Media is deleted by panic wipe or app removal; some outgoing media can otherwise remain on disk.
|
||||
- Incoming media is subject to a 100 MB quota with oldest-file eviction. All stored media, sent and received, is also deleted once it is more than seven days old, and immediately by panic wipe or app removal.
|
||||
|
||||
7. **Optional location-channel state**
|
||||
- Your selected geohash channel, bookmarks, teleport flags, and bookmark display names are stored locally so the UI can restore them.
|
||||
@@ -116,12 +116,15 @@ No cryptographic system can protect content after a recipient reads, copies, scr
|
||||
- **Opaque courier envelopes:** until handed off, evicted by bounded policy, or 24 hours, whichever comes first.
|
||||
- **Recent public mesh gossip:** up to 15 minutes.
|
||||
- **Public board posts and tombstones:** until expiry, at most seven days.
|
||||
- **Groups, favorites, preferences, identity keys, bookmarks, and media:** until removed by the feature, panic wipe, quota eviction where applicable, or app removal.
|
||||
- **Media:** seven days, or sooner by quota eviction, panic wipe, or app removal.
|
||||
- **Groups, favorites, preferences, identity keys, and bookmarks:** until removed by the feature, panic wipe, or app removal.
|
||||
- **Nostr data:** according to the policies of the relays that receive it.
|
||||
|
||||
## Your Controls
|
||||
|
||||
- **Panic wipe:** Triple-tap the logo to synchronously cancel in-flight media work and clear local keys, sessions, preferences, groups, queues, carried mail, public archives, board data, and media managed by the app.
|
||||
- **Notification previews:** Hidden by default, so lock-screen alerts do not show message text, sender names, or geohashes. Full previews can be turned on in settings.
|
||||
- **Clearing a conversation:** Clearing the mesh timeline also deletes the recent public gossip this device had stored on disk.
|
||||
- **Feature controls:** Location channels, mesh bridge, internet gateway, and related internet behaviors can be disabled in the app. Some already-published relay data cannot be recalled.
|
||||
- **System permissions:** Bluetooth, location, microphone, camera, and photo-library access can be revoked in system settings.
|
||||
- **No account:** The project operates no account record for you to request or export.
|
||||
|
||||
@@ -152,11 +152,21 @@ final class AppRuntime: ObservableObject {
|
||||
NetworkActivationService.shared.start()
|
||||
GeohashPresenceService.shared.start()
|
||||
checkForSharedContent()
|
||||
expireAgedMedia()
|
||||
|
||||
record(.launched)
|
||||
record(.startupCompleted)
|
||||
}
|
||||
|
||||
/// Drops media that has outlived the retention window. Off the main thread
|
||||
/// and best-effort: the sweep walks the media tree, and nothing at launch
|
||||
/// depends on its result.
|
||||
private func expireAgedMedia() {
|
||||
Task(priority: .utility) {
|
||||
BLEIncomingFileStore().expireAgedMedia()
|
||||
}
|
||||
}
|
||||
|
||||
func handleOpenURL(_ url: URL) {
|
||||
record(.openedURL(url.absoluteString))
|
||||
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
//
|
||||
// PrivacyScreen.swift
|
||||
// bitchat
|
||||
//
|
||||
// This is free and unencumbered software released into the public domain.
|
||||
// For more information, see <https://unlicense.org>
|
||||
//
|
||||
|
||||
#if os(iOS)
|
||||
import UIKit
|
||||
|
||||
/// Covers the window while the app is not frontmost, so the snapshot iOS takes
|
||||
/// for the app switcher shows a placeholder instead of the open conversation.
|
||||
///
|
||||
/// The cover is added on `willResignActive` and removed on `didBecomeActive`.
|
||||
/// Both are deliberately UIKit notifications rather than SwiftUI's `scenePhase`:
|
||||
/// the snapshot is captured shortly after `willResignActive`, and adding an
|
||||
/// opaque subview to the window synchronously in that callback is the only way
|
||||
/// to guarantee it is in the render tree before the capture. A SwiftUI overlay
|
||||
/// driven by state may not have been laid out yet.
|
||||
///
|
||||
/// Panic wipe separately deletes any snapshots already on disk; this keeps new
|
||||
/// ones from containing anything worth deleting.
|
||||
final class PrivacyScreen {
|
||||
static let shared = PrivacyScreen()
|
||||
|
||||
private var cover: UIView?
|
||||
private var observers: [NSObjectProtocol] = []
|
||||
|
||||
private init() {}
|
||||
|
||||
/// Idempotent: repeated calls do not stack observers.
|
||||
///
|
||||
/// `queue: nil` is required, not incidental. Passing an `OperationQueue`
|
||||
/// would enqueue the handler to run in a later runloop turn, which the
|
||||
/// snapshot can beat; with no queue the block runs synchronously on the
|
||||
/// thread that posted the notification — the main thread, for UIApplication
|
||||
/// lifecycle notifications.
|
||||
func install() {
|
||||
guard observers.isEmpty else { return }
|
||||
let center = NotificationCenter.default
|
||||
observers = [
|
||||
center.addObserver(
|
||||
forName: UIApplication.willResignActiveNotification,
|
||||
object: nil,
|
||||
queue: nil
|
||||
) { _ in
|
||||
PrivacyScreen.shared.show()
|
||||
},
|
||||
center.addObserver(
|
||||
forName: UIApplication.didBecomeActiveNotification,
|
||||
object: nil,
|
||||
queue: nil
|
||||
) { _ in
|
||||
PrivacyScreen.shared.hide()
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
private func show() {
|
||||
guard cover == nil, let window = Self.activeWindow() else { return }
|
||||
|
||||
// Opaque rather than a blur: blurred large text can stay partly
|
||||
// legible, and the snapshot is stored on disk.
|
||||
let view = UIView(frame: window.bounds)
|
||||
view.backgroundColor = .systemBackground
|
||||
view.autoresizingMask = [.flexibleWidth, .flexibleHeight]
|
||||
|
||||
let label = UILabel()
|
||||
label.text = "bitchat"
|
||||
label.font = .monospacedSystemFont(ofSize: 22, weight: .medium)
|
||||
label.textColor = .secondaryLabel
|
||||
label.translatesAutoresizingMaskIntoConstraints = false
|
||||
view.addSubview(label)
|
||||
NSLayoutConstraint.activate([
|
||||
label.centerXAnchor.constraint(equalTo: view.centerXAnchor),
|
||||
label.centerYAnchor.constraint(equalTo: view.centerYAnchor)
|
||||
])
|
||||
|
||||
window.addSubview(view)
|
||||
cover = view
|
||||
}
|
||||
|
||||
private func hide() {
|
||||
cover?.removeFromSuperview()
|
||||
cover = nil
|
||||
}
|
||||
|
||||
private static func activeWindow() -> UIWindow? {
|
||||
UIApplication.shared.connectedScenes
|
||||
.compactMap { $0 as? UIWindowScene }
|
||||
.flatMap(\.windows)
|
||||
.first { $0.isKeyWindow } ??
|
||||
UIApplication.shared.connectedScenes
|
||||
.compactMap { $0 as? UIWindowScene }
|
||||
.flatMap(\.windows)
|
||||
.first
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -74,7 +74,10 @@ final class AppDelegate: NSObject, UIApplicationDelegate {
|
||||
weak var runtime: AppRuntime?
|
||||
|
||||
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
|
||||
true
|
||||
// Installed before the first resign-active so the app-switcher snapshot
|
||||
// never captures an open conversation.
|
||||
PrivacyScreen.shared.install()
|
||||
return true
|
||||
}
|
||||
|
||||
func applicationWillTerminate(_ application: UIApplication) {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -114,6 +114,9 @@ struct BLEIncomingFileStore: @unchecked Sendable {
|
||||
}
|
||||
|
||||
private static let defaultQuotaBytes: Int64 = 100 * 1024 * 1024
|
||||
/// How long managed media may stay on disk. Bounds by age what the quota
|
||||
/// only bounds by size; see `expireAgedMedia(retention:)`.
|
||||
static let defaultMediaRetention: TimeInterval = 7 * 24 * 60 * 60
|
||||
/// Kept outside `files/` so deleting the media tree cannot erase the
|
||||
/// fail-closed startup decision before the full panic has committed.
|
||||
private static let panicRecoveryPendingMarkerFileName =
|
||||
@@ -569,6 +572,84 @@ struct BLEIncomingFileStore: @unchecked Sendable {
|
||||
}
|
||||
}
|
||||
|
||||
/// Deletes managed media older than `retention`, across both incoming and
|
||||
/// outgoing directories, and reports how many files went away.
|
||||
///
|
||||
/// The quota sweep above only bounds *size*, and only for incoming files,
|
||||
/// so a received photo or a sent voice note could sit on disk unbounded in
|
||||
/// time — long outliving the conversation it belonged to, which is what a
|
||||
/// seized device gives up. This bounds media by age instead, on the same
|
||||
/// principle as the courier envelope and gossip archive lifetimes.
|
||||
///
|
||||
/// Honors the same exclusions as quota eviction: in-flight live captures
|
||||
/// and files reserved by an in-progress delivery or deletion are left
|
||||
/// alone regardless of age.
|
||||
@discardableResult
|
||||
func expireAgedMedia(retention: TimeInterval = Self.defaultMediaRetention) -> Int {
|
||||
guard retention > 0 else { return 0 }
|
||||
|
||||
payloadCoordination.lock.lock()
|
||||
defer { payloadCoordination.lock.unlock() }
|
||||
|
||||
let cutoff = dateProvider().addingTimeInterval(-retention)
|
||||
let activeDeletionPaths = payloadCoordination
|
||||
.deletionReservations.values.reduce(into: Set<String>()) {
|
||||
$0.formUnion($1)
|
||||
}
|
||||
let protectedPaths = activeDeletionPaths.union(
|
||||
payloadCoordination.pendingDeliveryPaths
|
||||
)
|
||||
|
||||
var removed = 0
|
||||
do {
|
||||
let base = try filesDirectory()
|
||||
for subdirectory in Self.mediaSubdirectories {
|
||||
let dir = base.appendingPathComponent(subdirectory, isDirectory: true)
|
||||
guard fileManager.fileExists(atPath: dir.path) else { continue }
|
||||
guard let contents = try? fileManager.contentsOfDirectory(
|
||||
at: dir,
|
||||
includingPropertiesForKeys: [.contentModificationDateKey],
|
||||
options: [.skipsHiddenFiles]
|
||||
) else { continue }
|
||||
|
||||
for fileURL in contents {
|
||||
guard let modified = try? fileURL.resourceValues(
|
||||
forKeys: [.contentModificationDateKey]
|
||||
).contentModificationDate else { continue }
|
||||
guard modified < cutoff else { continue }
|
||||
guard !fileURL.lastPathComponent.hasPrefix(Self.liveCapturePrefix) else { continue }
|
||||
guard !protectedPaths.contains(
|
||||
fileURL.standardizedFileURL.path
|
||||
) else { continue }
|
||||
|
||||
do {
|
||||
try fileManager.removeItem(at: fileURL)
|
||||
removed += 1
|
||||
} catch {
|
||||
SecureLogger.warning(
|
||||
"⚠️ Failed to expire aged media file: \(error)",
|
||||
category: .security
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
SecureLogger.warning(
|
||||
"⚠️ Could not expire aged media: \(error)",
|
||||
category: .security
|
||||
)
|
||||
return removed
|
||||
}
|
||||
|
||||
if removed > 0 {
|
||||
SecureLogger.info(
|
||||
"🗑️ Expired \(removed) media file(s) older than the retention window",
|
||||
category: .security
|
||||
)
|
||||
}
|
||||
return removed
|
||||
}
|
||||
|
||||
private func filesDirectory() throws -> URL {
|
||||
let filesDir = try rootDirectory().appendingPathComponent("files", isDirectory: true)
|
||||
try fileManager.createDirectory(at: filesDir, withIntermediateDirectories: true, attributes: nil)
|
||||
|
||||
@@ -2574,6 +2574,12 @@ final class BLEService: NSObject {
|
||||
gossipSyncManager?.removePublicMessages(from: peerID)
|
||||
}
|
||||
|
||||
/// Clearing the mesh timeline erases the archive behind it, so the cleared
|
||||
/// history is gone from disk rather than merely hidden from the timeline.
|
||||
func purgeAllArchivedPublicMessages() {
|
||||
gossipSyncManager?.removeAllPublicMessages()
|
||||
}
|
||||
|
||||
func collectArchivedPublicMessages(completion: @escaping @MainActor ([ArchivedPublicMessage]) -> Void) {
|
||||
guard let generation = capturePanicLifecycleGeneration() else {
|
||||
return
|
||||
|
||||
@@ -10,9 +10,12 @@ import Foundation
|
||||
|
||||
/// Watermark for "heard here earlier" echoes: clearing the mesh timeline
|
||||
/// (triple-tap or /clear) records the moment, and the next launch only
|
||||
/// re-seeds archived messages heard after it. The archive itself is left
|
||||
/// alone — the device keeps carrying those messages for peers; the user
|
||||
/// just doesn't want to see them again.
|
||||
/// re-seeds archived messages heard after it.
|
||||
///
|
||||
/// Clearing also erases the archive itself, so cleared history is gone from
|
||||
/// disk rather than merely hidden from the timeline. The watermark still
|
||||
/// matters afterwards: it keeps messages this device hears again from peers,
|
||||
/// which predate the clear, from reappearing as echoes.
|
||||
enum MeshEchoSettings {
|
||||
private static let clearedThroughKey = "meshEchoes.clearedThrough"
|
||||
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
//
|
||||
// NotificationPrivacySettings.swift
|
||||
// bitchat
|
||||
//
|
||||
// This is free and unencumbered software released into the public domain.
|
||||
// For more information, see <https://unlicense.org>
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
/// Controls how much a delivered notification says while the device is locked.
|
||||
///
|
||||
/// Notification content is rendered by the system on the lock screen, so it is
|
||||
/// readable by anyone holding the phone without unlocking it. With previews
|
||||
/// hidden, alerts still say that something arrived and stay tappable, but the
|
||||
/// message body, the sender's nickname, and the geohash are withheld until the
|
||||
/// app is opened.
|
||||
///
|
||||
/// Defaults to hidden: a locked phone lying on a table or taken at a protest
|
||||
/// should not narrate conversations, and someone who wants previews can say so.
|
||||
enum NotificationPrivacySettings {
|
||||
private static let hidePreviewsKey = "notifications.hideMessagePreviews"
|
||||
|
||||
static var hideMessagePreviews: Bool {
|
||||
get { UserDefaults.standard.object(forKey: hidePreviewsKey) as? Bool ?? true }
|
||||
set { UserDefaults.standard.set(newValue, forKey: hidePreviewsKey) }
|
||||
}
|
||||
|
||||
/// Panic-wipe hook. Removing the key restores the hidden default, so a
|
||||
/// wiped device cannot come back quieter than a fresh install.
|
||||
static func reset() {
|
||||
UserDefaults.standard.removeObject(forKey: hidePreviewsKey)
|
||||
}
|
||||
}
|
||||
@@ -95,6 +95,29 @@ final class NotificationService {
|
||||
static let nearbyCategoryID = "chat.bitchat.category.nearby"
|
||||
static let waveActionID = "chat.bitchat.action.wave"
|
||||
|
||||
/// Copy used when `NotificationPrivacySettings.hideMessagePreviews` is on.
|
||||
/// These say that something arrived without naming who sent it, quoting it,
|
||||
/// or disclosing which geohash it came from.
|
||||
private enum Redacted {
|
||||
static var directMessageTitle: String {
|
||||
String(localized: "notification.redacted.dm.title", defaultValue: "🔒 new dm", comment: "Lock-screen notification title for a received direct message when message previews are hidden; deliberately names neither the sender nor the content")
|
||||
}
|
||||
static var mentionTitle: String {
|
||||
String(localized: "notification.redacted.mention.title", defaultValue: "🫵 you were mentioned", comment: "Lock-screen notification title telling someone they were mentioned when message previews are hidden; deliberately omits who mentioned them")
|
||||
}
|
||||
static var geohashActivityTitle: String {
|
||||
String(localized: "notification.redacted.geohash.title", defaultValue: "📍 new activity nearby", comment: "Lock-screen notification title for activity in a location channel when message previews are hidden; deliberately omits the geohash")
|
||||
}
|
||||
static var body: String {
|
||||
String(localized: "notification.redacted.body", defaultValue: "open bitchat to read", comment: "Lock-screen notification body shown in place of the message text when message previews are hidden")
|
||||
}
|
||||
}
|
||||
|
||||
/// Whether delivered alerts must withhold sender, content, and geohash.
|
||||
private var hidePreviews: Bool {
|
||||
NotificationPrivacySettings.hideMessagePreviews
|
||||
}
|
||||
|
||||
private let isRunningTestsProvider: () -> Bool
|
||||
private let authorizer: NotificationAuthorizing
|
||||
private let requestDeliverer: NotificationRequestDelivering
|
||||
@@ -197,29 +220,34 @@ final class NotificationService {
|
||||
}
|
||||
|
||||
func sendMentionNotification(from sender: String, message: String) {
|
||||
let title = "🫵 you were mentioned by \(sender)"
|
||||
let body = message
|
||||
let title = hidePreviews ? Redacted.mentionTitle : "🫵 you were mentioned by \(sender)"
|
||||
let body = hidePreviews ? Redacted.body : message
|
||||
let identifier = "mention-\(UUID().uuidString)"
|
||||
|
||||
|
||||
sendLocalNotification(title: title, body: body, identifier: identifier)
|
||||
}
|
||||
|
||||
|
||||
func sendPrivateMessageNotification(from sender: String, message: String, peerID: PeerID) {
|
||||
let title = "🔒 DM from \(sender)"
|
||||
let body = message
|
||||
let title = hidePreviews ? Redacted.directMessageTitle : "🔒 DM from \(sender)"
|
||||
let body = hidePreviews ? Redacted.body : message
|
||||
let identifier = "private-\(UUID().uuidString)"
|
||||
// Routing payload, not display copy: `userInfo` never reaches the lock
|
||||
// screen, and the conversation to open still has to be identifiable.
|
||||
let userInfo = ["peerID": peerID.id, "senderName": sender]
|
||||
|
||||
|
||||
sendLocalNotification(title: title, body: body, identifier: identifier, userInfo: userInfo)
|
||||
}
|
||||
|
||||
|
||||
// Geohash public chat notification with deep link to a specific geohash
|
||||
func sendGeohashActivityNotification(geohash: String, titlePrefix: String = "#", bodyPreview: String) {
|
||||
let title = "\(titlePrefix)\(geohash)"
|
||||
// The geohash itself is location data, so hiding previews withholds it
|
||||
// from the alert while leaving the deep link intact for the tap.
|
||||
let title = hidePreviews ? Redacted.geohashActivityTitle : "\(titlePrefix)\(geohash)"
|
||||
let body = hidePreviews ? Redacted.body : bodyPreview
|
||||
let identifier = "geo-activity-\(geohash)-\(Date().timeIntervalSince1970)"
|
||||
let deeplink = "bitchat://geohash/\(geohash)"
|
||||
let userInfo: [String: Any] = ["deeplink": deeplink]
|
||||
sendLocalNotification(title: title, body: bodyPreview, identifier: identifier, userInfo: userInfo)
|
||||
sendLocalNotification(title: title, body: body, identifier: identifier, userInfo: userInfo)
|
||||
}
|
||||
|
||||
func sendNetworkAvailableNotification(peerCount: Int) {
|
||||
|
||||
@@ -293,6 +293,9 @@ protocol Transport: AnyObject {
|
||||
/// Drops any carried public messages from a (newly blocked) sender so
|
||||
/// they can't resurface as archived echoes on a later launch.
|
||||
func purgeArchivedPublicMessages(from peerID: PeerID)
|
||||
/// Erases the whole carried public-message archive, on disk included, so
|
||||
/// clearing the mesh timeline deletes that history rather than hiding it.
|
||||
func purgeAllArchivedPublicMessages()
|
||||
}
|
||||
|
||||
/// A carried public mesh message from the store-and-forward window, decoded
|
||||
@@ -403,6 +406,7 @@ extension Transport {
|
||||
}
|
||||
|
||||
func purgeArchivedPublicMessages(from peerID: PeerID) {}
|
||||
func purgeAllArchivedPublicMessages() {}
|
||||
}
|
||||
|
||||
protocol TransportPeerEventsDelegate: AnyObject {
|
||||
|
||||
@@ -733,6 +733,26 @@ final class GossipSyncManager {
|
||||
}
|
||||
}
|
||||
|
||||
/// Drop every carried public message and clear the archive on disk.
|
||||
///
|
||||
/// Used when someone clears the mesh timeline: the watermark already stops
|
||||
/// cleared messages from being shown again, so anything left in the
|
||||
/// archive is retained purely to serve other peers — and a person who
|
||||
/// clears a timeline reasonably reads that as "this is gone from my
|
||||
/// phone". The cost is that this device stops offering the recent public
|
||||
/// backlog to peers until it hears fresh traffic.
|
||||
func removeAllPublicMessages() {
|
||||
queue.async { [weak self] in
|
||||
guard let self else { return }
|
||||
self.messages.remove { _ in true }
|
||||
self.archiveDirty = true
|
||||
// Persist now rather than waiting for maintenance: a relaunch in
|
||||
// the gap would restore the purged messages from disk.
|
||||
self.persistArchiveIfDirty()
|
||||
self.archive?.wipe()
|
||||
}
|
||||
}
|
||||
|
||||
private func removeState(for peerID: PeerID) {
|
||||
// Deliberately keeps the peer's prekey bundle: bundles exist to reach
|
||||
// owners who left the mesh, and they age out on their own schedule.
|
||||
|
||||
@@ -44,6 +44,9 @@ protocol ChatPublicConversationContext: AnyObject {
|
||||
func removePublicMessages(fromGeohash geohash: String, where predicate: (BitchatMessage) -> Bool)
|
||||
/// Empties a public conversation's timeline (`/clear`).
|
||||
func clearPublicConversation(_ conversationID: ConversationID)
|
||||
/// Erases the on-disk archive of carried public mesh messages, so clearing
|
||||
/// the mesh timeline deletes that history instead of only hiding it.
|
||||
func purgeArchivedPublicMessages()
|
||||
/// Queues a system message for the next geohash channel visit.
|
||||
func queueGeohashSystemMessage(_ content: String)
|
||||
|
||||
@@ -289,12 +292,14 @@ final class ChatPublicConversationCoordinator: PublicMessagePipelineDelegate {
|
||||
context.clearPublicConversation(ConversationID(channelID: context.activeChannel))
|
||||
|
||||
// Clearing the mesh timeline also dismisses its archived echoes for
|
||||
// good: the watermark stops the next launch from re-seeding them
|
||||
// (the archive itself keeps carrying the messages for peers), and
|
||||
// the dedup keys go so a cleared message arriving live shows again.
|
||||
// good: the watermark stops the next launch from re-seeding them, the
|
||||
// archive on disk is erased so the cleared history is actually gone
|
||||
// rather than merely hidden, and the dedup keys go so a cleared
|
||||
// message arriving live shows again.
|
||||
if case .mesh = context.activeChannel {
|
||||
MeshEchoSettings.clearedThrough = Date()
|
||||
archivedEchoKeys.removeAll()
|
||||
context.purgeArchivedPublicMessages()
|
||||
}
|
||||
|
||||
// The SPM test process shares the real Application Support tree, so this
|
||||
|
||||
@@ -1066,6 +1066,10 @@ final class ChatViewModel: ObservableObject, BitchatDelegate, SynchronousMessage
|
||||
conversations.clear(conversationID)
|
||||
}
|
||||
|
||||
func purgeArchivedPublicMessages() {
|
||||
meshService.purgeAllArchivedPublicMessages()
|
||||
}
|
||||
|
||||
/// Queues a system message for the next geohash channel visit. (Tiny
|
||||
/// UI-flow queue formerly on `PublicTimelineStore`; it is notice text,
|
||||
/// not conversation state, so it stays on the owner.)
|
||||
@@ -1628,6 +1632,7 @@ final class ChatViewModel: ObservableObject, BitchatDelegate, SynchronousMessage
|
||||
GeohashChatActivityTracker.shared.clear()
|
||||
MeshSightingsTracker.shared.clear()
|
||||
MeshEchoSettings.reset()
|
||||
NotificationPrivacySettings.reset()
|
||||
|
||||
// Drop private group keys and rosters (keychain + disk)
|
||||
groupStore.wipe()
|
||||
|
||||
@@ -21,6 +21,7 @@ struct AppInfoView: View {
|
||||
@State private var showTopology = false
|
||||
@State private var liveVoiceEnabled = PTTSettings.liveVoiceEnabled
|
||||
@State private var locationNotesEnabled = LocationNotesSettings.enabled
|
||||
@State private var hideMessagePreviews = NotificationPrivacySettings.hideMessagePreviews
|
||||
@ObservedObject private var locationManager = LocationChannelManager.shared
|
||||
/// Sticky across opens: first-ever open lands on Info (the gentler
|
||||
/// introduction), and afterwards the sheet reopens wherever it was left.
|
||||
@@ -83,6 +84,10 @@ struct AppInfoView: View {
|
||||
static let toggleOn: LocalizedStringKey = "common.toggle.on"
|
||||
static let toggleOff: LocalizedStringKey = "common.toggle.off"
|
||||
|
||||
static let privacyTitle = String(localized: "app_info.settings.privacy.title", defaultValue: "PRIVACY", comment: "Section header (uppercase) for privacy settings such as hiding notification previews")
|
||||
static let hidePreviewsTitle = String(localized: "app_info.settings.hide_previews.title", defaultValue: "hide message previews", comment: "Title of the setting that keeps message text, sender names, and geohashes out of lock-screen notifications")
|
||||
static let hidePreviewsSubtitle = String(localized: "app_info.settings.hide_previews.subtitle", defaultValue: "notifications say that something arrived without showing the message, who sent it, or which location channel it came from. anyone holding your locked phone learns nothing from the lock screen. on by default.", comment: "Subtitle explaining what hiding notification message previews does")
|
||||
|
||||
static let dangerTitle = String(localized: "app_info.settings.danger.title", defaultValue: "DANGER ZONE", comment: "Section header (uppercase) for destructive actions in settings")
|
||||
static let panicButton = String(localized: "app_info.settings.danger.panic_button", defaultValue: "panic wipe", comment: "Button in the settings danger zone that erases all local data after confirmation")
|
||||
static let panicNote = String(localized: "app_info.settings.danger.panic_note", defaultValue: "erases all messages, keys, and identity. triple-tapping the bitchat/ logo does the same, instantly.", comment: "Caption under the panic wipe button explaining what it does and the triple-tap shortcut")
|
||||
@@ -477,6 +482,26 @@ struct AppInfoView: View {
|
||||
}
|
||||
}
|
||||
|
||||
// Privacy: what a locked, seized, or borrowed phone gives away
|
||||
// without being unlocked.
|
||||
VStack(alignment: .leading, spacing: 12) {
|
||||
SectionHeader(verbatim: Strings.Settings.privacyTitle)
|
||||
|
||||
settingsCard {
|
||||
settingToggle(
|
||||
title: Text(verbatim: Strings.Settings.hidePreviewsTitle),
|
||||
subtitle: Text(verbatim: Strings.Settings.hidePreviewsSubtitle),
|
||||
isOn: Binding(
|
||||
get: { hideMessagePreviews },
|
||||
set: { newValue in
|
||||
hideMessagePreviews = newValue
|
||||
NotificationPrivacySettings.hideMessagePreviews = newValue
|
||||
}
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// Danger zone
|
||||
if onPanicWipe != nil {
|
||||
VStack(alignment: .leading, spacing: 12) {
|
||||
|
||||
@@ -79,12 +79,17 @@ private final class MockChatPublicConversationContext: ChatPublicConversationCon
|
||||
}
|
||||
|
||||
private(set) var clearedConversations: [ConversationID] = []
|
||||
private(set) var archivePurgeCount = 0
|
||||
|
||||
func clearPublicConversation(_ conversationID: ConversationID) {
|
||||
clearedConversations.append(conversationID)
|
||||
conversations[conversationID] = []
|
||||
}
|
||||
|
||||
func purgeArchivedPublicMessages() {
|
||||
archivePurgeCount += 1
|
||||
}
|
||||
|
||||
func queueGeohashSystemMessage(_ content: String) {
|
||||
queuedGeohashSystemMessages.append(content)
|
||||
}
|
||||
@@ -345,6 +350,35 @@ struct ChatPublicConversationCoordinatorContextTests {
|
||||
#expect(context.enqueuedMessages.first?.conversationID == .geohash(geohash))
|
||||
}
|
||||
|
||||
/// `/clear` on the mesh timeline used to only record a watermark, leaving
|
||||
/// the archive on disk for up to its freshness window — so someone who
|
||||
/// cleared before a police stop had deleted nothing. It must now erase the
|
||||
/// archive behind the timeline.
|
||||
@Test @MainActor
|
||||
func clearCurrentPublicTimeline_onMesh_erasesTheArchive() async {
|
||||
let context = MockChatPublicConversationContext()
|
||||
let coordinator = ChatPublicConversationCoordinator(context: context)
|
||||
context.activeChannel = .mesh
|
||||
|
||||
coordinator.clearCurrentPublicTimeline()
|
||||
|
||||
#expect(context.clearedConversations == [.mesh])
|
||||
#expect(context.archivePurgeCount == 1)
|
||||
}
|
||||
|
||||
/// Geohash timelines are Nostr-backed and carry no mesh gossip archive, so
|
||||
/// clearing one must not reach for it.
|
||||
@Test @MainActor
|
||||
func clearCurrentPublicTimeline_onGeohash_leavesTheArchiveAlone() async {
|
||||
let context = MockChatPublicConversationContext()
|
||||
let coordinator = ChatPublicConversationCoordinator(context: context)
|
||||
context.activeChannel = .location(GeohashChannel(level: .city, geohash: "u4pruy"))
|
||||
|
||||
coordinator.clearCurrentPublicTimeline()
|
||||
|
||||
#expect(context.archivePurgeCount == 0)
|
||||
}
|
||||
|
||||
@Test @MainActor
|
||||
func blockGeohashUser_purgesMessagesMappingsAndPrivateChats() async {
|
||||
let context = MockChatPublicConversationContext()
|
||||
|
||||
@@ -810,6 +810,45 @@ struct GossipSyncManagerTests {
|
||||
#expect(manager._messageCount(for: PeerID(hexData: senderID)) == 0)
|
||||
}
|
||||
|
||||
/// Clearing the mesh timeline must leave nothing behind on disk: a
|
||||
/// relaunch that restored the archive would undo the clear.
|
||||
@Test func removeAllPublicMessagesErasesTheArchiveOnDisk() async throws {
|
||||
let fileURL = FileManager.default.temporaryDirectory
|
||||
.appendingPathComponent("gossip-archive-\(UUID().uuidString).json")
|
||||
defer { try? FileManager.default.removeItem(at: fileURL) }
|
||||
|
||||
let senderID = try #require(Data(hexString: "1122334455667788"))
|
||||
let packet = BitchatPacket(
|
||||
type: MessageType.message.rawValue,
|
||||
senderID: senderID,
|
||||
recipientID: nil,
|
||||
timestamp: UInt64(Date().timeIntervalSince1970 * 1000),
|
||||
payload: Data([0x01, 0x02]),
|
||||
signature: nil,
|
||||
ttl: 1
|
||||
)
|
||||
|
||||
let manager = GossipSyncManager(
|
||||
myPeerID: myPeerID,
|
||||
requestSyncManager: RequestSyncManager(),
|
||||
archive: GossipMessageArchive(fileURL: fileURL)
|
||||
)
|
||||
manager.onPublicPacketSeen(packet)
|
||||
manager._performMaintenanceSynchronously(now: Date())
|
||||
#expect(FileManager.default.fileExists(atPath: fileURL.path))
|
||||
|
||||
manager.removeAllPublicMessages()
|
||||
|
||||
let erased = await TestHelpers.waitUntil(
|
||||
{
|
||||
!FileManager.default.fileExists(atPath: fileURL.path)
|
||||
&& manager._messageCount(for: PeerID(hexData: senderID)) == 0
|
||||
},
|
||||
timeout: TestConstants.shortTimeout
|
||||
)
|
||||
#expect(erased)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private final class RecordingDelegate: GossipSyncManager.Delegate {
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
import Foundation
|
||||
import Testing
|
||||
@testable import bitchat
|
||||
|
||||
/// Media used to be bounded only by a 100 MB incoming quota, so a received
|
||||
/// photo or a sent voice note could sit on disk indefinitely — outliving the
|
||||
/// conversation it belonged to, which is exactly what a seized device gives up.
|
||||
/// These cover the age-based sweep that bounds it in time as well.
|
||||
struct MediaRetentionTests {
|
||||
private func makeRoot() -> URL {
|
||||
FileManager.default.temporaryDirectory
|
||||
.appendingPathComponent("media-retention-\(UUID().uuidString)", isDirectory: true)
|
||||
}
|
||||
|
||||
private func write(
|
||||
_ name: String,
|
||||
in directory: URL,
|
||||
modified: Date
|
||||
) throws -> URL {
|
||||
try FileManager.default.createDirectory(
|
||||
at: directory,
|
||||
withIntermediateDirectories: true
|
||||
)
|
||||
let url = directory.appendingPathComponent(name)
|
||||
try Data([0xFF, 0xD8, 0xFF, 0xD9]).write(to: url)
|
||||
try FileManager.default.setAttributes(
|
||||
[.modificationDate: modified],
|
||||
ofItemAtPath: url.path
|
||||
)
|
||||
return url
|
||||
}
|
||||
|
||||
@Test
|
||||
func expiresOutgoingMediaPastRetentionAndKeepsFreshMedia() throws {
|
||||
let root = makeRoot()
|
||||
defer { try? FileManager.default.removeItem(at: root) }
|
||||
let store = BLEIncomingFileStore(baseDirectory: root)
|
||||
let outgoing = root.appendingPathComponent("files/images/outgoing", isDirectory: true)
|
||||
|
||||
// Outgoing media had no lifetime at all before this sweep: the quota
|
||||
// only ever considered incoming directories.
|
||||
let stale = try write(
|
||||
"sent_old.jpg",
|
||||
in: outgoing,
|
||||
modified: Date(timeIntervalSinceNow: -8 * 24 * 60 * 60)
|
||||
)
|
||||
let fresh = try write(
|
||||
"sent_new.jpg",
|
||||
in: outgoing,
|
||||
modified: Date(timeIntervalSinceNow: -60)
|
||||
)
|
||||
|
||||
let removed = store.expireAgedMedia()
|
||||
|
||||
#expect(removed == 1)
|
||||
#expect(!FileManager.default.fileExists(atPath: stale.path))
|
||||
#expect(FileManager.default.fileExists(atPath: fresh.path))
|
||||
}
|
||||
|
||||
@Test
|
||||
func expiresIncomingMediaPastRetention() throws {
|
||||
let root = makeRoot()
|
||||
defer { try? FileManager.default.removeItem(at: root) }
|
||||
let store = BLEIncomingFileStore(baseDirectory: root)
|
||||
let incoming = try store.incomingDirectory(subdirectory: "voicenotes/incoming")
|
||||
|
||||
let stale = try write(
|
||||
"received.m4a",
|
||||
in: incoming,
|
||||
modified: Date(timeIntervalSinceNow: -8 * 24 * 60 * 60)
|
||||
)
|
||||
|
||||
#expect(store.expireAgedMedia() == 1)
|
||||
#expect(!FileManager.default.fileExists(atPath: stale.path))
|
||||
}
|
||||
|
||||
@Test
|
||||
func retentionSweepSkipsInFlightLiveCaptures() throws {
|
||||
let root = makeRoot()
|
||||
defer { try? FileManager.default.removeItem(at: root) }
|
||||
let store = BLEIncomingFileStore(baseDirectory: root)
|
||||
let incoming = try store.incomingDirectory(subdirectory: "voicenotes/incoming")
|
||||
|
||||
// Deleting a live capture mid-stream unlinks the inode under the
|
||||
// coordinator's open FileHandle, so age must not override the guard.
|
||||
let inFlight = try write(
|
||||
"\(BLEIncomingFileStore.liveCapturePrefix)00112233445566ff_dm.aac",
|
||||
in: incoming,
|
||||
modified: Date(timeIntervalSinceNow: -30 * 24 * 60 * 60)
|
||||
)
|
||||
|
||||
#expect(store.expireAgedMedia() == 0)
|
||||
#expect(FileManager.default.fileExists(atPath: inFlight.path))
|
||||
}
|
||||
|
||||
@Test
|
||||
func nonPositiveRetentionIsANoOp() throws {
|
||||
let root = makeRoot()
|
||||
defer { try? FileManager.default.removeItem(at: root) }
|
||||
let store = BLEIncomingFileStore(baseDirectory: root)
|
||||
let incoming = try store.incomingDirectory(subdirectory: "images/incoming")
|
||||
|
||||
let file = try write(
|
||||
"received.jpg",
|
||||
in: incoming,
|
||||
modified: Date(timeIntervalSinceNow: -365 * 24 * 60 * 60)
|
||||
)
|
||||
|
||||
#expect(store.expireAgedMedia(retention: 0) == 0)
|
||||
#expect(FileManager.default.fileExists(atPath: file.path))
|
||||
}
|
||||
|
||||
@Test
|
||||
func defaultRetentionIsSevenDays() {
|
||||
#expect(BLEIncomingFileStore.defaultMediaRetention == 7 * 24 * 60 * 60)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
import BitFoundation
|
||||
import Foundation
|
||||
import Testing
|
||||
import UserNotifications
|
||||
@testable import bitchat
|
||||
|
||||
/// Lock-screen notifications used to carry the DM body and the sender's
|
||||
/// nickname verbatim, and the geohash in the title, so a locked phone lying on
|
||||
/// a table narrated conversations to anyone looking at it. These cover the
|
||||
/// redaction that is now the default.
|
||||
///
|
||||
/// Serialized because the preference lives in `UserDefaults.standard`; parallel
|
||||
/// cases would race each other's saves.
|
||||
@Suite(.serialized)
|
||||
struct NotificationRedactionTests {
|
||||
private final class RecordingDeliverer: NotificationRequestDelivering {
|
||||
var requests: [UNNotificationRequest] = []
|
||||
|
||||
func add(_ request: UNNotificationRequest) {
|
||||
requests.append(request)
|
||||
}
|
||||
}
|
||||
|
||||
private struct StubAuthorizer: NotificationAuthorizing {
|
||||
func requestAuthorization(
|
||||
options: UNAuthorizationOptions,
|
||||
completionHandler: @escaping (Bool, Error?) -> Void
|
||||
) {
|
||||
completionHandler(true, nil)
|
||||
}
|
||||
}
|
||||
|
||||
/// Runs `body` with the preference forced to `hidePreviews`, restoring
|
||||
/// whatever the environment had afterwards.
|
||||
private func withHidePreviews(
|
||||
_ hidePreviews: Bool,
|
||||
_ body: (NotificationService, RecordingDeliverer) throws -> Void
|
||||
) rethrows {
|
||||
let original = NotificationPrivacySettings.hideMessagePreviews
|
||||
defer { NotificationPrivacySettings.hideMessagePreviews = original }
|
||||
NotificationPrivacySettings.hideMessagePreviews = hidePreviews
|
||||
|
||||
let deliverer = RecordingDeliverer()
|
||||
let service = NotificationService(
|
||||
isRunningTestsProvider: { false },
|
||||
authorizer: StubAuthorizer(),
|
||||
requestDeliverer: deliverer
|
||||
)
|
||||
try body(service, deliverer)
|
||||
}
|
||||
|
||||
@Test func previewsAreHiddenByDefault() {
|
||||
// A fresh install must start quiet rather than opt-in quiet.
|
||||
UserDefaults.standard.removeObject(forKey: "notifications.hideMessagePreviews")
|
||||
#expect(NotificationPrivacySettings.hideMessagePreviews)
|
||||
}
|
||||
|
||||
@Test func redactedDirectMessageWithholdsSenderAndBody() {
|
||||
withHidePreviews(true) { service, deliverer in
|
||||
service.sendPrivateMessageNotification(
|
||||
from: "alice",
|
||||
message: "meet at the north gate",
|
||||
peerID: PeerID(str: "00112233445566ff")
|
||||
)
|
||||
|
||||
let content = try! #require(deliverer.requests.first).content
|
||||
#expect(!content.title.contains("alice"))
|
||||
#expect(!content.body.contains("north gate"))
|
||||
#expect(!content.title.isEmpty)
|
||||
// Still routable: userInfo is never rendered on the lock screen.
|
||||
#expect(content.userInfo["peerID"] as? String == "00112233445566ff")
|
||||
}
|
||||
}
|
||||
|
||||
@Test func redactedMentionWithholdsSenderAndBody() {
|
||||
withHidePreviews(true) { service, deliverer in
|
||||
service.sendMentionNotification(from: "bob", message: "regroup now")
|
||||
|
||||
let content = try! #require(deliverer.requests.first).content
|
||||
#expect(!content.title.contains("bob"))
|
||||
#expect(!content.body.contains("regroup"))
|
||||
}
|
||||
}
|
||||
|
||||
@Test func redactedGeohashActivityWithholdsTheGeohash() {
|
||||
withHidePreviews(true) { service, deliverer in
|
||||
service.sendGeohashActivityNotification(
|
||||
geohash: "u4pruyd",
|
||||
bodyPreview: "someone said something"
|
||||
)
|
||||
|
||||
let content = try! #require(deliverer.requests.first).content
|
||||
#expect(!content.title.contains("u4pruyd"))
|
||||
#expect(!content.body.contains("someone said"))
|
||||
// The deep link still carries it: tapping must land in the channel.
|
||||
#expect(content.userInfo["deeplink"] as? String == "bitchat://geohash/u4pruyd")
|
||||
}
|
||||
}
|
||||
|
||||
@Test func previewsShownWhenTheSettingIsOff() {
|
||||
withHidePreviews(false) { service, deliverer in
|
||||
service.sendPrivateMessageNotification(
|
||||
from: "alice",
|
||||
message: "meet at the north gate",
|
||||
peerID: PeerID(str: "00112233445566ff")
|
||||
)
|
||||
service.sendGeohashActivityNotification(
|
||||
geohash: "u4pruyd",
|
||||
bodyPreview: "someone said something"
|
||||
)
|
||||
|
||||
#expect(deliverer.requests.count == 2)
|
||||
let dm = deliverer.requests[0].content
|
||||
#expect(dm.title.contains("alice"))
|
||||
#expect(dm.body == "meet at the north gate")
|
||||
let geo = deliverer.requests[1].content
|
||||
#expect(geo.title.contains("u4pruyd"))
|
||||
#expect(geo.body == "someone said something")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,7 @@ The user-facing contract is `PRIVACY_POLICY.md`. This document records implement
|
||||
- Private payloads are end-to-end encrypted, but public mesh, board, bridge, and geohash content is intentionally visible to its participants.
|
||||
- Local storage is bounded where practical and included in panic wipe, but it is not wholly ephemeral. The app persists the stores listed below.
|
||||
- The app and share extension each bundle a privacy manifest declaring their actual required-reason API use.
|
||||
- A locked device discloses less than an unlocked one, but not nothing. Notification previews are hidden by default and the app-switcher snapshot is covered; see "Locked and Seized Devices".
|
||||
|
||||
## BLE Discovery and Metadata
|
||||
|
||||
@@ -48,7 +49,7 @@ Residual risk: private-message metadata such as timing, radio adjacency, ciphert
|
||||
- Recent signed public mesh messages are archived in Application Support for up to 15 minutes so gossip sync survives a relaunch and can cross mesh partitions.
|
||||
- Signed public board posts and tombstones persist until author-selected expiry, at most seven days. Stores are bounded by global and per-author quotas.
|
||||
- Group metadata (name, roster, creator, epoch) persists as protected JSON; group keys live in the keychain until leave/removal/wipe.
|
||||
- Voice notes and images are stored in Application Support. Incoming media has a 100 MB oldest-first quota; outgoing media does not have an equivalent automatic lifetime and remains until cleanup, panic wipe, or app removal. Panic wipe invalidates detached preparation work, cancels active transfers, closes live capture files, and removes the managed media tree before returning.
|
||||
- Voice notes and images are stored in Application Support. Incoming media has a 100 MB oldest-first quota, and all managed media — incoming and outgoing — is additionally bounded by age: a launch-time sweep deletes anything older than seven days. In-flight live captures and files reserved by a delivery or deletion in progress are exempt regardless of age. Panic wipe invalidates detached preparation work, cancels active transfers, closes live capture files, and removes the managed media tree before returning.
|
||||
|
||||
Public archives contain content already intended for public mesh/board distribution, but a seized unlocked device can reveal it. Group metadata and media can reveal relationships or content even when the in-memory chat timeline has gone away.
|
||||
|
||||
@@ -86,6 +87,21 @@ Residual risk: Nostr relay retention and logging are outside project control. Pu
|
||||
|
||||
`bitchatShareExtension/PrivacyInfo.xcprivacy` declares app-group UserDefaults reason `1C8F.1`. Both manifests declare no tracking domains and no data collection by the app developer. They must remain bundled in their respective executable bundles.
|
||||
|
||||
## Locked and Seized Devices
|
||||
|
||||
The realistic compromise for many of the people this app is built for is not interception but a phone taken and, often, unlocked under coercion.
|
||||
|
||||
- Notification content is rendered by the system on the lock screen, so it is readable without unlocking. Message previews are therefore hidden by default: alerts state that a direct message, mention, or location-channel activity arrived, and withhold the message body, the sender's nickname, and the geohash until the app is opened. `userInfo` still carries the routing peer ID and deep link, neither of which the system displays. The preference is `notifications.hideMessagePreviews`; turning it off restores full previews.
|
||||
- The window is covered on `willResignActive`, so the snapshot iOS stores for the app switcher shows a placeholder rather than an open conversation. The cover is opaque rather than blurred, and is added synchronously because the capture follows shortly after that notification. Panic wipe separately deletes snapshots already on disk.
|
||||
- Clearing a mesh timeline erases the on-disk gossip archive behind it, so cleared public history is deleted rather than hidden. The echo watermark still suppresses pre-clear messages this device hears again from peers.
|
||||
- Managed media is bounded by age as well as size, so a received photo does not outlive its conversation indefinitely.
|
||||
|
||||
Not addressed, and deliberately out of scope here:
|
||||
|
||||
- **No duress mechanism.** There is no decoy passphrase, no wipe-on-failed-authentication, and no biometric or passcode lock on the app itself. A coerced unlock discloses everything the device still holds. Adding one is a product decision as much as an engineering one: in some jurisdictions destroying data on demand is itself an offence, so a mode that *hides* may protect someone better than one that *destroys*, and the choice should be made deliberately rather than by default.
|
||||
- **macOS gets no file-protection classes.** Every `FileProtectionType` application is inside `#if os(iOS)`; Data Protection on macOS additionally requires an entitlement. The Mac app also has no app-switcher equivalent.
|
||||
- **Media is not sealed at the app layer.** It relies on the platform default protection class, which is readable once the device has been unlocked since boot. Sealing under a key with the same accessibility would not change that; only a key gated on user authentication would, and that conflicts with receiving media while locked.
|
||||
|
||||
## Panic Wipe Coverage
|
||||
|
||||
The panic action clears identity/session state, preferences, location state, groups, prekeys, outbox mail, courier mail, bridge dedup state, gossip archive, board data, managed media, and active subscriptions/transports. Managed media deletion completes synchronously, after active media work has been invalidated. Keychain secrets use device-only accessibility, and an install marker detects and clears app keys that survive uninstall before a later reinstall can use them. New persistent stores must add an explicit wipe hook and a regression test.
|
||||
@@ -97,3 +113,4 @@ The panic action clears identity/session state, preferences, location state, gro
|
||||
- Verify panic wipe reaches any newly added persistent store.
|
||||
- Treat geohash precision, bridge-cell changes, new relay tags, and announce fields as privacy-surface changes.
|
||||
- Re-run real-device Bluetooth, background/locked-device recovery, location revocation, and audio-route checks; simulators cannot validate the physical side of those behaviors.
|
||||
- Check what a new notification discloses on a locked screen, and that the app-switcher snapshot is covered, whenever notification or scene-lifecycle code changes.
|
||||
|
||||
Reference in New Issue
Block a user