Also use AskPopupView instead of prompt() to view GnuPG private key

This commit is contained in:
the-djmaze 2022-02-08 11:34:04 +01:00
parent 8134a2567d
commit c4ffcc708a

View file

@ -70,9 +70,7 @@ export const GnuPGUserStore = new class {
} }
}; };
key.view = () => { key.view = () => {
let pass = isPrivate ? prompt('Passphrase') : true; const fetch = pass => Remote.request('GnupgExportKey',
if (pass) {
Remote.request('GnupgExportKey',
(iError, oData) => { (iError, oData) => {
if (oData && oData.Result) { if (oData && oData.Result) {
key.armor = oData.Result; key.armor = oData.Result;
@ -81,9 +79,15 @@ export const GnuPGUserStore = new class {
}, { }, {
KeyId: key.id, KeyId: key.id,
isPrivate: isPrivate, isPrivate: isPrivate,
Passphrase: isPrivate ? pass : '' Passphrase: pass
} }
); );
if (isPrivate) {
askPassphrase(key, 'POPUP_VIEW_TITLE').then(passphrase => {
(null !== passphrase) && fetch(passphrase);
});
} else {
fetch('');
} }
}; };
return key; return key;