JetBrains / kotlin-wrappers

Kotlin wrappers for popular JavaScript libraries
Apache License 2.0
1.33k stars 165 forks source link

IR Link problem in pre.675 and pre.676 #2193

Closed robertfmurdock closed 5 months ago

robertfmurdock commented 6 months ago

"IrLinkageError: Function 'createHmac' can not be called: Function uses class 'Duplex' (via class 'Hmac') that simultaneously inherits from 2 classes: 'Readable', 'Writable'"

This error occurs at runtime when calling the "node.crypto.createHmac" function. Works fine in pre.674.

turansky commented 6 months ago

@robertfmurdock Do you use Hmac as Readable or as Writable after that? What is your use case?

robertfmurdock commented 6 months ago

Hm, I guess I'm not sure.

calling function:


    private fun String.hmac256Hash() = createHmac("sha256", signingSecret)
        .update(this)
        .digest()
        .toString(BufferEncoding.hex)
robertfmurdock commented 5 months ago

AFAICT just importing the Hmac type is enough to trigger the error.

turansky commented 5 months ago

@Leonya Could you please release these changes?

turansky commented 5 months ago

@robertfmurdock Solution was released in pre.683. Does it work for you?

robertfmurdock commented 5 months ago

Just checked - looks good to me! Thanks ya'll.