nostr_nips 0.2.0
nostr_nips: ^0.2.0 copied to clipboard
A comprehensive Dart library implementing all Nostr protocol NIPs (Nostr Implementation Possibilities).
0.2.0 #
Features #
- Custom exception hierarchy —
NostrExceptionbase class with specialized subclasses:RelayConnectionException,CryptographicException,EncryptionException,DecryptionException,ValidationException,InvalidKeyException,InvalidEventException,NetworkException,NostrParseException. All support optionalcausechaining. - Timeout handling — Added configurable
timeoutparameter toRelay.connect(),RelayInformation.fetch(),Nip05.verify(),Nip57.fetchLnurlPayEndpoint(),RelayManagement, andNip96Client. - ReconnectingRelay — Opt-in relay wrapper with automatic reconnection using
exponential backoff with jitter, subscription replay after reconnection,
configurable
maxRetries, andonReconnect/onReconnectFailedstreams. - ConnectAllResult —
RelayPool.connectAll()now returns aConnectAllResultwithconnectedandfailedlists for partial failure reporting. - Relay.onDisconnected — New stream that fires when the WebSocket connection closes (server- or client-initiated).
- Relay.channelFactory — Constructor parameter for injecting custom WebSocket channel implementations (useful for testing).
Bug Fixes #
- NIP-49 NFKC normalization — Fixed
_normalizeNFKCwhich was a no-op (returned input unchanged). Now usesunorm_dartfor correct Unicode NFKC normalization of passwords before scrypt key derivation. - Narrowed error handling — Replaced broad
catch (_)with specificon FormatException/on TypeError/on Exceptionacross 11 NIP files (nip05, nip15, nip18, nip24, nip27, nip28, nip46, nip47, nip57, nip98).
Testing #
- Added relay integration tests (34 tests) covering connection lifecycle, message routing, sending, and subscription IDs via mock WebSocket channels.
- Added ReconnectingRelay tests (14 tests) covering reconnection, subscription replay, maxRetries, and disconnect cancellation.
- Added exception hierarchy tests (16 tests).
- Added NIP-49 NFKC Unicode round-trip tests.
- Total test count: 231 → 297.
Infrastructure #
- GitHub Actions CI pipeline (
dart pub get→dart format→dart analyze→dart test). - Dependabot configuration for weekly
pubandgithub-actionsdependency updates.
Dependencies #
- Added
unorm_dart: ^0.3.0(NIP-49 NFKC normalization). - Added
stream_channel: ^2.1.0(dev, relay test mocks).
0.1.0 #
- Initial release implementing 75+ Nostr NIPs.