Android jna working
This commit is contained in:
14 files changed
+41
-21
No files matched your search
@@ -63,7 +63,7 @@ kotlin {
|
||||
android()
|
||||
runningOnLinuxx86_64 {
|
||||
jvm()
|
||||
js {
|
||||
js(IR) {
|
||||
browser {
|
||||
webpackTask {
|
||||
|
||||
@@ -188,7 +188,7 @@ kotlin {
|
||||
implementation(kotlin(Deps.Common.test))
|
||||
implementation(Deps.Common.kotlinBigNum)
|
||||
implementation(Deps.Common.serialization)
|
||||
api(Deps.Common.libsodiumBindings)
|
||||
api(project(":multiplatform-crypto-libsodium-bindings"))
|
||||
}
|
||||
}
|
||||
val commonTest by getting {
|
||||
|
||||
@@ -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()}")
|
||||
// }
|
||||
// }
|
||||
}
|
||||
Reference in new issue
Block a user