getPubKey static method

ECPublicKey getPubKey(
  1. String pk
)

Implementation

static ECPublicKey getPubKey(String pk) {
  // BigInt x = BigInt.parse(pk, radix: 16);
  BigInt x =
      BigInt.parse(hex.encode(hex.decode(pk.padLeft(64, '0'))), radix: 16);
  BigInt? y;
  try {
    y = liftX(x);
  } on Error {
    if (kDebugMode) {
      print("error in handle pubKey");
    }
  }
  ECPoint endPoint = secp256k1.curve.createPoint(x, y!);
  return ECPublicKey(endPoint, secp256k1);
}