mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-08-08 06:56:10 +00:00
ensure valid creator and key presence when loading groups from disk
This commit is contained in:
parent
fab2abe5d2
commit
81e8c0a23d
@ -190,8 +190,11 @@ final class GroupStore: ObservableObject {
|
||||
let stored = try? JSONDecoder().decode([BitchatGroup].self, from: data) else {
|
||||
return
|
||||
}
|
||||
// Only groups whose key survived in the keychain are usable.
|
||||
groups = stored.filter { key(forGroupID: $0.groupID) != nil }
|
||||
// Only groups whose key survived in the keychain are usable. Disk bypasses
|
||||
// `upsert`, so re-check the creator invariant to avoid unmatchable creators.
|
||||
groups = stored.filter {
|
||||
!$0.creatorFingerprint.isEmpty && $0.creator != nil && key(forGroupID: $0.groupID) != nil
|
||||
}
|
||||
}
|
||||
|
||||
private static func defaultFileURL() -> URL? {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user