isValidBytes static method

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

Static method to check the validity of key bytes for a specific elliptic curve type.

Implementation

static bool isValidBytes(List<int> keyBytes, EllipticCurveTypes type) {
  switch (type) {
    case EllipticCurveTypes.nist256p1:
      return Nist256p1PrivateKey.isValidBytes(keyBytes);
    case EllipticCurveTypes.ed25519:
      return Ed25519PrivateKey.isValidBytes(keyBytes);
    case EllipticCurveTypes.ed25519Kholaw:
      return Ed25519KholawPrivateKey.isValidBytes(keyBytes);
    case EllipticCurveTypes.ed25519Blake2b:
      return Ed25519Blake2bPrivateKey.isValidBytes(keyBytes);
    case EllipticCurveTypes.ed25519Monero:
      return MoneroPrivateKey.isValidBytes(keyBytes);
    case EllipticCurveTypes.sr25519:
      return Sr25519PrivateKey.isValidBytes(keyBytes);
    default:
      return Secp256k1PrivateKeyEcdsa.isValidBytes(keyBytes);
  }
}