Enable attachment backup uploading

This commit is contained in:
trevor-signal 2024-05-29 19:46:43 -04:00 committed by GitHub
parent 94a262b799
commit 4254356812
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
27 changed files with 2054 additions and 534 deletions

View file

@ -17,6 +17,7 @@ import {
encryptAttachmentV2ToDisk,
safeUnlinkSync,
type PlaintextSourceType,
type HardcodedIVForEncryptionType,
} from '../AttachmentCrypto';
import { missingCaseError } from './missingCaseError';
@ -58,10 +59,12 @@ export async function uploadAttachment(
export async function encryptAndUploadAttachment({
plaintext,
keys,
dangerousIv,
uploadType,
}: {
plaintext: PlaintextSourceType;
keys: Uint8Array;
dangerousIv?: HardcodedIVForEncryptionType;
uploadType: 'standard' | 'backup';
}): Promise<{
cdnKey: string;
@ -91,6 +94,7 @@ export async function encryptAndUploadAttachment({
const encrypted = await encryptAttachmentV2ToDisk({
plaintext,
keys,
dangerousIv,
});
absoluteCiphertextPath = window.Signal.Migrations.getAbsoluteAttachmentPath(