validatePubKey static method

void validatePubKey(
  1. List<int> pubKeyBytes,
  2. CryptoKeyType curveType
)

Validate that bytes form a valid public key for the given curve.

Implementation

static void validatePubKey(List<int> pubKeyBytes, CryptoKeyType curveType) {
  try {
    IPublicKey.fromBytes(pubKeyBytes, curveType);
  } catch (_) {
    throw CoreErrors.addressKeyValidationFailed(
      reason: "Invalid ${curveType.name} public key.",
    );
  }
}