Update sad paths around manual backup key restore.

This commit is contained in:
Cody Henthorne
2025-01-27 14:53:26 -05:00
committed by Greyson Parrelli
parent b5f323d4af
commit 139b62e469
11 changed files with 257 additions and 57 deletions

View File

@@ -30,6 +30,14 @@ class AccountEntropyPool(val value: String) {
return AccountEntropyPool(stripped)
}
fun isFullyValid(input: String): Boolean {
return LibSignalAccountEntropyPool.isValid(input)
}
fun removeIllegalCharacters(input: String): String {
return input.replace(INVALID_CHARACTERS, "")
}
}
fun deriveMasterKey(): MasterKey {

View File

@@ -1,10 +1,8 @@
package org.whispersystems.signalservice.api.kbs;
import org.signal.libsignal.protocol.kdf.HKDF;
import org.whispersystems.signalservice.api.backup.MessageBackupKey;
import org.signal.core.util.Base64;
import org.whispersystems.signalservice.api.storage.StorageKey;
import org.whispersystems.signalservice.internal.util.Hex;
import org.signal.core.util.Base64;
import org.whispersystems.util.StringUtil;
import java.security.SecureRandom;
@@ -46,11 +44,6 @@ public final class MasterKey {
return derive("Logging Key");
}
public MessageBackupKey deriveMessageBackupKey() {
// TODO [backup] Derive from AEP
return new MessageBackupKey(HKDF.deriveSecrets(masterKey, "20231003_Signal_Backups_GenerateBackupKey".getBytes(), 32));
}
private byte[] derive(String keyName) {
return hmacSha256(masterKey, StringUtil.utf8(keyName));
}