allow unpadding of attachments if needed

currently, the padding of attachments is disabled behind  a featureFlags
pull/1570/head
Audric Ackermann 5 years ago
parent 1a2d148482
commit d98700b17f
No known key found for this signature in database
GPG Key ID: 999F434D76324AD4

@ -62,6 +62,7 @@ window.lokiFeatureFlags = {
useFileOnionRequestsV2: true, // more compact encoding of files in response useFileOnionRequestsV2: true, // more compact encoding of files in response
onionRequestHops: 3, onionRequestHops: 3,
useRequestEncryptionKeyPair: false, useRequestEncryptionKeyPair: false,
padOutgoingAttachments: false,
}; };
if ( if (

@ -64,7 +64,7 @@ export class UserDetailsDialog extends React.Component<Props, State> {
private renderAvatar() { private renderAvatar() {
const { avatarPath, pubkey, profileName } = this.props; const { avatarPath, pubkey, profileName } = this.props;
const size = this.state.isEnlargedImageShown ? 300 : 80; const size = this.state.isEnlargedImageShown ? 300 : 80;
const userName = name || profileName || pubkey; const userName = profileName || pubkey;
return ( return (
<Avatar <Avatar

@ -93,9 +93,10 @@ export class AttachmentUtils {
pointer.key = new Uint8Array(crypto.randomBytes(64)); pointer.key = new Uint8Array(crypto.randomBytes(64));
const iv = new Uint8Array(crypto.randomBytes(16)); const iv = new Uint8Array(crypto.randomBytes(16));
const dataToEncrypt = !shouldPad const dataToEncrypt =
? attachment.data !shouldPad || !window.lokiFeatureFlags.padOutgoingAttachments
: AttachmentUtils.addAttachmentPadding(attachment.data); ? attachment.data
: AttachmentUtils.addAttachmentPadding(attachment.data);
const data = await window.textsecure.crypto.encryptAttachment( const data = await window.textsecure.crypto.encryptAttachment(
dataToEncrypt, dataToEncrypt,
pointer.key.buffer, pointer.key.buffer,

@ -4,7 +4,7 @@ type Job<ResultType> = (() => PromiseLike<ResultType>) | (() => ResultType);
// TODO: This needs to replace js/modules/job_queue.js // TODO: This needs to replace js/modules/job_queue.js
export class JobQueue { export class JobQueue {
private pending: Promise<any> = Promise.resolve(); private pending?: Promise<any> = Promise.resolve();
private readonly jobs: Map<string, Promise<unknown>> = new Map(); private readonly jobs: Map<string, Promise<unknown>> = new Map();
public has(id: string): boolean { public has(id: string): boolean {

1
ts/window.d.ts vendored

@ -62,6 +62,7 @@ declare global {
useFileOnionRequestsV2: boolean; useFileOnionRequestsV2: boolean;
onionRequestHops: number; onionRequestHops: number;
useRequestEncryptionKeyPair: boolean; useRequestEncryptionKeyPair: boolean;
padOutgoingAttachments: boolean;
}; };
lokiFileServerAPI: LokiFileServerInstance; lokiFileServerAPI: LokiFileServerInstance;
lokiMessageAPI: LokiMessageInterface; lokiMessageAPI: LokiMessageInterface;

Loading…
Cancel
Save