unmarshal static method

PublicKey unmarshal(
  1. Uint8List bytes
)

Creates an EcdsaPublicKey from its protobuf bytes

Implementation

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

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