Ed25519PublicKey.fromRawBytes constructor

Ed25519PublicKey.fromRawBytes(
  1. Uint8List bytes
)

Creates an Ed25519PublicKey from raw bytes

Implementation

factory Ed25519PublicKey.fromRawBytes(Uint8List bytes) {
  if (bytes.length != 32) {
    throw FormatException('Ed25519 public key must be 32 bytes');
  }

  final publicKey = crypto.SimplePublicKey(
    bytes,
    type: crypto.KeyPairType.ed25519,
  );

  return Ed25519PublicKey(publicKey);
}