fromBytes static method

Picks the verifier implementation matching algorithm.

Implementation

static BaseSubstrateVerifier fromBytes(
  List<int> keyBytes,
  CryptoKeyType algorithm,
) {
  switch (algorithm) {
    case CryptoKeyType.ed25519:
      return SubstrateED25519Verifier.fromKeyBytes(keyBytes);
    case CryptoKeyType.secp256k1:
      return SubstrateEcdsaVerifier.fromKeyBytes(keyBytes);
    case CryptoKeyType.sr25519:
      return SubstrateSr25519Verifier.fromKeyBytes(keyBytes);
    default:
      throw CoreErrors.invalidOperationArguments(
        "BaseSubstrateVerifier",
        name: "algorithm",
        reason: "Unsupported key algorithm.",
      );
  }
}