nostr_nips 0.2.0 copy "nostr_nips: ^0.2.0" to clipboard
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 hierarchyNostrException base class with specialized subclasses: RelayConnectionException, CryptographicException, EncryptionException, DecryptionException, ValidationException, InvalidKeyException, InvalidEventException, NetworkException, NostrParseException. All support optional cause chaining.
  • Timeout handling — Added configurable timeout parameter to Relay.connect(), RelayInformation.fetch(), Nip05.verify(), Nip57.fetchLnurlPayEndpoint(), RelayManagement, and Nip96Client.
  • ReconnectingRelay — Opt-in relay wrapper with automatic reconnection using exponential backoff with jitter, subscription replay after reconnection, configurable maxRetries, and onReconnect/onReconnectFailed streams.
  • ConnectAllResultRelayPool.connectAll() now returns a ConnectAllResult with connected and failed lists 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 _normalizeNFKC which was a no-op (returned input unchanged). Now uses unorm_dart for correct Unicode NFKC normalization of passwords before scrypt key derivation.
  • Narrowed error handling — Replaced broad catch (_) with specific on FormatException / on TypeError / on Exception across 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 getdart formatdart analyzedart test).
  • Dependabot configuration for weekly pub and github-actions dependency 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.
0
likes
140
points
11
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A comprehensive Dart library implementing all Nostr protocol NIPs (Nostr Implementation Possibilities).

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

bip340, bip39, convert, crypto, http, pointycastle, unorm_dart, web_socket_channel

More

Packages that depend on nostr_nips