nip26 2.0.1 copy "nip26: ^2.0.1" to clipboard
nip26: ^2.0.1 copied to clipboard

A Dart library for Nostr NIP-26 Delegated Event Signing.

example/nip26_example.dart

import 'package:nip01/nip01.dart';
import 'package:nip26/nip26.dart';

void main() {
  final delegatorRootKeyPair = KeyPair.generate();
  final delegator = Delegator(delegatorRootKeyPair);

  final delegateeKeyPair = KeyPair.generate();

  final token = delegator.createDelegationToken(
    delegateePubkey: delegateeKeyPair.publicKey,
    conditionsQuery: ConditionsQuery(
      kinds: [EventKind.textNote.value],
      createdAfter: DateTime.now().millisecondsSinceEpoch ~/ 1000,
    ),
  );

  final delegatee = Delegatee(
    delegateeKeyPair,
    delegatorPubkey: delegatorRootKeyPair.publicKey,
    conditions: ConditionsQuery(
      kinds: [EventKind.textNote.value],
      createdAfter: DateTime.now().millisecondsSinceEpoch ~/ 1000,
    ),
    token: token,
  );

  final event = delegatee.constructSignedEvent(
    createdAt: DateTime.now().millisecondsSinceEpoch ~/ 1000,
    kind: EventKind.textNote.value,
    content: 'Hello, World in name of delegator!',
  );

  print('Delegated event: $event');
}
0
likes
150
points
2
downloads

Publisher

verified publisherkumuly.dev

Weekly Downloads

A Dart library for Nostr NIP-26 Delegated Event Signing.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

bip340, convert, crypto, equatable, nip01

More

Packages that depend on nip26