mirror of
https://github.com/zapstore/zapstore.git
synced 2026-10-05 20:48:24 +00:00
Allow zapstore pubkeys to delete local storage entries (in the future derived from catalog)
This commit is contained in:
@@ -206,9 +206,23 @@ Future<bool> _checkForUpdatesInBackground(Set<String>? appCatalogRelays) async {
|
|||||||
);
|
);
|
||||||
await secureStorage.setDeletionsSyncedUntil(DateTime.now());
|
await secureStorage.setDeletionsSyncedUntil(DateTime.now());
|
||||||
if (deletionRequests.isNotEmpty) {
|
if (deletionRequests.isNotEmpty) {
|
||||||
|
// Purplebase's NIP-09 processing only deletes events whose pubkey
|
||||||
|
// matches the kind-5 author. Relay-authority deletions (blacklists)
|
||||||
|
// are signed by zapstore/community keys, not the app author, so
|
||||||
|
// those targets survive. Collect them and delete directly by ID.
|
||||||
|
const trustedAuthorities = {kZapstorePubkey, kZapstoreCommunityPubkey};
|
||||||
|
final authorityTargetIds = deletionRequests
|
||||||
|
.where((dr) => trustedAuthorities.contains(dr.event.pubkey))
|
||||||
|
.expand((dr) => dr.deletedEventIds)
|
||||||
|
.toSet();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await (storage as PurplebaseStorageNotifier)
|
final storageNotifier = storage as PurplebaseStorageNotifier;
|
||||||
|
await storageNotifier
|
||||||
.delete(deletionRequests.map((d) => d.id).toSet());
|
.delete(deletionRequests.map((d) => d.id).toSet());
|
||||||
|
if (authorityTargetIds.isNotEmpty) {
|
||||||
|
await storageNotifier.delete(authorityTargetIds);
|
||||||
|
}
|
||||||
} catch (_) {
|
} catch (_) {
|
||||||
// Orphaned kind-5 rows are harmless; referenced events are
|
// Orphaned kind-5 rows are harmless; referenced events are
|
||||||
// already removed by the DB layer during save.
|
// already removed by the DB layer during save.
|
||||||
|
|||||||
Reference in New Issue
Block a user