mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-27 04:04:43 +01:00
Add internal UI for importing backup with different credentials.
Co-authored-by: Greyson Parrelli <greyson@signal.org>
This commit is contained in:
committed by
Greyson Parrelli
parent
0cfda852cf
commit
fa32f399b2
@@ -15,9 +15,21 @@ import org.signal.libsignal.messagebackup.AccountEntropyPool as LibSignalAccount
|
||||
class AccountEntropyPool(val value: String) {
|
||||
|
||||
companion object {
|
||||
private val INVALID_CHARACTERS = Regex("[^0-9a-zA-Z]")
|
||||
private const val LENGTH = 64
|
||||
|
||||
fun generate(): AccountEntropyPool {
|
||||
return AccountEntropyPool(LibSignalAccountEntropyPool.generate())
|
||||
}
|
||||
|
||||
fun parseOrNull(input: String): AccountEntropyPool? {
|
||||
val stripped = input.replace(INVALID_CHARACTERS, "")
|
||||
if (stripped.length != LENGTH) {
|
||||
return null
|
||||
}
|
||||
|
||||
return AccountEntropyPool(stripped)
|
||||
}
|
||||
}
|
||||
|
||||
fun deriveMasterKey(): MasterKey {
|
||||
|
||||
@@ -12,7 +12,7 @@ import org.signal.libsignal.messagebackup.MessageBackupKey as LibSignalMessageBa
|
||||
|
||||
/**
|
||||
* Safe typing around a backup key, which is a 32-byte array.
|
||||
* This key is derived from the master key.
|
||||
* This key is derived from the AEP.
|
||||
*/
|
||||
class MessageBackupKey(override val value: ByteArray) : BackupKey {
|
||||
init {
|
||||
|
||||
Reference in New Issue
Block a user