Hi, I'm trying to generate a JWT token in kotlin m...
# multiplatform
a
Hi, I'm trying to generate a JWT token in kotlin multiplaform
shared
module. Any luck how can it be generated, unable to find a good fit library for that. Tried with platform specific way by using
JJWT
for android and
JOSESwift
in iOS But not sure how to call Swift function in Kotlin code.
f
Random hacky solution, you can set a callback from swift to kotlin and kotlin can invoke that. I did this for some firebase logging, you can probably return a type from logEvent here too....
Copy code
interface FirebaseIosCallback {
    fun logEvent(eventId: String, params: String)
}

private var firebaseIosCallback: FirebaseIosCallback? = null

// Callback from swift that allows settings of firebase callback
@Suppress("unused")
fun firebaseCallback(callback: FirebaseIosCallback) {
    firebaseIosCallback = callback
}
a
Thanks @Fergus Hewson Keeping this as last hope. Looking for a KMP specific solution, don't want android / iOS devs to perform any task related to this.