nip19 0.0.4+3 nip19: ^0.0.4+3 copied to clipboard
This package contains the bech32-encoding for Nostr entities as described in the NIP-19.
Features #
This package contains the bech32-encoding for Nostr entities as described in the NIP-19 so they can be used informatively in Nostr clients, preventing confusion between different types of entities like private keys, public keys, and other Nostr entities.
Usage #
import 'package:nip19/nip19.dart';
final keyPair = KeyPair.generate();
print('nsec: ${keyPair.nsec}');
final keyPairFromNsec = KeyPair.fromNsec(keyPair.nsec);
print('privateKey: ${keyPairFromNsec.privateKey}');
final npubFromPublicKey = KeyPair.npubFromPublicKey(keyPair.publicKey);
print('npub: $npubFromPublicKey');
final npubToPublicKey = KeyPair.npubToPublicKey(npubFromPublicKey);
print('publicKey: $npubToPublicKey');
copied to clipboard
Additional information #
This package is part of the Dartstr monorepo, which contains a set of modular and compatible Dart packages of different Nostr NIPS and utilities. Import just the packages of NIPS you need and keep your project lightweight. See the Dartstr monorepo for all available packages.