Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keystore (SslSocketFactory) #42

Open
JJSarrasin opened this issue Jul 18, 2024 · 0 comments
Open

Keystore (SslSocketFactory) #42

JJSarrasin opened this issue Jul 18, 2024 · 0 comments

Comments

@JJSarrasin
Copy link

Hello,
Thanks for your lib.
Is there a way to use a keystore with it. With the non-kmp lib we were using, we had to pass a okHttpClient like this:

    IO.setDefaultOkHttpWebSocketFactory(okHttpClient)
    IO.setDefaultOkHttpCallFactory(okHttpClient)
    val opts = IO.Options()
    opts.callFactory = okHttpClient
    opts.webSocketFactory = okHttpClient

This okHttpClient contains a keystore:

    val isP12 = context.resources.openRawResource(certResId)
    val keystore = KeyStore.getInstance("PKCS12")
    keystore?.load(isP12, "password")
    isP12.close()

    val okHttpClientBuilder = OkHttpClient.Builder()
    okHttpClientBuilder.sslSocketFactory(SslSettings.getSslContext(keystore)!!.socketFactory, SslSettings.getTrustManager())
    val okHttpClient = okHttpClientBuilder.build()

Is there a way to pass a similar configuration in moko-socket-io lib ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant