mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-09-28 07:51:42 +01:00
Name plaintext export attachment files by plaintext hash so they can be located from the exported json.
This commit is contained in:
@@ -186,7 +186,7 @@ object LocalArchiver {
|
||||
val prefixDirs = HashMap<String, DocumentFile>()
|
||||
for (attachment in attachments) {
|
||||
if (cancellationSignal()) break
|
||||
val mediaName = MediaName.forLocalBackupFilename(attachment.plaintextHash, attachment.localBackupKey.key)
|
||||
val mediaName = MediaName.forPlaintextExportFilename(attachment.plaintextHash)
|
||||
|
||||
try {
|
||||
val ext = attachment.contentType
|
||||
|
||||
@@ -20,6 +20,11 @@ value class MediaName(val name: String) {
|
||||
fun forThumbnailFromMediaName(mediaName: String) = MediaName("${mediaName}_thumbnail")
|
||||
fun forLocalBackupFilename(plaintextHash: ByteArray, localKey: ByteArray) = MediaName(Hex.toStringCondensed(CryptoUtil.sha256(plaintextHash + localKey)))
|
||||
|
||||
/**
|
||||
* Since these are unencrypted, we don't want to create them via the local key.
|
||||
*/
|
||||
fun forPlaintextExportFilename(plaintextHash: ByteArray) = MediaName(Hex.toStringCondensed(plaintextHash))
|
||||
|
||||
/**
|
||||
* For java, since it struggles with value classes.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user