NdkConfig class

Configuration class for the Nostr Development Kit (NDK)

This class holds various settings and dependencies required for the NDK to function properly

Constructors

NdkConfig({required EventVerifier eventVerifier, required CacheManager cache, LocalEventSignerFactory eventSignerFactory = const Bip340EventSignerFactory(), WalletsRepo? walletsRepo, NdkEngine engine = NdkEngine.RELAY_SETS, List<String> ignoreRelays = const [], List<String> bootstrapRelays = DEFAULT_BOOTSTRAP_RELAYS, List<EventFilter> eventOutFilters = const [], Duration defaultQueryTimeout = RequestDefaults.DEFAULT_QUERY_TIMEOUT, Duration defaultBroadcastTimeout = BroadcastDefaults.TIMEOUT, double defaultBroadcastConsiderDonePercent = BroadcastDefaults.CONSIDER_DONE_PERCENT, bool defaultBroadcastSaveToCache = BroadcastDefaults.SAVE_TO_CACHE, LogLevel logLevel = defaultLogLevel, String userAgent = RequestDefaults.DEFAULT_USER_AGENT, bool webSocketCompression = true, CashuUserSeedphrase? cashuUserSeedphrase, bool autoVerifyMintCounters = false, bool fetchedRangesEnabled = false, bool eagerAuth = false, Duration authCallbackTimeout = RequestDefaults.DEFAULT_AUTH_CALLBACK_TIMEOUT, Duration pendingDeliveryRetryInterval = const Duration(seconds: 15), bool pendingDeliveryRetriesEnabled = true, List<Nip85TrustedProvider> defaultTrustedProviders = DEFAULT_NIP85_PROVIDERS, bool cacheEvictionEnabled = false, EvictionPolicy cacheEvictionPolicy = const EvictionPolicy(), Duration cacheEvictionStartupDelay = const Duration(minutes: 1), Duration cacheEvictionInterval = const Duration(hours: 1), bool runCacheEvictionOnStartup = true})
Creates a new instance of NdkConfig.

Properties

authCallbackTimeout ↔ Duration
Timeout for AUTH callbacks (how long to wait for AUTH OK response). Defaults to 30 seconds.
getter/setter pair
autoVerifyMintCounters ↔ bool
when false (default), automatic cashu quote completion on startup requires an explicit Cashu.restore() call for the mint/unit first; when true, it instead runs a bounded NUT-09 scan itself to verify the mint derivation counter before minting. See Cashu.retrieveFunds.
getter/setter pair
bootstrapRelays ↔ List<String>
A list of initial relay URLs to use for bootstrapping the network. These connect on start.
getter/setter pair
cache ↔ CacheManager
The cache manager (DB) used to store and retrieve Nostr data. E.g MemCacheManager()
getter/setter pair
cacheEvictionEnabled ↔ bool
Whether background cache eviction scheduling is enabled.
getter/setter pair
cacheEvictionInterval ↔ Duration
Interval between background cache eviction runs.
getter/setter pair
cacheEvictionPolicy ↔ EvictionPolicy
Cache eviction policy used by the background scheduler.
getter/setter pair
cacheEvictionStartupDelay ↔ Duration
Delay before the first scheduled cache eviction run after startup.
getter/setter pair
cashuUserSeedphrase → CashuUserSeedphrase?
cashu user seed phrase, required for using cashu features
you can use CashuSeed.generateSeedPhrase() to generate a new seed phrase
Store this securely! Seed phrase allow full access to cashu funds!
final
defaultBroadcastConsiderDonePercent ↔ double
percentage of relays that need to respond with "OK" for the broadcast to be considered done
value between 0.0 and 1.0
getter/setter pair
defaultBroadcastSaveToCache ↔ bool
whether to save broadcasted events to cache by default
getter/setter pair
defaultBroadcastTimeout ↔ Duration
timeout for broadcasts
getter/setter pair
defaultQueryTimeout ↔ Duration
default timeout for queries
this value is used if no individual timeout is set for a query
getter/setter pair
defaultTrustedProviders ↔ List<Nip85TrustedProvider>
Default trusted providers for NIP-85 trusted assertions.
getter/setter pair
eagerAuth ↔ bool
Has no effect. A connection now carries at most one identity, chosen when it is opened: an anonymous connection never answers a challenge and a bound one always does, so there is nothing left to choose.
getter/setter pair
engine ↔ NdkEngine
The engine mode to use for Nostr network operations (inbox/outbox mode).
getter/setter pair
eventOutFilters ↔ List<EventFilter>
filters that are applied to the output stream
getter/setter pair
eventSignerFactory ↔ LocalEventSignerFactory
Factory for creating EventSigner instances. Defaults to Bip340EventSigner.
getter/setter pair
eventVerifier ↔ EventVerifier
The verifier used to validate Nostr events. E.g. RustEventVerifier(), Bip340EventVerifier
getter/setter pair
fetchedRangesEnabled ↔ bool
Enable fetched ranges tracking. When enabled, NDK tracks which time ranges have been fetched from which relays. Disabled by default for performance.
getter/setter pair
hashCode → int
The hash code for this object.
no setterinherited
ignoreRelays ↔ List<String>
A list of relay URLs to ignore for inbox/outbox operations.
getter/setter pair
logLevel ↔ LogLevel
log level
getter/setter pair
pendingDeliveryRetriesEnabled ↔ bool
Whether persisted broadcast deliveries are retried automatically in the background.
getter/setter pair
pendingDeliveryRetryInterval ↔ Duration
Interval for retrying pending broadcast deliveries while relays remain connected.
getter/setter pair
runCacheEvictionOnStartup ↔ bool
Whether to run cache eviction once on startup before periodic runs.
getter/setter pair
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
userAgent ↔ String
User agent string for Http requests and websockets.
getter/setter pair
walletsRepo ↔ WalletsRepo?
The wallets repository used to manage wallet data. E.g MemWalletsRepo()
getter/setter pair
webSocketCompression ↔ bool
Whether native WebSocket connections negotiate per-message compression.
getter/setter pair

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited