public method

PublicKey public()

Retrieve PublicKey of the PrivateKey @returns {PublicKey} PublicKey derived from PrivateKey

Implementation

PublicKey public() {
  CircomLib circomLib = CircomLib();
  String resultString = circomLib.prv2pub(bytesToHex(this.sk));
  final stringList = resultString.split(",");
  stringList[0] = stringList[0].replaceAll("Fr(", "");
  stringList[0] = stringList[0].replaceAll(")", "");
  stringList[1] = stringList[1].replaceAll("Fr(", "");
  stringList[1] = stringList[1].replaceAll(")", "");
  BigInt x = hexToInt(stringList[0]);
  BigInt y = hexToInt(stringList[1]);
  List<BigInt> p = [];
  p.add(x);
  p.add(y);
  return new PublicKey(p);
}