mirror of
https://github.com/vector-im/element-android.git
synced 2024-11-26 15:18:19 +08:00
Merge pull request #12 from poljar/fga/feature/finish_backup_recovery_key
Use backup key directly on olmMachine.
This commit is contained in:
commit
52ed7c019b
@ -140,7 +140,7 @@ dependencies {
|
||||
implementation libs.jetbrains.coroutinesCore
|
||||
implementation libs.jetbrains.coroutinesAndroid
|
||||
|
||||
implementation 'org.matrix.rustcomponents:crypto-android:0.1.0'
|
||||
implementation 'org.matrix.rustcomponents:crypto-android:0.2.1-SNAPSHOT'
|
||||
//implementation files('libs/crypto-android-release.aar')
|
||||
|
||||
// implementation(name: 'crypto-android-release', ext: 'aar')
|
||||
|
@ -59,6 +59,7 @@ import org.matrix.android.sdk.internal.network.parsing.CheckNumberType
|
||||
import org.matrix.android.sdk.internal.session.SessionScope
|
||||
import timber.log.Timber
|
||||
import uniffi.olm.BackupKeys
|
||||
import uniffi.olm.BackupRecoveryKey
|
||||
import uniffi.olm.CrossSigningKeyExport
|
||||
import uniffi.olm.CrossSigningStatus
|
||||
import uniffi.olm.CryptoStoreException
|
||||
@ -769,7 +770,7 @@ internal class OlmMachine @Inject constructor(
|
||||
}
|
||||
|
||||
@Throws(CryptoStoreException::class)
|
||||
suspend fun saveRecoveryKey(key: String?, version: String?) {
|
||||
suspend fun saveRecoveryKey(key: BackupRecoveryKey?, version: String?) {
|
||||
withContext(coroutineDispatchers.computation) {
|
||||
inner.saveRecoveryKey(key, version)
|
||||
}
|
||||
|
@ -189,9 +189,7 @@ internal class RustKeyBackupService @Inject constructor(
|
||||
|
||||
override fun saveBackupRecoveryKey(recoveryKey: BackupRecoveryKey?, version: String?) {
|
||||
cryptoCoroutineScope.launch {
|
||||
val recoveryKeyStr = recoveryKey?.toBase64()
|
||||
// TODO : change rust API to use BackupRecoveryKey
|
||||
olmMachine.saveRecoveryKey(recoveryKeyStr, version)
|
||||
olmMachine.saveRecoveryKey(recoveryKey?.inner, version)
|
||||
}
|
||||
}
|
||||
|
||||
@ -727,9 +725,8 @@ internal class RustKeyBackupService @Inject constructor(
|
||||
|
||||
override suspend fun getKeyBackupRecoveryKeyInfo(): SavedKeyBackupKeyInfo? {
|
||||
val info = olmMachine.getBackupKeys() ?: return null
|
||||
// TODO change rust ffi to return BackupRecoveryKey instead of base64 string
|
||||
val backupRecoveryKey = BackupRecoveryKey.fromBase64(info.recoveryKey)
|
||||
return SavedKeyBackupKeyInfo(backupRecoveryKey, info.backupVersion)
|
||||
val backupRecoveryKey = BackupRecoveryKey(info.recoveryKey())
|
||||
return SavedKeyBackupKeyInfo(backupRecoveryKey, info.backupVersion())
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user