Support for single-attachment delete synced across devices

This commit is contained in:
Scott Nonnenberg 2024-06-21 15:35:18 -07:00 committed by GitHub
parent 97229e2e65
commit ac04d02d4f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
26 changed files with 422 additions and 55 deletions

View file

@ -20,6 +20,7 @@ import {
type HardcodedIVForEncryptionType,
} from '../AttachmentCrypto';
import { missingCaseError } from './missingCaseError';
import { uuidToBytes } from './uuidToBytes';
const CDNS_SUPPORTING_TUS = new Set([3]);
@ -37,9 +38,13 @@ export async function uploadAttachment(
uploadType: 'standard',
});
const { blurHash, caption, clientUuid, fileName, flags, height, width } =
attachment;
return {
cdnKey,
cdnNumber,
clientUuid: clientUuid ? uuidToBytes(clientUuid) : undefined,
key: keys,
iv: encrypted.iv,
size: attachment.data.byteLength,
@ -47,12 +52,12 @@ export async function uploadAttachment(
plaintextHash: encrypted.plaintextHash,
contentType: MIMETypeToString(attachment.contentType),
fileName: attachment.fileName,
flags: attachment.flags,
width: attachment.width,
height: attachment.height,
caption: attachment.caption,
blurHash: attachment.blurHash,
fileName,
flags,
width,
height,
caption,
blurHash,
};
}