eosdart_ecc 0.4.4 copy "eosdart_ecc: ^0.4.4" to clipboard
eosdart_ecc: ^0.4.4 copied to clipboard

Elliptic curve cryptography functions in Dart. Private Key, Public Key, Signature, AES, Encryption, Decryption

example/eosdart_ecc_example.dart

import 'package:eosdart_ecc/eosdart_ecc.dart';

main() {
  // Construct the EOS private key from string
  EOSPrivateKey privateKey = EOSPrivateKey.fromString(
      '5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3');

  // Get the related EOS public key
  EOSPublicKey publicKey = privateKey.toEOSPublicKey();
  // Print the EOS public key
  print(publicKey.toString());

  // Going to sign the data
  String data = 'data';

  // Sign
  EOSSignature signature = privateKey.signString(data);
  // Print the EOS signature
  print(signature.toString());

  // Recover the EOSPublicKey used to sign the data
  var recoveredEOSPublicKey = signature.recover(data);
  print(recoveredEOSPublicKey.toString());

  // Verify the data using the signature
  signature.verify(data, publicKey);
}
8
likes
140
points
167
downloads

Publisher

unverified uploader

Weekly Downloads

Elliptic curve cryptography functions in Dart. Private Key, Public Key, Signature, AES, Encryption, Decryption

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

bs58check, crypto, pointycastle

More

Packages that depend on eosdart_ecc