Skip to main content

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

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

example/nostr_bunker_example.dart

import 'package:dostr_bip340/dostr_bip340.dart';
import 'package:dostr_core/dostr_core.dart';
import 'package:nostr_bunker/nostr_bunker.dart';

void main() {
  final relayManager = RelayManager(
    nostrTransportFactory: webSocketTransportFactory(),
  );
  final user = Bip340.generateKeyPair();

  final bunker = Bunker(
    relayReqs: RelayReqs(
      relayManager: relayManager,
      eventVerifier: Bip340EventVerifier(),
    ),
    relayPublishes: RelayPublishes(relayManager: relayManager),
    signerFactory: const Bip340SignerFactory(),
    privateKeys: [user.privateKey],
  );

  bunker.start();

  final bunkerUrl = bunker.getBunkerUrl(
    userPubkey: user.publicKey,
    onConnected: (app) => print("Connected: ${app.appPubkey}"),
  );

  print("Paste this url in a Nostr app: $bunkerUrl");
}
1
likes
160
points
205
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

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

Repository

Topics

#nostr #nip46

License

MIT (license)

Dependencies

dostr_core

More

Packages that depend on nostr_bunker