Передача 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

@@ -13,7 +13,7 @@ import { useDatabase } from "@/app/providers/DatabaseProvider/useDatabase";
import { usePrivatePlain } from "../AccountProvider/usePrivatePlain";
import { usePublicKey } from "../AccountProvider/usePublicKey";
import { chacha20Decrypt, decodeWithPassword, decrypt, encodeWithPassword, generateMd5 } from "@/app/workers/crypto/crypto";
import { DeliveredMessageState, Message } from "./DialogProvider";
import { AttachmentMeta, DeliveredMessageState, Message } from "./DialogProvider";
import { PacketRead } from "../ProtocolProvider/protocol/packets/packet.read";
import { PacketDelivery } from "../ProtocolProvider/protocol/packets/packet.delivery";
import { useConsoleLogger } from "@/app/hooks/useConsoleLogger";
@@ -104,7 +104,7 @@ export function useDialogFiber() {
decryptedContent = '';
}
let attachmentsMeta: any[] = [];
let attachmentsMeta: AttachmentMeta[] = [];
let messageAttachments: Attachment[] = [];
for (let i = 0; i < packet.getAttachments().length; i++) {
const attachment = packet.getAttachments()[i];
@@ -129,7 +129,9 @@ export function useDialogFiber() {
attachmentsMeta.push({
id: attachment.id,
type: attachment.type,
preview: attachment.preview
preview: attachment.preview,
encoding: attachment.encoding,
transport: attachment.transport
});
}
@@ -261,7 +263,7 @@ export function useDialogFiber() {
const nonce = chachaDecryptedKey.slice(32);
const decryptedContent = await chacha20Decrypt(content, nonce.toString('hex'), key.toString('hex'));
let attachmentsMeta: any[] = [];
let attachmentsMeta: AttachmentMeta[] = [];
let messageAttachments: Attachment[] = [];
for (let i = 0; i < packet.getAttachments().length; i++) {
const attachment = packet.getAttachments()[i];
@@ -286,7 +288,9 @@ export function useDialogFiber() {
attachmentsMeta.push({
id: attachment.id,
type: attachment.type,
preview: attachment.preview
preview: attachment.preview,
encoding: attachment.encoding,
transport: attachment.transport
});
}