const React = require('react'); const { connect } = require('react-redux'); const Setting = require('lib/models/Setting'); const EncryptionService = require('lib/services/EncryptionService'); const { themeStyle } = require('../theme.js'); const { _ } = require('lib/locale.js'); const { time } = require('lib/time-utils.js'); const dialogs = require('./dialogs'); const shared = require('lib/components/shared/encryption-config-shared.js'); const { bridge } = require('electron').remote.require('./bridge'); class EncryptionConfigScreenComponent extends React.Component { constructor() { super(); shared.constructor(this); } componentDidMount() { this.isMounted_ = true; } componentWillUnmount() { this.isMounted_ = false; } initState(props) { return shared.initState(this, props); } async refreshStats() { return shared.refreshStats(this); } UNSAFE_componentWillMount() { this.initState(this.props); } UNSAFE_componentWillReceiveProps(nextProps) { this.initState(nextProps); } async checkPasswords() { return shared.checkPasswords(this); } renderMasterKey(mk) { const theme = themeStyle(this.props.theme); const passwordStyle = { color: theme.color, backgroundColor: theme.backgroundColor, border: '1px solid', borderColor: theme.dividerColor, }; const onSaveClick = () => { return shared.onSavePasswordClick(this, mk); }; const onPasswordChange = event => { return shared.onPasswordChange(this, mk, event.target.value); }; const password = this.state.passwords[mk.id] ? this.state.passwords[mk.id] : ''; const active = this.props.activeMasterKeyId === mk.id ? '✔' : ''; const passwordOk = this.state.passwordChecks[mk.id] === true ? '✔' : '❌'; return (
{shared.decryptedStatText(this)}
; const toggleButton = ( ); let masterKeySection = null; if (mkComps.length) { masterKeySection = ({_('Active')} | {_('ID')} | {_('Source')} | {_('Created')} | {_('Updated')} | {_('Password')} | {_('Password OK')} |
---|
{_('Note: Only one master key is going to be used for encryption (the one marked as "active"). Any of the keys might be used for decryption, depending on how the notes or notebooks were originally encrypted.')}
{_('The master keys with these IDs are used to encrypt some of your items, however the application does not currently have access to them. It is likely they will eventually be downloaded via synchronisation.')}
{_('ID')} |
---|
{_('For more information about End-To-End Encryption (E2EE) and advice on how to enable it please check the documentation:')}{' '} { bridge().openExternal('https://joplinapp.org/e2ee/'); }} href="#" style={theme.urlStyle} > https://joplinapp.org/e2ee/
{_('Encryption is:')} {this.props.encryptionEnabled ? _('Enabled') : _('Disabled')}
{decryptedItemsInfo} {toggleButton} {masterKeySection} {nonExistingMasterKeySection}