Use new attachments API endpoint

This commit is contained in:
Fedor Indutny 2023-05-04 13:58:53 -07:00 committed by Josh Perez
parent d7bd4eb156
commit f1624705a7
3 changed files with 51 additions and 29 deletions

View file

@ -1,8 +1,6 @@
// Copyright 2023 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import Long from 'long';
import type {
AttachmentWithHydratedData,
UploadedAttachmentType,
@ -20,12 +18,11 @@ export async function uploadAttachment(
const { server } = window.textsecure;
strictAssert(server, 'WebAPI must be initialized');
const attachmentIdString = await server.putEncryptedAttachment(
encrypted.ciphertext
);
const cdnKey = await server.putEncryptedAttachment(encrypted.ciphertext);
return {
cdnId: Long.fromString(attachmentIdString),
cdnKey,
cdnNumber: 2,
key: keys,
size: attachment.data.byteLength,
digest: encrypted.digest,