cryptography-kotlin icon indicating copy to clipboard operation
cryptography-kotlin copied to clipboard

CryptographyRandom::nextInt is failed on wasmJs target

Open vdshb opened this issue 1 year ago • 1 comments

Simple reproducer is failed on wasmJs (both nodejs and browser) target (works fine on all other targets):

@Test
fun test() {
    val k = CryptographyRandom.nextInt(10)
}

Exception:

IrLinkageError: Can not read value from variable 'jsArray': Variable uses unlinked class symbol 'org.khronos.webgl/Int8Array|null[0]'

kotlin 2.1.0

I'm not sure if it's compiler or library issue.

vdshb avatar Jan 07 '25 08:01 vdshb

Hey! That's because those declaration are now coming from kotlinx-browser for wasmJs (changelog for Kotlin 2.1.0). You can try to add this dependency in your project. I will fix it in an upcoming patch release

whyoleg avatar Jan 19 '25 20:01 whyoleg