lyraDecToBytes static method

Uint8List lyraDecToBytes(
  1. String input
)

decode private key to byte array of ECDSA private key

Implementation

static Uint8List lyraDecToBytes(String input) {
  var buff = Base58Decode(input);
  var data = buff.sublist(0, buff.length - 4);
  var crc = checksum(data);
  Function eq = const ListEquality().equals;
  //print("buff len: " + buff.length.toString());
  //print("crc len: " + crc.length.toString());
  //print(buff.sublist(buff.length - 4, buff.length).toString());
  //print(crc.toList());
  if (eq(buff.sublist(buff.length - 4, buff.length), crc)) {
    //print("yes, equal");
    return Uint8List.fromList(data);
  } else {
    //print("no, not equal");
    throw ('Not valid lyra encode string');
  }
}