Передача chachakey и начало нового протокола вложений

This commit is contained in:
RoyceDa
2026-03-27 20:07:40 +02:00
parent 94ba139541
commit c9cff515e5
6 changed files with 31 additions and 11 deletions

View File

@@ -216,6 +216,16 @@ export function DialogProvider(props: DialogProviderProps) {
readUpdated = true;
}
let decryptKey = '';
if(message.from_me && message.chacha_key != "" && !message.chacha_key.startsWith("sync:")){
/**
* Если это сообщение от нас, то проверяем, есть ли внутри chacha_key
*/
try{
decryptKey = Buffer.from(await decodeWithPassword(privatePlain, message.chacha_key), 'binary').toString('utf-8');
}catch(e) {
decryptKey = "";
}
}
if(message.from_me && message.chacha_key != "" && message.chacha_key.startsWith("sync:")){
/**
* Если это сообщение от нас, то проверяем, есть ли внутри chacha_key, если есть, значит это
@@ -629,7 +639,7 @@ export function DialogProvider(props: DialogProviderProps) {
blob: attachment.type == AttachmentType.MESSAGES ? await decodeWithPassword(chachaDecryptedKey.toString('utf-8'), attachment.blob) : ""
});
}
console.info(attachments);
const newMessage : Message = {
from_public_key: fromPublicKey,
to_public_key: toPublicKey,