Closed Katletos closed 3 months ago
As far i am aware there is no mechanism provided for this by the libraries i am using (mainly WebSocketChannel). But if this is for local development only you could try to provide a override for bad certificates like this:
class MyHttpOverrides extends HttpOverrides {
@override
HttpClient createHttpClient(SecurityContext? context) {
return super.createHttpClient(context)
..badCertificateCallback =
(X509Certificate cert, String host, int port) => true; // add your localhost detection logic here if you want
}
}
void main() {
HttpOverrides.global = MyHttpOverrides();
runApp(MaterialApp(home: MyApp()));
}
Also see here: https://github.com/dart-lang/sdk/issues/34284
I will close this issue due to inactivity. If you still need assistance feel free to reopen.
Is it possible to use library with self signed? Or how I can pass a certificate in StompClient like http client
flutter: HandshakeException: Handshake error in client (OS Error: CERTIFICATE_VERIFY_FAILED: self signed certificate(handshake.cc:393))