Skip to content

Commit

Permalink
Merge pull request #948 from wireapp/staging
Browse files Browse the repository at this point in the history
release 2017-03-27
  • Loading branch information
Gregor Herdmann authored Mar 27, 2017
2 parents 60d8269 + 125d884 commit 235ff2d
Show file tree
Hide file tree
Showing 84 changed files with 2,459 additions and 1,803 deletions.
4 changes: 4 additions & 0 deletions .eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,16 @@ extends:
"eslint:recommended"

globals:
_: true
$: true
amplify: true
ko: true
LRUCache: true
wire: true
z: true

rules:
brace-style: [2, 1tbs]
comma-dangle: [2, always-multiline]
handle-callback-err: 2
indent: [2, 2, {SwitchCase: 1}]
Expand Down
8 changes: 4 additions & 4 deletions app/page/auth.html
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@
</div>
<div id="wire-login-password-remember" data-bind="electron_remove">
<div class="checkbox checkbox-remember">
<input type="checkbox" id="checkbox-remember-password" data-bind="checked: persist" data-uie-name="enter-remember-sign-in">
<label class="label-xs" for="checkbox-remember-password" data-bind="l10n_text: z.string.auth_account_remember_me"></label>
<input type="checkbox" id="checkbox-public-computer" data-bind="checked: is_public_computer" data-uie-name="enter-public-computer-sign-in">
<label class="label-xs" for="checkbox-public-computer" data-bind="l10n_text: z.string.auth_account_public_computer"></label>
</div>
</div>
<div class="footer">
Expand Down Expand Up @@ -119,8 +119,8 @@
</ul>
<div id="wire-login-phone-remember" data-bind="electron_remove">
<div class="checkbox checkbox-remember">
<input type="checkbox" id="checkbox-remember-phone" data-bind="checked: persist" data-uie-name="enter-remember-sign-in">
<label class="label-xs" for="checkbox-remember-phone" data-bind="l10n_text: z.string.auth_account_remember_me"></label>
<input type="checkbox" id="checkbox-public-computer-phone" data-bind="checked: is_public_computer" data-uie-name="enter-public-computer-phone-sign-in">
<label class="label-xs" for="checkbox-public-computer-phone" data-bind="l10n_text: z.string.auth_account_public_computer"></label>
</div>
</div>
<div class="footer">
Expand Down
4 changes: 2 additions & 2 deletions app/page/template/content/preferences-av.htm
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@
<video class="preferences-av-video"
autoplay
data-bind="css: {'preferences-av-video-disabled': permission_denied},
mute_media_element: video_stream(),
source_stream: video_stream()">
mute_media_element: media_stream(),
source_stream: media_stream()">
</video>
</section>
<!-- /ko -->
Expand Down
15 changes: 0 additions & 15 deletions app/page/template/modals.htm
Original file line number Diff line number Diff line change
Expand Up @@ -310,19 +310,4 @@
</div>
</div>

<div class="modal modal-whitelist-screensharing" data-uie-name="modal-whitelist-screensharing">
<div class="modal-content">
<div class="modal-header">
<div class="modal-close icon-close icon-button pull-right"></div>
<div class="modal-title" data-bind="l10n_text: z.string.modal_whitelist_screensharing_headline"></div>
</div>
<div class="modal-text">
<span data-bind="l10n_text: z.string.modal_whitelist_screensharing_message_1"></span>
<a data-bind="l10n_href: z.string.url_support_screen_whitelist, l10n_text: z.string.modal_whitelist_screensharing_message_link" rel="nofollow noopener noreferrer" target="_blank"></a>
<span data-bind="l10n_text: z.string.modal_whitelist_screensharing_message_2"></span>
</div>
<div class="modal-close button button-medium button-fluid" data-bind="l10n_text: z.string.modal_button_ok" data-uie-name="do-close"></div>
</div>
</div>

</div>
2 changes: 1 addition & 1 deletion app/script/announce/AnnounceRepository.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@

check_version() {
return this.announce_service.get_version().then((server_version) => {
this.logger.info(`Found new version ${server_version}`);
this.logger.info(`Checking current webapp version. Server '${server_version}' vs. local '${z.util.Environment.version(false, true)}'`);

if (server_version > z.util.Environment.version(false, true)) {
amplify.publish(z.event.WebApp.LIFECYCLE.UPDATE, z.announce.UPDATE_SOURCE.WEBAPP);
Expand Down
52 changes: 0 additions & 52 deletions app/script/assets/Asset.coffee

This file was deleted.

65 changes: 65 additions & 0 deletions app/script/assets/Asset.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*
* Wire
* Copyright (C) 2016 Wire Swiss GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see http://www.gnu.org/licenses/.
*
*/

'use strict';

window.z = window.z || {};
window.z.assets = z.assets || {};

z.assets.Asset = class Asset {

/*
Construct a new asset for the asset service.
@deprecated
@param {Object} config - Asset configuration
*/
constructor(config) {
this.correlation_id = config.correlation_id || z.util.create_random_uuid();
this.content_type = config.content_type;
this.array_buffer = config.array_buffer;
this.payload = {
conv_id: config.conversation_id,
correlation_id: this.correlation_id,
public: config.public || false,
tag: config.tag || 'medium',
inline: config.inline || false,
nonce: this.correlation_id,
md5: config.md5,
width: config.width,
height: config.height,
original_width: config.original_width || config.width,
original_height: config.original_height || config.width,
native_push: config.native_push || false,
};
}

/*
Create the content disposition header for the asset.
*/
get_content_disposition() {
const payload = ['zasset'];
for (let key in this.payload) {
const value = this.payload[key];
payload.push(`${key}=${value}`);
}
return payload.join(';');
}

};
76 changes: 0 additions & 76 deletions app/script/assets/AssetCrypto.coffee

This file was deleted.

81 changes: 81 additions & 0 deletions app/script/assets/AssetCrypto.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
/*
* Wire
* Copyright (C) 2016 Wire Swiss GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see http://www.gnu.org/licenses/.
*
*/

'use strict';

window.z = window.z || {};
window.z.assets = z.assets || {};

z.assets.AssetCrypto = {

/*
@param {ArrayBuffer} key_bytes - AES key used for encryption
@param {ArrayBuffer} computed_sha256 - SHA-256 checksum of the ciphertext
@param {ArrayBuffer} ciphertext - Encrypted plaintext
*/
encrypt_aes_asset(plaintext) {
const iv = new Uint8Array(16);
let key = null;
let iv_ciphertext = null;
let computed_sha256 = null;

window.crypto.getRandomValues(iv);

return window.crypto.subtle.generateKey({name: 'AES-CBC', length: 256}, true, ['encrypt'])
.then(function(ckey) {
key = ckey;

return window.crypto.subtle.encrypt({name: 'AES-CBC', iv: iv.buffer}, key, plaintext);
}).then(function(ciphertext) {
iv_ciphertext = new Uint8Array(ciphertext.byteLength + iv.byteLength);
iv_ciphertext.set(iv, 0);
iv_ciphertext.set(new Uint8Array(ciphertext), iv.byteLength);

return window.crypto.subtle.digest('SHA-256', iv_ciphertext);
}).then(function(digest) {
computed_sha256 = digest;

return window.crypto.subtle.exportKey('raw', key);
}).then(key_bytes => [key_bytes, computed_sha256, iv_ciphertext.buffer]);
},

/*
@param {ArrayBuffer} key_bytes - AES key used for encryption
@param {ArrayBuffer} computed_sha256 - SHA-256 checksum of the ciphertext
@param {ArrayBuffer} ciphertext - Encrypted plaintext
*/
decrypt_aes_asset(ciphertext, key_bytes, reference_sha256) {
return window.crypto.subtle.digest('SHA-256', ciphertext)
.then(function(computed_sha256) {
const a = new Uint32Array(reference_sha256);
const b = new Uint32Array(computed_sha256);

if ((a.length === b.length) && a.every((x, i) => x === b[i])) {
return window.crypto.subtle.importKey('raw', key_bytes, 'AES-CBC', false, ['decrypt']);
}

throw new Error('Encrypted asset does not match its SHA-256 hash');
}).then(function(key) {
const iv = ciphertext.slice(0, 16);
const img_ciphertext = ciphertext.slice(16);
return window.crypto.subtle.decrypt({name: 'AES-CBC', iv}, key, img_ciphertext);
});
},

};
Loading

0 comments on commit 235ff2d

Please sign in to comment.