checkIsConnectionSecure method
Future<void>
checkIsConnectionSecure({
- required String serverUrl,
- required SHA sha,
- int timeout = 60,
- required List<
String> allowedSHAFingerprints,
override
Implementation
@override
Future<void> checkIsConnectionSecure({
required String serverUrl,
required SHA sha,
int timeout = 60,
required List<String> allowedSHAFingerprints,
}) async {
try {
final connection = await HttpCertificatePinning.check(
serverURL: serverUrl,
sha: sha,
allowedSHAFingerprints: allowedSHAFingerprints,
timeout: timeout,
);
if (!connection.contains('CONNECTION_SECURE')) {
throw FeatureNetworkException(
code: 'CONNECTION_NOT_SECURE',
message: 'Connection not secure: $connection',
);
}
} on PlatformException catch (e) {
throw FeatureNetworkException(
code: 'BAD_CERTIFICATE',
message: 'Bad Certificate: $e',
);
}
}