Fix sticker creator
This commit is contained in:
parent
7c9b8e919c
commit
4fefd3ccaf
1 changed files with 10 additions and 9 deletions
|
@ -13,7 +13,12 @@ const pMap = require('p-map');
|
||||||
// It is important to call this as early as possible
|
// It is important to call this as early as possible
|
||||||
require('../ts/windows/context');
|
require('../ts/windows/context');
|
||||||
|
|
||||||
const { deriveStickerPackKey } = require('../ts/Crypto');
|
const {
|
||||||
|
deriveStickerPackKey,
|
||||||
|
encryptAttachment,
|
||||||
|
getRandomBytes,
|
||||||
|
} = require('../ts/Crypto');
|
||||||
|
const Bytes = require('../ts/Bytes');
|
||||||
const { SignalService: Proto } = require('../ts/protobuf');
|
const { SignalService: Proto } = require('../ts/protobuf');
|
||||||
const {
|
const {
|
||||||
getEnvironment,
|
getEnvironment,
|
||||||
|
@ -190,9 +195,9 @@ window.encryptAndUpload = async (
|
||||||
const { value: oldUsername } = oldUsernameItem;
|
const { value: oldUsername } = oldUsernameItem;
|
||||||
const { value: password } = passwordItem;
|
const { value: password } = passwordItem;
|
||||||
|
|
||||||
const packKey = window.Signal.Crypto.getRandomBytes(32);
|
const packKey = getRandomBytes(32);
|
||||||
const encryptionKey = deriveStickerPackKey(packKey);
|
const encryptionKey = deriveStickerPackKey(packKey);
|
||||||
const iv = window.Signal.Crypto.getRandomBytes(16);
|
const iv = getRandomBytes(16);
|
||||||
|
|
||||||
const server = WebAPI.connect({
|
const server = WebAPI.connect({
|
||||||
username: username || oldUsername,
|
username: username || oldUsername,
|
||||||
|
@ -241,7 +246,7 @@ window.encryptAndUpload = async (
|
||||||
onProgress
|
onProgress
|
||||||
);
|
);
|
||||||
|
|
||||||
const hexKey = window.Signal.Crypto.hexFromBytes(packKey);
|
const hexKey = Bytes.toHex(packKey);
|
||||||
|
|
||||||
ipc.send('install-sticker-pack', packId, hexKey);
|
ipc.send('install-sticker-pack', packId, hexKey);
|
||||||
|
|
||||||
|
@ -249,11 +254,7 @@ window.encryptAndUpload = async (
|
||||||
};
|
};
|
||||||
|
|
||||||
async function encrypt(data, key, iv) {
|
async function encrypt(data, key, iv) {
|
||||||
const { ciphertext } = await window.textsecure.crypto.encryptAttachment(
|
const { ciphertext } = await encryptAttachment(data, key, iv);
|
||||||
data,
|
|
||||||
key,
|
|
||||||
iv
|
|
||||||
);
|
|
||||||
|
|
||||||
return ciphertext;
|
return ciphertext;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue