Skip to main content

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

Pure Dart secp256k1 for Nostr and Cashu, the curve arithmetic and BIP-340 Schnorr signatures under dostr_bip340, dostr_nip44 and dostr_cashu_protocol.

example/dostr_secp256k1_example.dart

import 'package:dostr_secp256k1/dostr_secp256k1.dart';

void main() {
  final alice = BigInt.one;
  final bob = BigInt.two;

  final alicePublicKey = (Secp256k1Point.generator * alice).x;
  final bobPublicKey = (Secp256k1Point.generator * bob).x;
  print('alice: ${alicePublicKey.toRadixString(16).padLeft(64, '0')}');
  print('bob: ${bobPublicKey.toRadixString(16).padLeft(64, '0')}');

  final fromAlice = (Secp256k1Point.fromX(bobPublicKey)! * alice).x;
  final fromBob = (Secp256k1Point.fromX(alicePublicKey)! * bob).x;
  print('same shared secret: ${fromAlice == fromBob}');
}
0
likes
160
points
--
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Pure Dart secp256k1 for Nostr and Cashu, the curve arithmetic and BIP-340 Schnorr signatures under dostr_bip340, dostr_nip44 and dostr_cashu_protocol.

Repository (GitHub)
View/report issues

Topics

#nostr #dostr #secp256k1 #cryptography

License

MIT (license)

Dependencies

crypto

More

Packages that depend on dostr_secp256k1