unmarshal static method

PublicKey unmarshal(
  1. Uint8List bytes
)

Creates an Ed25519PublicKey from its protobuf bytes

Implementation

static PublicKey unmarshal(Uint8List bytes) {
  final pbKey = pb.PublicKey.fromBuffer(bytes);

  if (pbKey.type != pb.KeyType.Ed25519) {
    throw FormatException('Not an Ed25519 public key');
  }
  return Ed25519PublicKey.fromRawBytes(Uint8List.fromList(pbKey.data));
}