Skip to content
This repository has been archived by the owner on Nov 26, 2024. It is now read-only.

Commit

Permalink
remove crypto library for now
Browse files Browse the repository at this point in the history
2.4.1 will be the last release without encryption. I'll create a new branch to work on it.
  • Loading branch information
seldon1000 committed Aug 23, 2021
1 parent 91e56a9 commit f75c2c2
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ dependencies {
implementation 'com.google.accompanist:accompanist-placeholder-material:0.17.0'
implementation 'com.google.accompanist:accompanist-swiperefresh:0.17.0'
implementation 'com.google.android.material:material:1.4.0'
implementation 'com.ionspin.kotlin:multiplatform-crypto-libsodium-bindings:0.8.4'
//implementation 'com.ionspin.kotlin:multiplatform-crypto-libsodium-bindings:0.8.4'
implementation 'io.ktor:ktor-client-auth:1.6.2'
implementation 'io.ktor:ktor-client-cio:1.6.2'
implementation 'io.ktor:ktor-client-core:1.6.2'
Expand Down
40 changes: 36 additions & 4 deletions app/src/main/java/eu/seldon1000/nextpass/api/NextcloudApi.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,13 @@ import io.ktor.client.features.auth.providers.*
import io.ktor.client.features.json.*
import io.ktor.client.features.json.serializer.*
import io.ktor.client.request.*
import kotlinx.coroutines.*
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.launch
import kotlinx.serialization.decodeFromString
import kotlinx.serialization.json.Json
import kotlinx.serialization.json.JsonObject
import kotlinx.serialization.json.jsonPrimitive
import kotlinx.serialization.json.*
import kotlinx.serialization.serializer

@SuppressLint("StaticFieldLeak")
Expand Down Expand Up @@ -164,6 +165,37 @@ class NextcloudApi {
storedPasswords.value = passwords
}

/*@kotlin.ExperimentalUnsignedTypes
fun test() {
coroutineScope.launch {
val io = (client.get<JsonObject>(
urlString = "$server$endpoint/session/request"
) {})["challenge"]!!.jsonObject["salts"]!!.jsonArray
LibsodiumInitializer.initialize()
val salt0 = LibsodiumUtil.fromHex(io[0].jsonPrimitive.content)
val salt1 = LibsodiumUtil.fromHex(io[1].jsonPrimitive.content)
val salt2 = LibsodiumUtil.fromHex(io[2].jsonPrimitive.content)
val k = GenericHash.genericHash(
message = "***$salt0".encodeToUByteArray(),
crypto_generichash_blake2b_BYTES_MAX,
key = salt1
)
val g = PasswordHash.pwhash(
crypto_box_SEEDBYTES,
k.toString(),
salt2,
crypto_pwhash_OPSLIMIT_INTERACTIVE.toULong(),
crypto_pwhash_MEMLIMIT_INTERACTIVE,
crypto_pwhash_argon2id_ALG_ARGON2ID13
)
println("ciao $g")
}
}*/

private suspend inline fun <reified T> showRequest(id: String): T {
return json.decodeFromString(
deserializer = serializer(),
Expand Down

0 comments on commit f75c2c2

Please sign in to comment.