isValidBytes static method

bool isValidBytes(
  1. List<int> keyBytes,
  2. EllipticCurveTypes type
)

Static method to check the validity of a byte array as a public key for a specific elliptic curve type.

Implementation

static bool isValidBytes(List<int> keyBytes, EllipticCurveTypes type) {
  switch (type) {
    case EllipticCurveTypes.nist256p1:
      return Nist256p1PublicKey.isValidBytes(keyBytes);
    case EllipticCurveTypes.sr25519:
      return Sr25519PublicKey.isValidBytes(keyBytes);
    case EllipticCurveTypes.ed25519:
      return Ed25519PublicKey.isValidBytes(keyBytes);
    case EllipticCurveTypes.ed25519Kholaw:
      return Ed25519KholawPublicKey.isValidBytes(keyBytes);
    case EllipticCurveTypes.ed25519Monero:
      return MoneroPublicKey.isValidBytes(keyBytes);
    case EllipticCurveTypes.ed25519Blake2b:
      return Ed25519Blake2bPublicKey.isValidBytes(keyBytes);
    default:
      return Secp256k1PublicKeyEcdsa.isValidBytes(keyBytes);
  }
}