getFactoidSecretFromPrivKey function
Implementation
String getFactoidSecretFromPrivKey(Uint8List pk) {
if (pk.length != 64) {
print("invalid private key must be 64 bytes long");
return "";
}
Uint8List faPrefix = [0x64, 0x78].asUint8List();
Uint8List hash = Uint8List(34);
hash.setAll(0, faPrefix);
hash.setAll(2, pk.sublist(0, 32));
var checksumPre = sha256.convert(hash);
var checksum = sha256.convert(checksumPre.bytes.asUint8List()).bytes.asUint8List();
Uint8List fsraw = Uint8List(38);
fsraw.setAll(0, hash);
fsraw.setAll(34, checksum.sublist(0,4));
String fs = base58.encode(fsraw);
return fs;
}