feat: Enhance search functionality and user experience

- Added local account metadata handling in SearchScreen for improved "Saved Messages" search fallback.
- Updated search logic to include username and account name checks when searching for the user.
- Introduced search logging in SearchUsersViewModel for better debugging and tracking of search queries.
- Refactored image download process in AttachmentComponents to include detailed logging for debugging.
- Created AttachmentDownloadDebugLogger to manage and display download logs.
- Improved DeviceVerificationBanner UI for better user engagement during device verification.
- Adjusted OtherProfileScreen layout to enhance information visibility and user interaction.
- Updated network security configuration to include new Let's Encrypt certificate for CDN.
This commit is contained in:
2026-02-19 17:34:16 +05:00
parent cacd6dc029
commit 53d0e44ef8
26 changed files with 972 additions and 613 deletions

View File

@@ -24,6 +24,7 @@ object MessageCrypto {
private const val CHACHA_KEY_SIZE = 32
private const val XCHACHA_NONCE_SIZE = 24
private const val POLY1305_TAG_SIZE = 16
private const val SYNC_KEY_PREFIX = "sync:"
// Кэш PBKDF2-SHA256 ключей: password → derived key bytes
// PBKDF2 с 1000 итерациями ~50-100ms, кэш убирает повторные вычисления
@@ -387,6 +388,16 @@ object MessageCrypto {
* КРИТИЧНО: ephemeralPrivateKeyHex может иметь нечётную длину!
*/
fun decryptKeyFromSender(encryptedKeyBase64: String, myPrivateKeyHex: String): ByteArray {
if (encryptedKeyBase64.startsWith(SYNC_KEY_PREFIX)) {
val aesChachaKey = encryptedKeyBase64.removePrefix(SYNC_KEY_PREFIX)
if (aesChachaKey.isBlank()) {
throw IllegalArgumentException("Invalid sync key format: empty aesChachaKey")
}
val decoded =
CryptoManager.decryptWithPassword(aesChachaKey, myPrivateKeyHex)
?: throw IllegalArgumentException("Failed to decrypt sync chacha key")
return decoded.toByteArray(Charsets.ISO_8859_1)
}
val combined = String(Base64.decode(encryptedKeyBase64, Base64.NO_WRAP))