Fix sticker creator after CDN and typescript changes

This commit is contained in:
Scott Nonnenberg 2020-04-27 13:35:14 -07:00
parent 3966d55d3b
commit 896dfcb43f
2 changed files with 7 additions and 2 deletions

View file

@ -28,12 +28,13 @@ window.log.info('sticker-creator starting up...');
const Signal = require('../js/modules/signal');
window.Signal = Signal.setup({});
window.textsecure = require('../ts/textsecure').default;
const { initialize: initializeWebAPI } = require('../ts/textsecure/WebAPI');
const WebAPI = initializeWebAPI({
url: config.serverUrl,
cdn: {
cdnUrlObject: {
'0': config.cdnUrl0,
'2': config.cdnUrl2,
},
@ -146,7 +147,9 @@ window.encryptAndUpload = async (
async function encrypt(data, key, iv) {
const { ciphertext } = await window.textsecure.crypto.encryptAttachment(
window.Signal.Crypto.typedArrayToArrayBuffer(data),
data instanceof ArrayBuffer
? data
: window.Signal.Crypto.typedArrayToArrayBuffer(data),
key,
iv
);

2
ts/textsecure.d.ts vendored
View file

@ -4,6 +4,7 @@ import {
SignedPreKeyType,
StorageType,
} from './libsignal.d';
import Crypto from './textsecure/Crypto';
import MessageReceiver from './textsecure/MessageReceiver';
import EventTarget from './textsecure/EventTarget';
import { ByteBufferClass } from './window.d';
@ -28,6 +29,7 @@ export type TextSecureType = {
id?: string,
options?: { timeout?: number }
) => () => Promise<any>;
crypto: typeof Crypto;
storage: {
user: {
getNumber: () => string;