Made a .toUInt8Array() function in JsUtil.kt file.

This commit is contained in:
Maria Chernova 2024-12-06 00:31:33 +03:00 committed by kildishevps
parent 4bea64ad21
commit 2fdecba847
2 changed files with 10 additions and 0 deletions

View File

@ -13,6 +13,15 @@ fun UByteArray.toByteArray() : ByteArray {
return toByteArray()
}
fun UByteArray.toUInt8Array() : Uint8Array {
var jsArray = JsArray<JsNumber>()
for (i in this.indices) {
jsArray[i] = this[i].toInt().toJsNumber()
}
var uint8Result = Uint8Array(jsArray)
return uint8Result
}
fun Uint8Array.toUByteArray() : UByteArray {
if (length == null) {

View File

@ -26,6 +26,7 @@ actual object LibsodiumInitializer {
JsSodiumLoader.loadWithCallback {
isPlatformInitialized = true
done()
// TODO: there's no return needed!!!
"null".toJsString()
}
}