nostr_bunker 1.0.0 copy "nostr_bunker: ^1.0.0" to clipboard
nostr_bunker: ^1.0.0 copied to clipboard

With this package your app can act as a bunker and will be able to sign events from others Nostr apps.

example/nostr_bunker_example.dart

import 'package:ndk/ndk.dart';
import 'package:ndk/shared/nips/nip01/bip340.dart';
import 'package:nostr_bunker/nostr_bunker.dart';

void main() async {
  final ndkBunker = Ndk.defaultConfig();

  final userKeyPair = Bip340.generatePrivateKey();
  ndkBunker.accounts.loginPrivateKey(
    pubkey: userKeyPair.publicKey,
    privkey: userKeyPair.privateKey!,
  );

  final bunker = Bunker(ndk: ndkBunker);

  bunker.start();

  final bunkerUrl = bunker.getBunkerUrl(signerPubkey: userKeyPair.publicKey);

  final ndkClient = Ndk.defaultConfig();

  final connection = await ndkClient.bunkers.connectWithBunkerUrl(bunkerUrl);

  print("Connected: ${connection != null}");
}
1
likes
0
points
246
downloads

Publisher

unverified uploader

Weekly Downloads

With this package your app can act as a bunker and will be able to sign events from others Nostr apps.

Repository

License

unknown (license)

Dependencies

ndk

More

Packages that depend on nostr_bunker