mirror of
https://github.com/element-hq/element-android
synced 2024-11-28 05:31:21 +03:00
commit
ed6d28bd3b
2 changed files with 6 additions and 9 deletions
|
@ -142,12 +142,11 @@ private fun deriveKey(password: String,
|
||||||
* Generate a 32 chars salt
|
* Generate a 32 chars salt
|
||||||
*/
|
*/
|
||||||
private fun generateSalt(): String {
|
private fun generateSalt(): String {
|
||||||
var salt = ""
|
val salt = buildString {
|
||||||
|
do {
|
||||||
do {
|
append(UUID.randomUUID().toString())
|
||||||
salt += UUID.randomUUID().toString()
|
} while (length < SALT_LENGTH)
|
||||||
} while (salt.length < SALT_LENGTH)
|
}
|
||||||
|
|
||||||
|
|
||||||
return salt.substring(0, SALT_LENGTH)
|
return salt.substring(0, SALT_LENGTH)
|
||||||
}
|
}
|
|
@ -63,9 +63,7 @@ data class MXKey(
|
||||||
fun signatureForUserId(userId: String, signkey: String): String? {
|
fun signatureForUserId(userId: String, signkey: String): String? {
|
||||||
// sanity checks
|
// sanity checks
|
||||||
if (userId.isNotBlank() && signkey.isNotBlank()) {
|
if (userId.isNotBlank() && signkey.isNotBlank()) {
|
||||||
if (signatures.containsKey(userId)) {
|
return signatures[userId]?.get(signkey)
|
||||||
return signatures[userId]?.get(signkey)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return null
|
return null
|
||||||
|
|
Loading…
Reference in a new issue