AVATAR & IMAGES ARE WORKING ON DESKTOP

This commit is contained in:
2026-01-27 18:16:14 +05:00
parent f906dc9cf8
commit 3247f2b284
2 changed files with 20 additions and 27 deletions

View File

@@ -1079,11 +1079,14 @@ fun AvatarAttachment(
val encryptedContent = TransportManager.downloadFile(attachment.id, downloadTag)
downloadStatus = DownloadStatus.DECRYPTING
// 🔥 КРИТИЧНО: Аватар зашифрован с AVATAR_PASSWORD (как на desktop)
// НЕ используем ChaCha ключ сообщения!
val decrypted = CryptoManager.decryptWithPassword(
// КРИТИЧНО: chachaKey ЗАШИФРОВАН в БД (как в Desktop)
// Сначала расшифровываем его
val decryptedKeyAndNonce = MessageCrypto.decryptKeyFromSender(chachaKey, privateKey)
val decryptKeyString = String(decryptedKeyAndNonce, Charsets.UTF_8)
val decrypted = MessageCrypto.decryptAttachmentBlobWithPassword(
encryptedContent,
AvatarFileManager.getAvatarPassword()
decryptKeyString
)
if (decrypted != null) {