Move master init to enabled

This commit is contained in:
Jiiks 2018-08-13 10:45:52 +03:00
parent b6da7019d0
commit d6d78d1e99
2 changed files with 14 additions and 10 deletions

View File

@ -19,13 +19,13 @@ import E2EEComponent from './E2EEComponent.vue';
import E2EEMessageButton from './E2EEMessageButton.vue';
import aes256 from 'aes256';
let seed = Security.randomBytes();
const TEMP_KEY = 'temporarymasterkey';
let seed;
export default new class E2EE extends BuiltinModule {
constructor() {
super();
this.master = this.encrypt(seed, 'temporarymasterkey');
this.encryptNewMessages = true;
}
@ -71,6 +71,10 @@ export default new class E2EE extends BuiltinModule {
}
async enabled(e) {
seed = Security.randomBytes();
// TODO Input modal for key
this.master = this.encrypt(seed, TEMP_KEY);
this.patchMessageContent();
const selector = '.' + WebpackModules.getClassName('channelTextArea', 'emojiButton');
const cta = await ReactComponents.getComponent('ChannelTextArea', { selector });

View File

@ -130,21 +130,21 @@
}
.bd-encryptedImage::before {
content: "Encrypted Image";
// content: "Encrypted Image";
position: absolute;
background: $colbdgreen;
width: 100%;
height: 100%;
border-radius: 3px;
display: flex;
justify-content: center;
align-items: flex-start;
font-size: 1.2em;
font-weight: 700;
color: #2c2c2c;
line-height: 30px;
// justify-content: center;
// align-items: flex-start;
// font-size: 1.2em;
// font-weight: 700;
// color: #2c2c2c;
// line-height: 30px;
background-image: $lockIcon;
background-size: 50% 50%;
background-size: calc(100% / 2);
background-repeat: no-repeat;
background-position: center;
}