web3dart/src/crypto/secp256k1 library

Classes

MsgSignature
Signatures used to sign Ethereum transactions and messages.

Properties

params → ECDomainParameters
final

Functions

compressPublicKey(Uint8List compressedPubKey) Uint8List
Given a byte array computes its compressed version and returns it as a byte array, including the leading 02 or 03
decompressPublicKey(Uint8List compressedPubKey) Uint8List
Given a byte array computes its expanded version and returns it as a byte array, including the leading 04
ecRecover(Uint8List messageHash, MsgSignature signatureData) Uint8List
Given an arbitrary message hash and an Ethereum message signature encoded in bytes, returns the public key that was used to sign it. https://github.com/web3j/web3j/blob/c0b7b9c2769a466215d416696021aa75127c2ff1/crypto/src/main/java/org/web3j/crypto/Sign.java#L241
generateNewPrivateKey(Random random) BigInt
Generates a new private key using the random instance provided. Please make sure you're using a cryptographically secure generator.
isValidSignature(Uint8List messageHash, MsgSignature signatureData, Uint8List publicKey) bool
Given an arbitrary message hash, an Ethereum message signature encoded in bytes and a public key encoded in bytes, confirms whether that public key was used to sign the message or not.
privateKeyBytesToPublic(Uint8List privateKey) Uint8List
Generates a public key for the given private key using the ecdsa curve which Ethereum uses.
privateKeyToPublic(BigInt privateKey) Uint8List
Generates a public key for the given private key using the ecdsa curve which Ethereum uses.
publicKeyToAddress(Uint8List publicKey) Uint8List
Constructs the Ethereum address associated with the given public key by taking the lower 160 bits of the key's sha3 hash.
sign(Uint8List messageHash, Uint8List privateKey) MsgSignature
Signs the hashed data in messageHash using the given private key.