Fix attachments

pull/1209/head
Mikunj 5 years ago
parent 58e71243a4
commit 8d11660b13

@ -0,0 +1,16 @@
export interface LibTextsecureCryptoInterface {
encryptAttachment(
plaintext: ArrayBuffer,
keys: ArrayBuffer,
iv: ArrayBuffer
): Promise<{
digest: ArrayBuffer;
ciphertext: ArrayBuffer;
}>;
decryptAttachment(
encryptedBin: ArrayBuffer,
keys: ArrayBuffer,
theirDigest: ArrayBuffer
): Promise<ArrayBuffer>;
decryptProfile(data: ArrayBuffer, key: ArrayBuffer): Promise<ArrayBuffer>;
}

@ -0,0 +1,26 @@
import { LibTextsecureCryptoInterface } from './crypto';
export interface LibTextsecure {
crypto: LibTextsecureCryptoInterface;
storage: any;
SendMessageNetworkError: any;
IncomingIdentityKeyError: any;
OutgoingIdentityKeyError: any;
ReplayableError: any;
OutgoingMessageError: any;
MessageError: any;
SignedPreKeyRotationError: any;
PoWError: any;
EmptySwarmError: any;
SeedNodeError: any;
DNSResolutionError: any;
HTTPError: any;
NotFoundError: any;
WrongSwarmError: any;
WrongDifficultyError: any;
TimestampError: any;
PublicChatError: any;
PublicTokenError: any;
SenderKeyMissing: any;
createTaskWithTimeout(task: any, id: any, options?: any): Promise<any>;
}

@ -580,6 +580,7 @@
display: inline-block;
margin-left: 6px;
margin-bottom: 2px;
margin-left: 5px;
}
.module-message__metadata__status-icon--sending {

@ -13,6 +13,7 @@ import { handleMediumGroupUpdate } from './mediumGroups';
import { handleUnpairRequest } from './multidevice';
import { downloadAttachment } from './attachments';
import _ from 'lodash';
import { StringUtils } from '../session/utils';
export async function updateProfile(
conversation: any,
@ -81,8 +82,10 @@ function cleanAttachment(attachment: any) {
return {
..._.omit(attachment, 'thumbnail'),
id: attachment.id.toString(),
key: attachment.key ? attachment.key.toString('base64') : null,
digest: attachment.digest ? attachment.digest.toString('base64') : null,
key: attachment.key ? StringUtils.decode(attachment.key, 'base64') : null,
digest: attachment.digest
? StringUtils.decode(attachment.digest, 'base64')
: null,
};
}
@ -508,7 +511,7 @@ function createMessage(
}
function sendDeliveryReceipt(source: string, timestamp: any) {
// FIXME audric
// FIXME audric
// const receiptMessage = new DeliveryReceiptMessage({
// timestamp: Date.now(),
// timestamps: [timestamp],

@ -90,7 +90,7 @@ export class AttachmentUtils {
pointer.key.buffer,
iv.buffer
);
pointer.digest = data.digest;
pointer.digest = new Uint8Array(data.digest);
attachmentData = data.ciphertext;
}

3
ts/window.d.ts vendored

@ -7,6 +7,7 @@ import { LokiPublicChatFactoryInterface } from '../js/modules/loki_public_chat_a
import { LokiAppDotNetServerInterface } from '../js/modules/loki_app_dot_net_api';
import { LokiMessageInterface } from '../js/modules/loki_message_api';
import { SwarmPolling } from './session/snode_api/swarmPolling';
import { LibTextsecure } from '../libtextsecure';
/*
We declare window stuff here instead of global.d.ts because we are importing other declarations.
@ -70,7 +71,7 @@ declare global {
showQRDialog: any;
showSeedDialog: any;
storage: any;
textsecure: any;
textsecure: LibTextsecure;
toggleLinkPreview: any;
toggleMediaPermissions: any;
toggleMenuBar: any;

Loading…
Cancel
Save