Skip to main content

dostr_nip44 0.1.0 copy "dostr_nip44: ^0.1.0" to clipboard
dostr_nip44: ^0.1.0 copied to clipboard

Pure Dart NIP-44 encryption for Nostr, with the deprecated NIP-04 encryption next to it.

example/dostr_nip44_example.dart

import 'package:dostr_nip44/dostr_nip44.dart';

void main() {
  const alicePrivateKey =
      '0000000000000000000000000000000000000000000000000000000000000001';
  const alicePublicKey =
      '79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798';
  const bobPrivateKey =
      '0000000000000000000000000000000000000000000000000000000000000002';
  const bobPublicKey =
      'c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5';

  final payload = Nip44.encryptMessage(
    'hello bob',
    senderPrivateKey: alicePrivateKey,
    recipientPublicKey: bobPublicKey,
  );

  final plaintext = Nip44.decryptMessage(
    payload,
    recipientPrivateKey: bobPrivateKey,
    senderPublicKey: alicePublicKey,
  );
  print(plaintext);
}
0
likes
160
points
--
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Pure Dart NIP-44 encryption for Nostr, with the deprecated NIP-04 encryption next to it.

Repository (GitHub)
View/report issues

Topics

#nostr #dostr #encryption #nip44 #nip04

License

MIT (license)

Dependencies

convert, crypto, dostr_secp256k1, pointycastle

More

Packages that depend on dostr_nip44