Skip to content

Keystore (SslSocketFactory) #42

@JJSarrasin

Description

@JJSarrasin

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 ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions