unmarshalRsaPublicKey function

PublicKey unmarshalRsaPublicKey(
  1. Uint8List bytes
)

Creates an RsaPublicKey from its protobuf bytes

Implementation

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

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