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

Commit f75c2c2

Browse files
author
seldon1000
committed
remove crypto library for now
2.4.1 will be the last release without encryption. I'll create a new branch to work on it.
1 parent 91e56a9 commit f75c2c2

File tree

2 files changed

+37
-5
lines changed

2 files changed

+37
-5
lines changed

app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ dependencies {
5555
implementation 'com.google.accompanist:accompanist-placeholder-material:0.17.0'
5656
implementation 'com.google.accompanist:accompanist-swiperefresh:0.17.0'
5757
implementation 'com.google.android.material:material:1.4.0'
58-
implementation 'com.ionspin.kotlin:multiplatform-crypto-libsodium-bindings:0.8.4'
58+
//implementation 'com.ionspin.kotlin:multiplatform-crypto-libsodium-bindings:0.8.4'
5959
implementation 'io.ktor:ktor-client-auth:1.6.2'
6060
implementation 'io.ktor:ktor-client-cio:1.6.2'
6161
implementation 'io.ktor:ktor-client-core:1.6.2'

app/src/main/java/eu/seldon1000/nextpass/api/NextcloudApi.kt

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,13 @@ import io.ktor.client.features.auth.providers.*
2929
import io.ktor.client.features.json.*
3030
import io.ktor.client.features.json.serializer.*
3131
import io.ktor.client.request.*
32-
import kotlinx.coroutines.*
32+
import kotlinx.coroutines.CoroutineScope
33+
import kotlinx.coroutines.Dispatchers
34+
import kotlinx.coroutines.delay
3335
import kotlinx.coroutines.flow.MutableStateFlow
36+
import kotlinx.coroutines.launch
3437
import kotlinx.serialization.decodeFromString
35-
import kotlinx.serialization.json.Json
36-
import kotlinx.serialization.json.JsonObject
37-
import kotlinx.serialization.json.jsonPrimitive
38+
import kotlinx.serialization.json.*
3839
import kotlinx.serialization.serializer
3940

4041
@SuppressLint("StaticFieldLeak")
@@ -164,6 +165,37 @@ class NextcloudApi {
164165
storedPasswords.value = passwords
165166
}
166167

168+
/*@kotlin.ExperimentalUnsignedTypes
169+
fun test() {
170+
coroutineScope.launch {
171+
val io = (client.get<JsonObject>(
172+
urlString = "$server$endpoint/session/request"
173+
) {})["challenge"]!!.jsonObject["salts"]!!.jsonArray
174+
175+
LibsodiumInitializer.initialize()
176+
177+
val salt0 = LibsodiumUtil.fromHex(io[0].jsonPrimitive.content)
178+
val salt1 = LibsodiumUtil.fromHex(io[1].jsonPrimitive.content)
179+
val salt2 = LibsodiumUtil.fromHex(io[2].jsonPrimitive.content)
180+
181+
val k = GenericHash.genericHash(
182+
message = "***$salt0".encodeToUByteArray(),
183+
crypto_generichash_blake2b_BYTES_MAX,
184+
key = salt1
185+
)
186+
187+
val g = PasswordHash.pwhash(
188+
crypto_box_SEEDBYTES,
189+
k.toString(),
190+
salt2,
191+
crypto_pwhash_OPSLIMIT_INTERACTIVE.toULong(),
192+
crypto_pwhash_MEMLIMIT_INTERACTIVE,
193+
crypto_pwhash_argon2id_ALG_ARGON2ID13
194+
)
195+
println("ciao $g")
196+
}
197+
}*/
198+
167199
private suspend inline fun <reified T> showRequest(id: String): T {
168200
return json.decodeFromString(
169201
deserializer = serializer(),

0 commit comments

Comments
 (0)