password saving

This commit is contained in:
jessop 2019-08-27 22:35:07 -04:00 committed by Sean Yesmunt
parent ec1f48484e
commit 5c06fa2dd8
19 changed files with 103 additions and 101 deletions

View file

@ -1,3 +1,5 @@
/* eslint no-console:0 */
/* eslint space-before-function-paren:0 */
// Module imports // Module imports
import '@babel/polyfill'; import '@babel/polyfill';
import keytar from 'keytar'; import keytar from 'keytar';
@ -29,6 +31,7 @@ let showingAutoUpdateCloseAlert = false;
// object is garbage collected. // object is garbage collected.
let rendererWindow; let rendererWindow;
// eslint-disable-next-line no-unused-vars
let tray; let tray;
let daemon; let daemon;
@ -44,6 +47,7 @@ if (isDev) {
process.env.ELECTRON_DISABLE_SECURITY_WARNINGS = true; process.env.ELECTRON_DISABLE_SECURITY_WARNINGS = true;
} }
// eslint-disable-next-line space-before-function-paren
const startDaemon = async () => { const startDaemon = async () => {
let isDaemonRunning = false; let isDaemonRunning = false;
@ -110,6 +114,7 @@ if (!gotSingleInstanceLock) {
} }
}); });
// eslint-disable-next-line space-before-function-paren
app.on('ready', async () => { app.on('ready', async () => {
await startDaemon(); await startDaemon();
startSandbox(); startSandbox();
@ -312,6 +317,26 @@ ipcMain.on('set-auth-token', (event, token) => {
keytar.setPassword('LBRY', 'auth_token', token ? token.toString().trim() : null); keytar.setPassword('LBRY', 'auth_token', token ? token.toString().trim() : null);
}); });
ipcMain.on('get-password', event => {
keytar.getPassword('LBRY', 'wallet_password').then(password => {
event.sender.send('get-password-response', password ? password.toString() : null);
});
});
ipcMain.on('set-password', (event, password) => {
if (password || password === '') {
keytar.setPassword('LBRY', 'wallet_password', password).then(res => {
event.sender.send('get-password-response', res);
});
}
});
ipcMain.on('delete-password', (event, password) => {
keytar.deletePassword('LBRY', 'wallet_password', password).then(res => {
event.sender.send('get-password-response', res);
});
});
process.on('uncaughtException', error => { process.on('uncaughtException', error => {
console.log(error); console.log(error);
dialog.showErrorBox('Error Encountered', `Caught error: ${error}`); dialog.showErrorBox('Error Encountered', `Caught error: ${error}`);

View file

@ -6,12 +6,6 @@ import { Lbry, buildURI, parseURI } from 'lbry-redux';
import Router from 'component/router/index'; import Router from 'component/router/index';
import ModalRouter from 'modal/modalRouter'; import ModalRouter from 'modal/modalRouter';
import ReactModal from 'react-modal'; import ReactModal from 'react-modal';
<<<<<<< HEAD
import SideBar from 'component/sideBar';
import Header from 'component/header';
import Button from 'component/button';
=======
>>>>>>> add createChannel to first run flow
import { openContextMenu } from 'util/context-menu'; import { openContextMenu } from 'util/context-menu';
import useKonamiListener from 'util/enhanced-layout'; import useKonamiListener from 'util/enhanced-layout';
import Yrbl from 'component/yrbl'; import Yrbl from 'component/yrbl';

View file

@ -10,7 +10,6 @@ import {
selectWalletIsEncrypted, selectWalletIsEncrypted,
selectHasTransactions, selectHasTransactions,
} from 'lbry-redux'; } from 'lbry-redux';
import { doPasswordSaved } from 'redux/actions/app';
import WalletSecurityAndSync from './view'; import WalletSecurityAndSync from './view';
import { import {
doCheckSync, doCheckSync,
@ -27,7 +26,6 @@ import {
selectHashChanged, selectHashChanged,
selectUser, selectUser,
} from 'lbryinc'; } from 'lbryinc';
import { selectIsPasswordSaved } from 'redux/selectors/app';
import { doSetClientSetting } from 'redux/actions/settings'; import { doSetClientSetting } from 'redux/actions/settings';
import { makeSelectClientSetting } from 'redux/selectors/settings'; import { makeSelectClientSetting } from 'redux/selectors/settings';
@ -46,7 +44,6 @@ const select = state => ({
syncApplyErrorMessage: selectSyncApplyErrorMessage(state), syncApplyErrorMessage: selectSyncApplyErrorMessage(state),
syncData: selectSyncData(state), syncData: selectSyncData(state),
syncHash: selectSyncHash(state), syncHash: selectSyncHash(state),
isPasswordSaved: selectIsPasswordSaved(state),
hashChanged: selectHashChanged(state), hashChanged: selectHashChanged(state),
}); });
@ -54,7 +51,6 @@ const perform = dispatch => ({
encryptWallet: password => dispatch(doWalletEncrypt(password)), encryptWallet: password => dispatch(doWalletEncrypt(password)),
decryptWallet: () => dispatch(doWalletDecrypt()), decryptWallet: () => dispatch(doWalletDecrypt()),
updateWalletStatus: () => dispatch(doWalletStatus()), updateWalletStatus: () => dispatch(doWalletStatus()),
setPasswordSaved: saved => dispatch(doPasswordSaved(saved)),
syncApply: (hash, data, password) => dispatch(doSyncApply(hash, data, password)), syncApply: (hash, data, password) => dispatch(doSyncApply(hash, data, password)),
getSync: password => dispatch(doGetSync(password)), getSync: password => dispatch(doGetSync(password)),
checkSync: () => dispatch(doCheckSync()), checkSync: () => dispatch(doCheckSync()),

View file

@ -6,7 +6,6 @@ import UserEmail from 'component/userEmail';
import * as ICONS from 'constants/icons'; import * as ICONS from 'constants/icons';
import { getSavedPassword, setSavedPassword, deleteSavedPassword } from 'util/saved-passwords'; import { getSavedPassword, setSavedPassword, deleteSavedPassword } from 'util/saved-passwords';
import { KEY_WALLET_PASSWORD } from 'constants/keychain';
type Props = { type Props = {
// wallet statuses // wallet statuses
@ -70,10 +69,7 @@ function WalletSecurityAndSync(props: Props) {
walletEncrypted, walletEncrypted,
encryptWallet, encryptWallet,
decryptWallet, decryptWallet,
setPasswordSaved,
syncEnabled, syncEnabled,
setClientSetting,
isPasswordSaved,
user, user,
hasSyncedWallet, hasSyncedWallet,
getSyncIsPending, getSyncIsPending,
@ -84,7 +80,7 @@ function WalletSecurityAndSync(props: Props) {
syncApply, syncApply,
checkSync, checkSync,
hasTransactions, hasTransactions,
// setDefaultAccount, setDefaultAccount,
} = props; } = props;
const defaultComponentState: State = { const defaultComponentState: State = {
@ -111,7 +107,7 @@ function WalletSecurityAndSync(props: Props) {
// on mount // on mount
useEffect(() => { useEffect(() => {
checkSync(); checkSync();
getSavedPassword(KEY_WALLET_PASSWORD).then(p => { getSavedPassword().then(p => {
if (p) { if (p) {
setComponentState({ setComponentState({
...componentState, ...componentState,
@ -140,7 +136,7 @@ function WalletSecurityAndSync(props: Props) {
function onChangeRememberPassword(event: SyntheticInputEvent<>) { function onChangeRememberPassword(event: SyntheticInputEvent<>) {
if (componentState.rememberPassword) { if (componentState.rememberPassword) {
deleteSavedPassword(KEY_WALLET_PASSWORD); deleteSavedPassword();
} }
setComponentState({ ...componentState, rememberPassword: event.target.checked }); setComponentState({ ...componentState, rememberPassword: event.target.checked });
} }
@ -204,7 +200,7 @@ function WalletSecurityAndSync(props: Props) {
} }
if (componentState.rememberPassword && !componentState.failed) { if (componentState.rememberPassword && !componentState.failed) {
setSavedPassword(KEY_WALLET_PASSWORD, componentState.newPassword); setSavedPassword(componentState.newPassword);
} }
} }
@ -374,13 +370,13 @@ function WalletSecurityAndSync(props: Props) {
onClick={() => syncApply(syncHash, syncData, componentState.newPassword)} onClick={() => syncApply(syncHash, syncData, componentState.newPassword)}
/>{' '} />{' '}
<Button button="primary" label={__('Check Sync')} onClick={() => checkSync()} />{' '} <Button button="primary" label={__('Check Sync')} onClick={() => checkSync()} />{' '}
<Button button="primary" label={__('Setpass test')} onClick={() => setSavedPassword('test', 'testpass')} />{' '} <Button button="primary" label={__('Setpass test')} onClick={() => setSavedPassword('testpass')} />{' '}
<Button <Button
button="primary" button="primary"
label={__('Getpass test')} label={__('Getpass test')}
onClick={() => getSavedPassword('test').then(p => setComponentState({ ...componentState, newPassword: p }))} onClick={() => getSavedPassword().then(p => setComponentState({ ...componentState, newPassword: p }))}
/>{' '} />{' '}
<Button button="primary" label={__('Deletepass test')} onClick={() => deleteSavedPassword('test')} />{' '} <Button button="primary" label={__('Deletepass test')} onClick={() => deleteSavedPassword()} />{' '}
<p> <p>
password:{' '} password:{' '}
{componentState.newPassword {componentState.newPassword

View file

@ -1,3 +0,0 @@
export const AUTH_ORG = 'LBRY';
export const KEY_WALLET_PASSWORD = 'wallet_password';
export const KEY_AUTH_TOKEN = 'auth_token';

View file

@ -1,12 +1,11 @@
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import ModalPasswordUnsave from './view'; import ModalPasswordUnsave from './view';
import { doHideModal, doPasswordSaved } from 'redux/actions/app'; import { doHideModal } from 'redux/actions/app';
// const select = () => ({}); // const select = () => ({});
// //
const perform = dispatch => ({ const perform = dispatch => ({
closeModal: () => dispatch(doHideModal()), closeModal: () => dispatch(doHideModal()),
setPasswordSaved: saved => dispatch(doPasswordSaved(saved)),
}); });
export default connect( export default connect(

View file

@ -1,11 +1,10 @@
// @flow // @flow
import React from 'react'; import React from 'react';
import { Modal } from 'modal/modal'; import { Modal } from 'modal/modal';
// import keytar from 'keytar'; import { deleteSavedPassword } from 'util/saved-passwords';
type Props = { type Props = {
closeModal: () => void, closeModal: () => void,
setPasswordSaved: boolean => void,
}; };
class ModalPasswordUnsave extends React.PureComponent<Props> { class ModalPasswordUnsave extends React.PureComponent<Props> {
@ -18,12 +17,10 @@ class ModalPasswordUnsave extends React.PureComponent<Props> {
type="confirm" type="confirm"
confirmButtonLabel={__('Forget')} confirmButtonLabel={__('Forget')}
abortButtonLabel={__('Nevermind')} abortButtonLabel={__('Nevermind')}
onConfirmed={ onConfirmed={() =>
() => {} deleteSavedPassword().then(() => {
// keytar.deletePassword('LBRY', 'wallet_password').then(() => { this.props.closeModal();
// this.props.setPasswordSaved(false); })
// this.props.closeModal();
// })
} }
onAborted={this.props.closeModal} onAborted={this.props.closeModal}
> >

View file

@ -1,19 +1,16 @@
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { doWalletStatus, doWalletDecrypt, selectWalletDecryptSucceeded } from 'lbry-redux'; import { doWalletStatus, doWalletDecrypt, selectWalletDecryptSucceeded } from 'lbry-redux';
import { doHideModal, doPasswordSaved } from 'redux/actions/app'; import { doHideModal } from 'redux/actions/app';
import ModalWalletDecrypt from './view'; import ModalWalletDecrypt from './view';
import { selectIsPasswordSaved } from 'redux/selectors/app';
const select = state => ({ const select = state => ({
walletDecryptSucceded: selectWalletDecryptSucceeded(state), walletDecryptSucceded: selectWalletDecryptSucceeded(state),
isPasswordSaved: selectIsPasswordSaved(state),
}); });
const perform = dispatch => ({ const perform = dispatch => ({
closeModal: () => dispatch(doHideModal()), closeModal: () => dispatch(doHideModal()),
decryptWallet: password => dispatch(doWalletDecrypt(password)), decryptWallet: password => dispatch(doWalletDecrypt(password)),
updateWalletStatus: () => dispatch(doWalletStatus()), updateWalletStatus: () => dispatch(doWalletStatus()),
setPasswordSaved: saved => dispatch(doPasswordSaved(saved)),
}); });
export default connect( export default connect(

View file

@ -2,15 +2,13 @@
import React from 'react'; import React from 'react';
import { Modal } from 'modal/modal'; import { Modal } from 'modal/modal';
import Button from 'component/button'; import Button from 'component/button';
// import keytar from 'keytar'; import { deleteSavedPassword } from 'util/saved-passwords';
type Props = { type Props = {
closeModal: () => void, closeModal: () => void,
decryptWallet: () => void, decryptWallet: () => void,
updateWalletStatus: () => void, updateWalletStatus: () => void,
walletDecryptSucceded: boolean, walletDecryptSucceded: boolean,
passwordUnsaved: () => void,
setPasswordSaved: boolean => void,
}; };
type State = { type State = {
@ -26,8 +24,7 @@ class ModalWalletDecrypt extends React.PureComponent<Props, State> {
const { props, state } = this; const { props, state } = this;
if (state.submitted && props.walletDecryptSucceded === true) { if (state.submitted && props.walletDecryptSucceded === true) {
// keytar.deletePassword('LBRY', 'wallet_password'); deleteSavedPassword();
props.setPasswordSaved(false);
props.closeModal(); props.closeModal();
props.updateWalletStatus(); props.updateWalletStatus();
} }

View file

@ -1,6 +1,6 @@
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { doWalletStatus, doWalletEncrypt, selectWalletEncryptSucceeded, selectWalletEncryptResult } from 'lbry-redux'; import { doWalletStatus, doWalletEncrypt, selectWalletEncryptSucceeded, selectWalletEncryptResult } from 'lbry-redux';
import { doHideModal, doPasswordSaved } from 'redux/actions/app'; import { doHideModal } from 'redux/actions/app';
import ModalWalletEncrypt from './view'; import ModalWalletEncrypt from './view';
const select = state => ({ const select = state => ({
@ -12,7 +12,6 @@ const perform = dispatch => ({
closeModal: () => dispatch(doHideModal()), closeModal: () => dispatch(doHideModal()),
encryptWallet: password => dispatch(doWalletEncrypt(password)), encryptWallet: password => dispatch(doWalletEncrypt(password)),
updateWalletStatus: () => dispatch(doWalletStatus()), updateWalletStatus: () => dispatch(doWalletStatus()),
setPasswordSaved: saved => dispatch(doPasswordSaved(saved)),
}); });
export default connect( export default connect(

View file

@ -3,6 +3,7 @@ import React from 'react';
import { Form, FormField, Submit } from 'component/common/form'; import { Form, FormField, Submit } from 'component/common/form';
import { Modal } from 'modal/modal'; import { Modal } from 'modal/modal';
import Button from 'component/button'; import Button from 'component/button';
import { setSavedPassword } from 'util/saved-passwords';
type Props = { type Props = {
closeModal: () => void, closeModal: () => void,
@ -10,7 +11,6 @@ type Props = {
updateWalletStatus: boolean, updateWalletStatus: boolean,
encryptWallet: (?string) => void, encryptWallet: (?string) => void,
updateWalletStatus: () => void, updateWalletStatus: () => void,
setPasswordSaved: boolean => void,
}; };
type State = { type State = {
@ -87,8 +87,7 @@ class ModalWalletEncrypt extends React.PureComponent<Props, State> {
return; return;
} }
if (state.rememberPassword === true) { if (state.rememberPassword === true) {
this.props.setPasswordSaved(true); setSavedPassword(state.newPassword);
// keytar.setPassword('LBRY', 'wallet_password', state.newPassword);
} }
this.setState({ submitted: true }); this.setState({ submitted: true });
this.props.encryptWallet(state.newPassword); this.props.encryptWallet(state.newPassword);

View file

@ -1,6 +1,6 @@
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { doWalletUnlock, selectWalletUnlockSucceeded } from 'lbry-redux'; import { doWalletUnlock, selectWalletUnlockSucceeded } from 'lbry-redux';
import { doQuit, doHideModal, doPasswordSaved } from 'redux/actions/app'; import { doQuit, doHideModal } from 'redux/actions/app';
import ModalWalletUnlock from './view'; import ModalWalletUnlock from './view';
const select = state => ({ const select = state => ({
@ -11,7 +11,6 @@ const perform = dispatch => ({
closeModal: () => dispatch(doHideModal()), closeModal: () => dispatch(doHideModal()),
quit: () => dispatch(doQuit()), quit: () => dispatch(doQuit()),
unlockWallet: password => dispatch(doWalletUnlock(password)), unlockWallet: password => dispatch(doWalletUnlock(password)),
setPasswordSaved: saved => dispatch(doPasswordSaved(saved)),
}); });
export default connect( export default connect(

View file

@ -3,14 +3,13 @@ import React from 'react';
import { Form, FormField } from 'component/common/form'; import { Form, FormField } from 'component/common/form';
import { Modal } from 'modal/modal'; import { Modal } from 'modal/modal';
import Button from 'component/button'; import Button from 'component/button';
// import keytar from 'keytar'; import { getSavedPassword, setSavedPassword } from 'util/saved-passwords';
type Props = { type Props = {
quit: () => void, quit: () => void,
closeModal: () => void, closeModal: () => void,
unlockWallet: (?string) => void, unlockWallet: (?string) => void,
walletUnlockSucceded: boolean, walletUnlockSucceded: boolean,
setPasswordSaved: boolean => void,
}; };
type State = { type State = {
@ -24,13 +23,21 @@ class ModalWalletUnlock extends React.PureComponent<Props, State> {
rememberPassword: false, rememberPassword: false,
}; };
componentDidMount() {
getSavedPassword()
.then(p => {
if (p) {
this.setState({ password: p, rememberPassword: true });
}
})
.catch();
}
componentDidUpdate() { componentDidUpdate() {
const { props } = this; const { props } = this;
if (props.walletUnlockSucceded === true) { if (props.walletUnlockSucceded === true) {
if (this.state.rememberPassword) { if (this.state.rememberPassword) {
this.props.setPasswordSaved(true); setSavedPassword(this.state.password);
// keytar.setPassword('LBRY', 'wallet_password', this.state.password);
} }
props.closeModal(); props.closeModal();
} }

View file

@ -36,7 +36,6 @@ const perform = dispatch => ({
decryptWallet: () => dispatch(doNotifyDecryptWallet()), decryptWallet: () => dispatch(doNotifyDecryptWallet()),
updateWalletStatus: () => dispatch(doWalletStatus()), updateWalletStatus: () => dispatch(doWalletStatus()),
confirmForgetPassword: modalProps => dispatch(doNotifyForgetPassword(modalProps)), confirmForgetPassword: modalProps => dispatch(doNotifyForgetPassword(modalProps)),
setPasswordSaved: saved => dispatch(doPasswordSaved(saved)),
clearPlayingUri: () => dispatch(doSetPlayingUri(null)), clearPlayingUri: () => dispatch(doSetPlayingUri(null)),
setDarkTime: (time, options) => dispatch(doSetDarkTime(time, options)), setDarkTime: (time, options) => dispatch(doSetDarkTime(time, options)),
}); });

View file

@ -11,9 +11,8 @@ import I18nMessage from 'component/i18nMessage';
import Page from 'component/page'; import Page from 'component/page';
import SettingLanguage from 'component/settingLanguage'; import SettingLanguage from 'component/settingLanguage';
import FileSelector from 'component/common/file-selector'; import FileSelector from 'component/common/file-selector';
import UnsupportedOnWeb from 'component/common/unsupported-on-web';
// import keytar from 'keytar';
import WalletSecurityAndSync from '../../component/walletSecurityAndSync'; import WalletSecurityAndSync from '../../component/walletSecurityAndSync';
import { getSavedPassword } from 'util/saved-passwords';
type Price = { type Price = {
currency: string, currency: string,
@ -64,8 +63,6 @@ type Props = {
userBlockedChannelsCount?: number, userBlockedChannelsCount?: number,
hideBalance: boolean, hideBalance: boolean,
confirmForgetPassword: () => void, confirmForgetPassword: () => void,
isPasswordSaved: boolean,
setPasswordSaved: boolean => void,
floatingPlayer: boolean, floatingPlayer: boolean,
clearPlayingUri: () => void, clearPlayingUri: () => void,
darkModeTimes: DarkModeTimes, darkModeTimes: DarkModeTimes,
@ -94,18 +91,17 @@ class SettingsPage extends React.PureComponent<Props, State> {
(this: any).onAutomaticDarkModeChange = this.onAutomaticDarkModeChange.bind(this); (this: any).onAutomaticDarkModeChange = this.onAutomaticDarkModeChange.bind(this);
(this: any).clearCache = this.clearCache.bind(this); (this: any).clearCache = this.clearCache.bind(this);
(this: any).onChangeTime = this.onChangeTime.bind(this); (this: any).onChangeTime = this.onChangeTime.bind(this);
(this: any).onConfirmForgetPassword = this.onConfirmForgetPassword.bind(this);
} }
componentDidMount() { componentDidMount() {
this.props.getThemes(); this.props.getThemes();
this.props.updateWalletStatus(); this.props.updateWalletStatus();
// keytar.getPassword('LBRY', 'wallet_password').then(p => { getSavedPassword().then(p => {
// if (p || p === '') { if (p) {
// this.props.setPasswordSaved(true); this.setState({ storedPassword: true });
// } else { }
// this.props.setPasswordSaved(false); });
// }
// });
} }
onKeyFeeChange(newValue: Price) { onKeyFeeChange(newValue: Price) {
@ -209,7 +205,6 @@ class SettingsPage extends React.PureComponent<Props, State> {
floatingPlayer, floatingPlayer,
clearPlayingUri, clearPlayingUri,
darkModeTimes, darkModeTimes,
isPasswordSaved,
} = this.props; } = this.props;
const noDaemonSettings = !daemonSettings || Object.keys(daemonSettings).length === 0; const noDaemonSettings = !daemonSettings || Object.keys(daemonSettings).length === 0;
@ -519,7 +514,7 @@ class SettingsPage extends React.PureComponent<Props, State> {
</React.Fragment> </React.Fragment>
} }
/> />
{isPasswordSaved && ( {this.state.storedPassword && (
<p className="card__subtitle card__help"> <p className="card__subtitle card__help">
{__('Your password is saved in your OS keychain.')}{' '} {__('Your password is saved in your OS keychain.')}{' '}
<Button <Button

View file

@ -14,14 +14,8 @@ const select = (state, props) => {
const { pathname, hash } = props.location; const { pathname, hash } = props.location;
const urlPath = pathname + hash; const urlPath = pathname + hash;
// Remove the leading "/" added by the browser // Remove the leading "/" added by the browser
<<<<<<< HEAD
const path = urlPath.slice(1).replace(/:/g, '#'); const path = urlPath.slice(1).replace(/:/g, '#');
=======
const path = pathname.slice(1).replace(/:/g, '#');
console.log('path', path);
debugger;
>>>>>>> rebase and comment out keytar
let uri; let uri;
try { try {
uri = normalizeURI(path); uri = normalizeURI(path);

View file

@ -313,27 +313,12 @@ export function doNotifyForgetPassword() {
}; };
} }
export function doNotifySyncWallet() {
return dispatch => {
dispatch(doOpenModal(MODALS.WALLET_SYNC));
};
}
export function doAlertError(errorList) { export function doAlertError(errorList) {
return dispatch => { return dispatch => {
dispatch(doError(errorList)); dispatch(doError(errorList));
}; };
} }
export function doPasswordSaved(saved) {
return dispatch => {
dispatch({
type: ACTIONS.PASSWORD_SAVED,
data: saved,
});
};
}
export function doDaemonReady() { export function doDaemonReady() {
return (dispatch, getState) => { return (dispatch, getState) => {
const state = getState(); const state = getState();

View file

@ -1,17 +1,45 @@
// import keytar from 'keytar'; import { ipcRenderer } from 'electron';
import { AUTH_ORG } from 'constants/keychain';
export const setSavedPassword = (key, value) => { export const setSavedPassword = value => {
// keytar.setPassword(AUTH_ORG, key, value); return new Promise(
resolve => {
ipcRenderer.once('set-password-response', (event, success) => {
resolve(success);
});
ipcRenderer.send('set-password', value);
},
reject => {
reject(false);
}
);
}; };
export const getSavedPassword = key => { export const getSavedPassword = () => {
// return keytar return new Promise(
// .getPassword(AUTH_ORG, key) resolve => {
// .then(p => p) ipcRenderer.once('get-password-response', (event, password) => {
// .catch(e => console.error(e)); resolve(password);
});
ipcRenderer.send('get-password');
},
reject => reject(false)
);
}; };
export const deleteSavedPassword = key => { export const deleteSavedPassword = () => {
// keytar.deletePassword(AUTH_ORG, key).catch(e => console.error(e)); return new Promise(
resolve => {
ipcRenderer.once('delete-password-response', (event, success) => {
resolve(success);
});
ipcRenderer.send('delete-password');
},
reject => {
reject(false);
}
);
};
export const testKeychain = () => {
// we should make sure it works on startup
}; };

View file

@ -655,7 +655,6 @@
"Block": "Block", "Block": "Block",
"% downloaded": "% downloaded", "% downloaded": "% downloaded",
"'claimName' should no longer be used. Use 'streamClaimName' or 'channelClaimName' instead": "'claimName' should no longer be used. Use 'streamClaimName' or 'channelClaimName' instead", "'claimName' should no longer be used. Use 'streamClaimName' or 'channelClaimName' instead": "'claimName' should no longer be used. Use 'streamClaimName' or 'channelClaimName' instead",
"Portuguese": "Portuguese",
"Vietnamese": "Vietnamese", "Vietnamese": "Vietnamese",
"Thai": "Thai", "Thai": "Thai",
"Arabic": "Arabic", "Arabic": "Arabic",