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

Curve25519 Library for cryptographic signing and verifying. Supports VRF signatures and agreements.

example/lib/curve25519_vrf_example.dart

import 'dart:typed_data';

import 'package:curve25519_vrf/curve25519_vrf.dart';

void main() {
  var message =
      Uint8List.fromList('This is a very important message!'.codeUnits);
  var keyPair = Curve25519().newKeyPair();
  var signature = Curve25519().sign(keyPair, message, SignatureType.STANDARD);

  if (signature.isValid(message)) {
    print('Signature is valid!');
  }

  var signatureVRF = Curve25519().sign(keyPair, message, SignatureType.VRF);

  if (signatureVRF.isValid(message) is List) {
    print('VRF Signature is valid!');
  }

  var bobKeyPair = Curve25519().newKeyPair();
  var aliceKeyPair = Curve25519().newKeyPair();

  var agreement =
      Curve25519().calculateAgreement(bobKeyPair, aliceKeyPair.publicKey);
  print("This is Bob's and Alice's agreement: " + agreement.toString());
}
3
likes
90
pub points
0%
popularity

Publisher

unverified uploader

Curve25519 Library for cryptographic signing and verifying. Supports VRF signatures and agreements.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-2-Clause (LICENSE)

Dependencies

collection, pointycastle

More

Packages that depend on curve25519_vrf