getTransportCredentials method
Future<ChannelCredentials>
getTransportCredentials(
)
override
Implementation
@override
Future<ChannelCredentials> getTransportCredentials() async {
RawSecureSocket socket =
await RawSecureSocket.connect(_apiUrl.host, _apiUrl.port);
if (socket.peerCertificate == null) {
throw Exception("peer certificate is null. Contact info@nuntio.io");
}
X509Certificate x509certificate = socket.peerCertificate!;
return ChannelCredentials.secure(
certificates: utf8.encode(x509certificate.pem),
onBadCertificate: onBadCertificate,
authority: _apiUrl.host,
);
}