mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-26 03:40:56 +01:00
Rotate MRBK when rotating AEP.
This commit is contained in:
@@ -211,17 +211,21 @@ object BackupRepository {
|
||||
* Generates a new AEP that the user can choose to confirm.
|
||||
*/
|
||||
@CheckResult
|
||||
fun stageAEPKeyRotation(): AccountEntropyPool {
|
||||
return AccountEntropyPool.generate()
|
||||
fun stageBackupKeyRotations(): StagedBackupKeyRotations {
|
||||
return StagedBackupKeyRotations(
|
||||
aep = AccountEntropyPool.generate(),
|
||||
mediaRootBackupKey = MediaRootBackupKey.generate()
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the AEP to the local storage and kicks off a backup upload.
|
||||
*/
|
||||
suspend fun commitAEPKeyRotation(accountEntropyPool: AccountEntropyPool) {
|
||||
suspend fun commitAEPKeyRotation(stagedKeyRotations: StagedBackupKeyRotations) {
|
||||
haltAllJobs()
|
||||
resetInitializedStateAndAuthCredentials()
|
||||
SignalStore.account.rotateAccountEntropyPool(accountEntropyPool)
|
||||
SignalStore.account.rotateAccountEntropyPool(stagedKeyRotations.aep)
|
||||
SignalStore.backup.mediaRootBackupKey = stagedKeyRotations.mediaRootBackupKey
|
||||
BackupMessagesJob.enqueue()
|
||||
}
|
||||
|
||||
@@ -2009,6 +2013,11 @@ class DebugBackupMetadata(
|
||||
val mediaSize: Long
|
||||
)
|
||||
|
||||
data class StagedBackupKeyRotations(
|
||||
val aep: AccountEntropyPool,
|
||||
val mediaRootBackupKey: MediaRootBackupKey
|
||||
)
|
||||
|
||||
sealed class ImportResult {
|
||||
data class Success(val backupTime: Long) : ImportResult()
|
||||
data object Failure : ImportResult()
|
||||
|
||||
Reference in New Issue
Block a user