Adding custom code blocks

This commit is contained in:
Ugljesa Jovanovic committed 2020-08-14 14:25:26 +02:00
1 parent a5b20daf5a
commit efe9661c30
11 files changed
+87 -27

No files matched your search

@@ -6,6 +6,7 @@ import ext.libsodium.com.ionspin.kotlin.crypto.toUInt8Array
import kotlin.Any
import kotlin.Int
import kotlin.UByteArray
import org.khronos.webgl.Uint8Array
actual typealias Sha256State = Any
@@ -59,6 +60,10 @@ actual class Crypto internal actual constructor() {
actual fun crypto_secretstream_xchacha20poly1305_init_push(key: UByteArray): dynamic {
println("Debug crypto_secretstream_xchacha20poly1305_init_push")
val stateAndHeader =
getSodium().crypto_secretstream_xchacha20poly1305_init_push(key.toUInt8Array())
val state = stateAndHeader.state
val header = (stateAndHeader.header as Uint8Array).toUByteArray()
return SecretStreamStateAndHeader(state, header)
}
}