Ed25519PublicKey.fromBytes constructor
Wraps the 32 raw key bytes.
Throws ProtocolException if bytes is not exactly 32 bytes long.
Implementation
factory Ed25519PublicKey.fromBytes(List<int> bytes) {
if (bytes.length != 32) {
throw ProtocolException(
'Ed25519 public key must be 32 bytes, got ${bytes.length}',
);
}
final copy = Uint8List.fromList(bytes);
return Ed25519PublicKey._(
copy,
convert.base64.encode(copy).replaceAll('=', ''),
);
}