fromBytes static method

Picks the signer implementation matching algorithm.

Implementation

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