Android jna working

This commit is contained in:
Ugljesa Jovanovic committed 2021-02-21 11:40:16 +01:00
1 parent 8290586a12
commit 86cdc0da8f
14 files changed
+41 -21

No files matched your search

@@ -7,6 +7,7 @@ package com.ionspin.kotlin.crypto.sample
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.ionspin.kotlin.crypto.hash.Hash
import com.ionspin.kotlin.crypto.jnitest.JniTest
import com.ionspin.kotlin.crypto.util.encodeToUByteArray
import com.ionspin.kotlin.crypto.util.toHexString
import kotlinx.android.synthetic.main.activity_main.*
@@ -18,7 +19,7 @@ class MainActivity : AppCompatActivity() {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val hash = Hash.sha512("123".encodeToUByteArray())
helloWorldTextView.setText("Hash (SHA512) of 123: ${hash.toHexString()}")
helloWorldTextView.setText("Hash (SHA512) of 123: ${hash.toHexString()} \nSodium version: ${JniTest.work()}")
}
@@ -7,11 +7,12 @@ import com.ionspin.kotlin.crypto.util.encodeToUByteArray
import com.ionspin.kotlin.crypto.util.toHexString
import react.dom.render
import kotlinx.browser.document
import kotlin.browser.window
import kotlinx.browser.window
fun main() {
val runningOnNode = jsTypeOf(window) == "undefined"
if (!runningOnNode) = runTest {
// if (!runningOnNode) = runTest {
LibsodiumInitializer.initializeWithCallback {
render(document.getElementById("root")) {
app {
@@ -19,10 +20,10 @@ fun main() {
}
}
}
} else = runTest {
LibsodiumInitializer.initializeWithCallback {
val hash = Hash.sha512("123".encodeToUByteArray())
println("Hash (SHA512) of 123: ${hash.toHexString()}")
}
}
// } else = runTest {
// LibsodiumInitializer.initializeWithCallback {
// val hash = Hash.sha512("123".encodeToUByteArray())
// println("Hash (SHA512) of 123: ${hash.toHexString()}")
// }
// }
}