Refactor Nostr ID Bridge & Keychain Helper (#796)

* Extract each type to a separate file

* Nostr ID Bridge: Convert static func/vars to instance

* `KeychainHelper` behind a protocol to easily mock

* Update tests with ID Bridge and MockKeychainHelper

---------

Co-authored-by: jack <212554440+jackjackbits@users.noreply.github.com>
This commit is contained in:
Islam
2025-10-14 12:26:18 +02:00
committed by GitHub
co-authored by jack
parent e3149fa098
commit ad4103bacc
18 changed files with 442 additions and 370 deletions
+3 -1
View File
@@ -14,6 +14,8 @@ struct LocationNotesDependencies {
var sendEvent: SendEvent
var deriveIdentity: (_ geohash: String) throws -> NostrIdentity
var now: () -> Date
private static let idBridge = NostrIdentityBridge()
static let live = LocationNotesDependencies(
relayLookup: { geohash, count in
@@ -35,7 +37,7 @@ struct LocationNotesDependencies {
NostrRelayManager.shared.sendEvent(event, to: relays)
},
deriveIdentity: { geohash in
try NostrIdentityBridge.deriveIdentity(forGeohash: geohash)
try idBridge.deriveIdentity(forGeohash: geohash)
},
now: { Date() }
)