IPublicKey.fromBytes constructor

IPublicKey.fromBytes(
  1. List<int> keybytes,
  2. EllipticCurveTypes type
)

Factory method for creating an IPublicKey instance from a byte array and an elliptic curve type.

Implementation

factory IPublicKey.fromBytes(List<int> keybytes, EllipticCurveTypes type) {
  switch (type) {
    case EllipticCurveTypes.nist256p1:
      return Nist256p1PublicKey.fromBytes(keybytes);
    case EllipticCurveTypes.sr25519:
      return Sr25519PublicKey.fromBytes(keybytes);
    case EllipticCurveTypes.ed25519:
      return Ed25519PublicKey.fromBytes(keybytes);
    case EllipticCurveTypes.ed25519Kholaw:
      return Ed25519KholawPublicKey.fromBytes(keybytes);
    case EllipticCurveTypes.ed25519Monero:
      return MoneroPublicKey.fromBytes(keybytes);
    case EllipticCurveTypes.ed25519Blake2b:
      return Ed25519Blake2bPublicKey.fromBytes(keybytes);
    default:
      return Secp256k1PublicKeyEcdsa.fromBytes(keybytes);
  }
}