generatePrivateKeyEc static method

String generatePrivateKeyEc(
  1. String passphrase, {
  2. PubKeyModes pubKeyMode = PubKeyModes.compressed,
  3. int? lotNum,
  4. int? sequenceNum,
})

Generate a BIP38-encrypted private key with ECDSA.

This method generates a BIP38-encrypted private key using ECDSA encryption. It takes a passphrase, an optional public key mode, and optional lot number and sequence number as inputs. It returns the BIP38-encrypted private key as a string.

  • passphrase: The passphrase for encryption.
  • pubKeyMode: The selected public key mode (compressed or uncompressed). Defaults to PubKeyModes.compressed.
  • lotNum: An optional lot number.
  • sequenceNum: An optional sequence number.
  • Returns: The BIP38-encrypted private key as a string.

Implementation

static String generatePrivateKeyEc(String passphrase,
    {PubKeyModes pubKeyMode = PubKeyModes.compressed,
    int? lotNum,
    int? sequenceNum}) {
  final intPass = Bip38EcKeysGenerator.generateIntermediatePassphrase(
      passphrase,
      lotNum: lotNum,
      sequenceNum: sequenceNum);

  return Bip38EcKeysGenerator.generatePrivateKey(intPass, pubKeyMode);
}