encode static method

String encode(
  1. List<int> privKey, {
  2. List<int> netVer = const [],
  3. CryptoKeyEncoding pubKeyMode = CryptoKeyEncoding.base,
})

Encodes a private key into a WIF string.

The privKey is the private key to be encoded, and netVer is an optional list of network version bytes. By default, it's an empty list.

The pubKeyMode determines the mode of the associated public key, where

Returns the WIF-encoded private key as a string.

Implementation

static String encode(
  List<int> privKey, {
  List<int> netVer = const [],
  CryptoKeyEncoding pubKeyMode = CryptoKeyEncoding.base,
}) {
  final key = Secp256k1PrivateKey.fromBytes(privKey);

  try {
    return encodeKey(key, netVer: netVer, pubKeyMode: pubKeyMode);
  } finally {
    key.dispose();
  }
}