Remove coroutines
This commit is contained in:
1 parent
8625002ea4
commit
71ec5b7585
24 files changed
+123
-237
No files matched your search
+5
@@ -44,7 +44,12 @@ interface JsSodiumInterface {
|
||||
fun crypto_aead_xchacha20poly1305_ietf_decrypt(secretNonce: Uint8Array, ciphertext: Uint8Array, additionalData: Uint8Array, nonce: Uint8Array, key: Uint8Array) : Uint8Array
|
||||
|
||||
//XChaCha20Poly1305
|
||||
//encrypt
|
||||
fun crypto_secretstream_xchacha20poly1305_init_push(header: Uint8Array) : dynamic
|
||||
fun crypto_secretstream_xchacha20poly1305_push(state: dynamic, message: Uint8Array, additionalData: Uint8Array, tag: Char) : Uint8Array
|
||||
|
||||
//decrypt
|
||||
fun crypto_secretstream_xchacha20poly1305_init_pull(header: Uint8Array, key: Uint8Array) : dynamic
|
||||
|
||||
|
||||
}
|
||||
+16
-5
@@ -16,7 +16,7 @@ import org.khronos.webgl.Uint8Array
|
||||
* ugljesa.jovanovic@ionspin.com
|
||||
* on 14-Jun-2020
|
||||
*/
|
||||
actual class XChaCha20Poly1305Delegated actual constructor(key: UByteArray, nonce: UByteArray) {
|
||||
actual class XChaCha20Poly1305Delegated internal actual constructor() {
|
||||
actual companion object {
|
||||
actual fun encrypt(
|
||||
key: UByteArray,
|
||||
@@ -51,16 +51,25 @@ actual class XChaCha20Poly1305Delegated actual constructor(key: UByteArray, nonc
|
||||
}
|
||||
}
|
||||
|
||||
init {
|
||||
// val state =
|
||||
var state : dynamic = null
|
||||
|
||||
actual fun initializeForEncryption(key: UByteArray) : UByteArray {
|
||||
val stateAndHeader = getSodium().crypto_secretstream_xchacha20poly1305_init_push(key.toUInt8Array())
|
||||
val state = stateAndHeader.state
|
||||
val header = stateAndHeader.header
|
||||
console.log(state)
|
||||
console.log(header)
|
||||
return header
|
||||
}
|
||||
|
||||
actual fun initializeForDecryption(key: UByteArray, header: UByteArray) {
|
||||
}
|
||||
|
||||
internal actual constructor(
|
||||
key: UByteArray,
|
||||
nonce: UByteArray,
|
||||
testState: UByteArray,
|
||||
testHeader: UByteArray
|
||||
) : this(key, nonce) {
|
||||
) : this() {
|
||||
|
||||
}
|
||||
|
||||
@@ -73,4 +82,6 @@ actual class XChaCha20Poly1305Delegated actual constructor(key: UByteArray, nonc
|
||||
TODO("not implemented yet")
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user