PR feedback

This commit is contained in:
ThomasSession 2024-07-30 15:04:41 +10:00
parent 83ea71de24
commit 7a8e1309fb
2 changed files with 13 additions and 7 deletions

View File

@ -1,10 +1,15 @@
package network.loki.messenger.libsession_util.util
object BlindKeyAPI {
init {
private val loadLibrary by lazy {
System.loadLibrary("session_util")
}
init {
// Ensure the library is loaded at initialization
loadLibrary
}
external fun blindVersionKeyPair(ed25519SecretKey: ByteArray): KeyPair
external fun blindVersionSign(ed25519SecretKey: ByteArray, timestamp: Long): ByteArray
}

View File

@ -151,11 +151,12 @@ object FileServerApi {
val result = send(request).await()
// map out the result
val json = JsonUtil.fromJson(result, Map::class.java)
val statusCode = json.getOrDefault("status_code", 0) as Int
val version = json.getOrDefault("result", "") as String
val updated = json.getOrDefault("updated", 0.0) as Double
return VersionData(statusCode, version, updated)
return JsonUtil.fromJson(result, Map::class.java).let {
VersionData(
statusCode = it["status_code"] as? Int ?: 0,
version = it["result"] as? String ?: "",
updated = it["updated"] as? Double ?: 0.0
)
}
}
}