nostr_client 0.2.0
nostr_client: ^0.2.0 copied to clipboard
A nostr client package.
nostr_client 0.2.0 #
A nostr client for dart and flutter.
Features #
- NIP-01: Basic protocol flow description
- NIP-02: Contact List and Petnames
- NIP-03: OpenTimestamps Attestations for Events
- NIP-04: Encrypted Direct Message
- NIP-05: Mapping Nostr keys to DNS-based internet identifiers
- NIP-06: Basic key derivation from mnemonic seed phrase
- NIP-07: window.nostr capability for web browsers
- NIP-08: Handling Mentions
- NIP-09: Event Deletion
- NIP-10: Conventions for clients' use of e and p tags in text events.
- NIP-11: Relay Information Document
- NIP-12: Generic Tag Queries
- NIP-13: Proof of Work
- NIP-14: Subject tag in text events.
- NIP-15: End of Stored Events Notice
- NIP-16: Event Treatment
- NIP-20: Command Results
- NIP-22: Event created_at Limits
- NIP-25: Reactions
- NIP-28: Public Chat
- NIP-35: User Discovery
Getting Started #
Add this package to the pubspec.yaml
of your flutter project:
dependencies:
nostr_client: ^0.2.0
Usage #
import 'package:nostr_client/nostr_client.dart'
// Create a new relay instance and connect to the relay
final relay = Relay('wss://relay.nostr.info');
relay.connect();
// Print events sent by the relay
relay.stream.whereIsEvent().listen(print);
// Request text events from the relay and subscribe to updates
final filter = Filter(
kinds: [EventKind.text],
limit: 10,
);
final subscriptionId = relay.subscribe(filter);
// Cancel the subscription
relay.unsubscribe(subscriptionId);
// Disconnect from the relay
relay.disconnect();