nip19 0.0.2 copy "nip19: ^0.0.2" to clipboard
nip19: ^0.0.2 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.

Getting started #

Installation #

In your pubspec.yaml file add:

dependencies:
  nip19: ^0.0.2

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');

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.

0
likes
160
pub points
16%
popularity

Publisher

verified publisherkumuly.dev

This package contains the bech32-encoding for Nostr entities as described in the NIP-19.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

bech32, convert, nip01

More

Packages that depend on nip19