Bug 1868214 - remove mail.openpgp.key_assistant.enable. r=kaie

Differential Revision: https://phabricator.services.mozilla.com/D195478

--HG--
extra : rebase_source : e322fa4cfbb9c7ad0c7e54f7ec1cf4e787290de2
extra : amend_source : 7e5069b4c4adac1ee8dc28eda2a140fb0f2b0a73
This commit is contained in:
Magnus Melin 2023-12-05 11:26:59 +02:00
Родитель c3fedc41c8
Коммит f1f448d090
10 изменённых файлов: 1 добавлений и 654 удалений

Просмотреть файл

@ -1845,23 +1845,7 @@ function setSecuritySettings(menu_id) {
*/
function showMessageComposeSecurityStatus(isSending = false) {
if (gSelectedTechnologyIsPGP) {
if (
Services.prefs.getBoolPref("mail.openpgp.key_assistant.enable", false)
) {
gKeyAssistant.show(getEncryptionCompatibleRecipients(), isSending);
} else {
Recipients2CompFields(gMsgCompose.compFields);
window.openDialog(
"chrome://openpgp/content/ui/composeKeyStatus.xhtml",
"",
"chrome,modal,resizable,centerscreen",
{
compFields: gMsgCompose.compFields,
currentIdentity: gCurrentIdentity,
}
);
checkEncryptionState();
}
gKeyAssistant.show(getEncryptionCompatibleRecipients(), isSending);
} else {
Recipients2CompFields(gMsgCompose.compFields);
// Copy current flags to S/MIME composeSecure object.

Просмотреть файл

@ -47,8 +47,6 @@ pref("mail.openpgp.separate_mime_layers", false);
// If you need to specify a path, use a file:// URL
pref("mail.openpgp.alias_rules_file", "");
pref("mail.openpgp.key_assistant.enable", true);
// If set to true, enable user interface that allows the user to optionally set
// and manage individual, user-defined passphrases for OpenPGP secret keys.
// If set to false, the respective user interface will be hidden.

Просмотреть файл

@ -1,222 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
var { EnigmailFuncs } = ChromeUtils.import(
"chrome://openpgp/content/modules/funcs.jsm"
);
var EnigmailKeyRing = ChromeUtils.import(
"chrome://openpgp/content/modules/keyRing.jsm"
).EnigmailKeyRing;
var { EnigmailWindows } = ChromeUtils.import(
"chrome://openpgp/content/modules/windows.jsm"
);
var { EnigmailKey } = ChromeUtils.import(
"chrome://openpgp/content/modules/key.jsm"
);
const { OpenPGPAlias } = ChromeUtils.import(
"chrome://openpgp/content/modules/OpenPGPAlias.jsm"
);
const { PgpSqliteDb2 } = ChromeUtils.import(
"chrome://openpgp/content/modules/sqliteDb.jsm"
);
var gListBox;
var gViewButton;
var gEmailAddresses = [];
var gRowToEmail = [];
// One boolean entry per row. True means it is an alias row.
// This allows us to use different dialog behavior for alias entries.
var gAliasRows = [];
var gMapAddressToKeyObjs = null;
function addRecipients(toAddrList, recList) {
for (var i = 0; i < recList.length; i++) {
try {
const entry = EnigmailFuncs.stripEmail(recList[i].replace(/[",]/g, ""));
toAddrList.push(entry);
} catch (ex) {
console.debug(ex);
}
}
}
async function setListEntries() {
gMapAddressToKeyObjs = new Map();
for (let addr of gEmailAddresses) {
addr = addr.toLowerCase();
let statusStringID = null;
let statusStringDirect = "";
const aliasKeyList = EnigmailKeyRing.getAliasKeyList(addr);
const isAlias = !!aliasKeyList;
if (isAlias) {
const aliasKeys = EnigmailKeyRing.getAliasKeys(aliasKeyList);
if (!aliasKeys.length) {
// failure, at least one alias key is unusable/unavailable
statusStringDirect = await document.l10n.formatValue(
"openpgp-compose-alias-status-error"
);
} else {
statusStringDirect = await document.l10n.formatValue(
"openpgp-compose-alias-status-direct",
{
count: aliasKeys.length,
}
);
}
} else {
// We ask to include keys which are expired, because that's what
// our sub dialog oneRecipientStatus needs. This is for
// efficiency - because otherwise the sub dialog would have to
// query all keys again.
// The consequence is, we need to later call isValidForEncryption
// for the keys we have obtained, to confirm they are really valid.
const foundKeys = await EnigmailKeyRing.getMultValidKeysForOneRecipient(
addr,
true
);
if (!foundKeys || !foundKeys.length) {
statusStringID = "openpgp-recip-missing";
} else {
gMapAddressToKeyObjs.set(addr, foundKeys);
for (const keyObj of foundKeys) {
let goodPersonal = false;
if (keyObj.secretAvailable) {
goodPersonal = await PgpSqliteDb2.isAcceptedAsPersonalKey(
keyObj.fpr
);
}
if (
goodPersonal ||
(EnigmailKeyRing.isValidForEncryption(keyObj) &&
(keyObj.acceptance == "verified" ||
keyObj.acceptance == "unverified"))
) {
statusStringID = "openpgp-recip-good";
break;
}
}
if (!statusStringID) {
statusStringID = "openpgp-recip-none-accepted";
}
}
}
const listitem = document.createXULElement("richlistitem");
const emailItem = document.createXULElement("label");
emailItem.setAttribute("value", addr);
emailItem.setAttribute("crop", "end");
emailItem.setAttribute("style", "width: var(--recipientWidth)");
listitem.appendChild(emailItem);
const status = document.createXULElement("label");
if (statusStringID) {
document.l10n.setAttributes(status, statusStringID);
} else {
status.setAttribute("value", statusStringDirect);
}
status.setAttribute("crop", "end");
status.setAttribute("style", "width: var(--statusWidth)");
listitem.appendChild(status);
gListBox.appendChild(listitem);
gRowToEmail.push(addr);
gAliasRows.push(isAlias);
}
}
async function onLoad() {
const params = window.arguments[0];
if (!params) {
return;
}
try {
await OpenPGPAlias.load();
} catch (ex) {
console.log("failed to load OpenPGP alias file: " + ex);
}
gListBox = document.getElementById("infolist");
gViewButton = document.getElementById("detailsButton");
var arrLen = {};
var recList;
if (params.compFields.to) {
recList = params.compFields.splitRecipients(
params.compFields.to,
true,
arrLen
);
addRecipients(gEmailAddresses, recList);
}
if (params.compFields.cc) {
recList = params.compFields.splitRecipients(
params.compFields.cc,
true,
arrLen
);
addRecipients(gEmailAddresses, recList);
}
if (params.compFields.bcc) {
recList = params.compFields.splitRecipients(
params.compFields.bcc,
true,
arrLen
);
addRecipients(gEmailAddresses, recList);
}
await setListEntries();
}
async function reloadAndReselect(selIndex = -1) {
while (true) {
const child = gListBox.lastChild;
// keep first child, which is the header
if (child == gListBox.firstChild) {
break;
}
gListBox.removeChild(child);
}
gRowToEmail = [];
await setListEntries();
gListBox.selectedIndex = selIndex;
}
function onSelectionChange(event) {
// We don't offer detail management/discovery for email addresses
// that match an alias rule.
gViewButton.disabled =
!gListBox.selectedItems.length || gAliasRows[gListBox.selectedIndex];
}
function viewSelectedEmail() {
const selIndex = gListBox.selectedIndex;
if (gViewButton.disabled || selIndex == -1) {
return;
}
const email = gRowToEmail[selIndex];
window.openDialog(
"chrome://openpgp/content/ui/oneRecipientStatus.xhtml",
"",
"chrome,modal,resizable,centerscreen",
{
email,
keys: gMapAddressToKeyObjs.get(email),
}
);
reloadAndReselect(selIndex);
}

Просмотреть файл

@ -1,103 +0,0 @@
<?xml version="1.0"?>
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<window
data-l10n-id="openpgp-compose-key-status-title"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
style="width: 40em; height: 25em"
persist="width height"
lightweightthemes="true"
onload="onLoad();"
>
<dialog id="composeKeyStatus" buttons="accept">
<script src="chrome://openpgp/content/ui/composeKeyStatus.js" />
<script>
<![CDATA[
function resizeColumns() {
let list = document.getElementById("infolist");
let cols = list.getElementsByTagName("treecol");
list.style.setProperty("--recipientWidth", cols[0].getBoundingClientRect().width + "px");
list.style.setProperty("--statusWidth", cols[1].getBoundingClientRect().width + "px");
}
addEventListener("load", resizeColumns, { once: true });
addEventListener("resize", resizeColumns);
]]>
</script>
<script src="chrome://messenger/content/dialogShadowDom.js" />
<linkset>
<html:link rel="stylesheet" href="chrome://global/skin/global.css" />
<html:link
rel="stylesheet"
href="chrome://messenger/skin/openpgp/openPgpComposeStatus.css"
/>
<html:link
rel="stylesheet"
href="chrome://messenger/skin/variables.css"
/>
<html:link rel="stylesheet" href="chrome://messenger/skin/colors.css" />
<html:link
rel="stylesheet"
href="chrome://messenger/skin/themeableDialog.css"
/>
<html:link rel="localization" href="branding/brand.ftl" />
<html:link
rel="localization"
href="messenger/openpgp/composeKeyStatus.ftl"
/>
</linkset>
<description data-l10n-id="openpgp-compose-key-status-intro-need-keys" />
<separator class="thin" />
<label
data-l10n-id="openpgp-compose-key-status-keys-heading"
control="infolist"
/>
<richlistbox
id="infolist"
class="theme-listbox"
flex="1"
onselect="onSelectionChange(event);"
>
<treecols>
<treecol
id="recipientComposeKeyCol"
data-l10n-id="openpgp-compose-key-status-recipient"
/>
<treecol
id="statusComposeKeyCol"
data-l10n-id="openpgp-compose-key-status-status"
/>
</treecols>
</richlistbox>
<hbox pack="start">
<button
id="detailsButton"
disabled="true"
data-l10n-id="openpgp-compose-key-status-open-details"
oncommand="viewSelectedEmail();"
/>
</hbox>
<separator class="thin" />
<vbox flex="1">
<html:span
class="tail-with-learn-more"
data-l10n-id="openpgp-compose-general-info-alias"
></html:span>
<label
is="text-link"
id="openPgpAliasLearnMore"
href="https://support.mozilla.org/kb/openpgp-recipient-alias-configuration"
data-l10n-id="openpgp-compose-general-info-alias-learn-more"
/>
</vbox>
</dialog>
</window>

Просмотреть файл

@ -1,177 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
var { EnigmailFuncs } = ChromeUtils.import(
"chrome://openpgp/content/modules/funcs.jsm"
);
var EnigmailKeyRing = ChromeUtils.import(
"chrome://openpgp/content/modules/keyRing.jsm"
).EnigmailKeyRing;
var { EnigmailWindows } = ChromeUtils.import(
"chrome://openpgp/content/modules/windows.jsm"
);
var { EnigmailDialog } = ChromeUtils.import(
"chrome://openpgp/content/modules/dialog.jsm"
);
var { EnigmailKey } = ChromeUtils.import(
"chrome://openpgp/content/modules/key.jsm"
);
var KeyLookupHelper = ChromeUtils.import(
"chrome://openpgp/content/modules/keyLookupHelper.jsm"
).KeyLookupHelper;
const { PgpSqliteDb2 } = ChromeUtils.import(
"chrome://openpgp/content/modules/sqliteDb.jsm"
);
var gListBox;
var gViewButton;
var gAddr;
var gRowToKey = [];
async function setListEntries(keys = null) {
let index = 0;
// Temporary code for debugging/development, should be removed when
// a final patch for bug 1627956 lands.
console.log(await EnigmailKeyRing.getEncryptionKeyMeta(gAddr));
if (!keys) {
keys = await EnigmailKeyRing.getMultValidKeysForOneRecipient(gAddr, true);
}
for (const keyObj of keys) {
const listitem = document.createXULElement("richlistitem");
const keyId = document.createXULElement("label");
keyId.setAttribute("value", "0x" + keyObj.keyId);
keyId.setAttribute("crop", "end");
keyId.setAttribute("style", "width: var(--keyWidth)");
listitem.appendChild(keyId);
let acceptanceText;
// Further above, we called getMultValidKeysForOneRecipient
// and asked to ignore if a key is expired.
// If the following check fails, the key must be expired.
if (!EnigmailKeyRing.isValidForEncryption(keyObj)) {
acceptanceText = "openpgp-key-expired";
} else if (keyObj.secretAvailable) {
if (await PgpSqliteDb2.isAcceptedAsPersonalKey(keyObj.fpr)) {
acceptanceText = "openpgp-key-own";
} else {
acceptanceText = "openpgp-key-secret-not-personal";
}
} else {
if (!("acceptance" in keyObj)) {
throw new Error(
"expected getMultValidKeysForOneRecipient to set acceptance"
);
}
switch (keyObj.acceptance) {
case "rejected":
acceptanceText = "openpgp-key-rejected";
break;
case "unverified":
acceptanceText = "openpgp-key-unverified";
break;
case "verified":
acceptanceText = "openpgp-key-verified";
break;
case "undecided":
acceptanceText = "openpgp-key-undecided";
break;
default:
throw new Error("unexpected acceptance value: " + keyObj.acceptance);
}
}
const status = document.createXULElement("label");
document.l10n.setAttributes(status, acceptanceText);
status.setAttribute("crop", "end");
status.setAttribute("style", "width: var(--statusWidth)");
listitem.appendChild(status);
const issued = document.createXULElement("label");
issued.setAttribute("value", keyObj.created);
issued.setAttribute("crop", "end");
issued.setAttribute("style", "width: var(--issuedWidth)");
listitem.appendChild(issued);
const expire = document.createXULElement("label");
expire.setAttribute("value", keyObj.expiry);
expire.setAttribute("crop", "end");
expire.setAttribute("style", "width: var(--expireWidth)");
listitem.appendChild(expire);
gListBox.appendChild(listitem);
gRowToKey[index] = keyObj.keyId;
index++;
}
}
async function onLoad() {
const params = window.arguments[0];
if (!params) {
return;
}
gListBox = document.getElementById("infolist");
gViewButton = document.getElementById("detailsButton");
gAddr = params.email;
document.l10n.setAttributes(
document.getElementById("intro"),
"openpgp-intro",
{ key: gAddr }
);
await setListEntries(params.keys);
}
async function reloadAndSelect(selIndex = -1) {
while (true) {
const child = gListBox.lastChild;
// keep first child, which is the header
if (child == gListBox.firstChild) {
break;
}
gListBox.removeChild(child);
}
gRowToKey = [];
await setListEntries();
gListBox.selectedIndex = selIndex;
}
function onSelectionChange(event) {
const haveSelection = gListBox.selectedItems.length;
gViewButton.disabled = !haveSelection;
}
function viewSelectedKey() {
const selIndex = gListBox.selectedIndex;
if (gViewButton.disabled || selIndex == -1) {
return;
}
EnigmailWindows.openKeyDetails(window, gRowToKey[selIndex], false);
reloadAndSelect(selIndex);
}
async function discoverKey() {
const keyIds = gRowToKey;
const foundNewData = await KeyLookupHelper.fullOnlineDiscovery(
"interactive-import",
window,
gAddr,
keyIds
);
if (foundNewData) {
reloadAndSelect();
} else {
const value = await document.l10n.formatValue("no-key-found2");
EnigmailDialog.alert(window, value);
}
}

Просмотреть файл

@ -1,89 +0,0 @@
<?xml version="1.0"?>
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<window
data-l10n-id="openpgp-one-recipient-status-title"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
style="width: 50em; height: 22em"
persist="width height"
onload="onLoad();"
>
<dialog id="oneRecipientStatus" buttons="accept">
<script src="chrome://openpgp/content/ui/oneRecipientStatus.js" />
<linkset>
<html:link rel="stylesheet" href="chrome://global/skin/global.css" />
<html:link
rel="stylesheet"
href="chrome://messenger/skin/openpgp/openPgpComposeStatus.css"
/>
<html:link
rel="localization"
href="messenger/openpgp/oneRecipientStatus.ftl"
/>
<html:link rel="localization" href="messenger/openpgp/openpgp.ftl" />
</linkset>
<script>
<![CDATA[
function resizeColumns() {
let list = document.getElementById("infolist");
let cols = list.getElementsByTagName("treecol");
list.style.setProperty("--keyWidth", cols[0].getBoundingClientRect().width + "px");
list.style.setProperty("--statusWidth", cols[1].getBoundingClientRect().width + "px");
list.style.setProperty("--issuedWidth", cols[2].getBoundingClientRect().width + "px");
list.style.setProperty("--expireWidth", cols[3].getBoundingClientRect().width - 5 + "px");
}
addEventListener("load", resizeColumns, { once: true });
addEventListener("resize", resizeColumns);
]]>
</script>
<description data-l10n-id="openpgp-one-recipient-status-instruction1" />
<separator class="thin" />
<description data-l10n-id="openpgp-one-recipient-status-instruction2" />
<separator class="thin" />
<label id="intro" control="infolist" />
<richlistbox
id="infolist"
class="theme-listbox"
flex="1"
onselect="onSelectionChange(event);"
>
<treecols>
<treecol
id="recipientKeyIdCol"
data-l10n-id="openpgp-one-recipient-status-key-id"
/>
<treecol
id="recipientStatusCol"
data-l10n-id="openpgp-one-recipient-status-status"
/>
<treecol
style="flex: 1 auto"
data-l10n-id="openpgp-one-recipient-status-created-date"
/>
<treecol
style="flex: 1 auto"
data-l10n-id="openpgp-one-recipient-status-expires-date"
/>
</treecols>
</richlistbox>
<hbox pack="start">
<button
id="detailsButton"
disabled="true"
data-l10n-id="openpgp-one-recipient-status-open-details"
oncommand="viewSelectedKey();"
/>
<button
id="discoverButton"
data-l10n-id="openpgp-one-recipient-status-discover"
oncommand="discoverKey();"
/>
</hbox>
</dialog>
</window>

Просмотреть файл

@ -54,7 +54,6 @@ openpgp.jar:
content/openpgp/ui/backupKeyPassword.js (content/ui/backupKeyPassword.js)
content/openpgp/ui/changeExpiryDlg.js (content/ui/changeExpiryDlg.js)
content/openpgp/ui/commonWorkflows.js (content/ui/commonWorkflows.js)
content/openpgp/ui/composeKeyStatus.js (content/ui/composeKeyStatus.js)
content/openpgp/ui/confirmPubkeyImport.js (content/ui/confirmPubkeyImport.js)
content/openpgp/ui/enigmailCommon.js (content/ui/enigmailCommon.js)
content/openpgp/ui/enigmailKeyImportInfo.js (content/ui/enigmailKeyImportInfo.js)
@ -66,11 +65,9 @@ openpgp.jar:
content/openpgp/ui/keyAssistant.js (content/ui/keyAssistant.js)
content/openpgp/ui/keyDetailsDlg.js (content/ui/keyDetailsDlg.js)
content/openpgp/ui/keyWizard.js (content/ui/keyWizard.js)
content/openpgp/ui/oneRecipientStatus.js (content/ui/oneRecipientStatus.js)
content/openpgp/ui/attachmentItemContext.inc.xhtml (content/ui/attachmentItemContext.inc.xhtml)
content/openpgp/ui/backupKeyPassword.xhtml (content/ui/backupKeyPassword.xhtml)
content/openpgp/ui/changeExpiryDlg.xhtml (content/ui/changeExpiryDlg.xhtml)
content/openpgp/ui/composeKeyStatus.xhtml (content/ui/composeKeyStatus.xhtml)
content/openpgp/ui/confirmPubkeyImport.xhtml (content/ui/confirmPubkeyImport.xhtml)
content/openpgp/ui/enigmailKeyImportInfo.xhtml (content/ui/enigmailKeyImportInfo.xhtml)
content/openpgp/ui/enigmailKeyManager.xhtml (content/ui/enigmailKeyManager.xhtml)
@ -78,4 +75,3 @@ openpgp.jar:
content/openpgp/ui/keyAssistant.inc.xhtml (content/ui/keyAssistant.inc.xhtml)
content/openpgp/ui/keyDetailsDlg.xhtml (content/ui/keyDetailsDlg.xhtml)
content/openpgp/ui/keyWizard.xhtml (content/ui/keyWizard.xhtml)
content/openpgp/ui/oneRecipientStatus.xhtml (content/ui/oneRecipientStatus.xhtml)

Просмотреть файл

@ -2,20 +2,6 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
openpgp-compose-key-status-intro-need-keys = To send an end-to-end encrypted message, you must obtain and accept a public key for each recipient.
openpgp-compose-key-status-keys-heading = Availability of OpenPGP keys:
openpgp-compose-key-status-title =
.title = OpenPGP Message Security
openpgp-compose-key-status-recipient =
.label = Recipient
openpgp-compose-key-status-status =
.label = Status
openpgp-compose-key-status-open-details = Manage keys for selected recipient…
openpgp-recip-good = ok
openpgp-recip-missing = no key available
openpgp-recip-none-accepted = no accepted key
openpgp-compose-general-info-alias = { -brand-short-name} normally requires that the recipients public key contains a user ID with a matching email address. This can be overridden by using OpenPGP recipient alias rules.
openpgp-compose-general-info-alias-learn-more = Learn more
# Variables:
# $count (Number) - Number of alias keys for a recipient.
openpgp-compose-alias-status-direct = { $count ->

Просмотреть файл

@ -453,7 +453,6 @@
skin/classic/messenger/openpgp/keyWizard.css (../shared/openpgp/keyWizard.css)
skin/classic/messenger/openpgp/inlineNotification.css (../shared/openpgp/inlineNotification.css)
skin/classic/messenger/openpgp/openPgpComposeStatus.css (../shared/openpgp/openPgpComposeStatus.css)
skin/classic/messenger/smime/msgCompSecurityInfo.css (../shared/smime/msgCompSecurityInfo.css)
# Illustrations

Просмотреть файл

@ -1,25 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
@import url("chrome://messenger/skin/messenger.css");
treecolpicker {
display: none;
}
#recipientKeyIdCol {
flex: 3;
}
#recipientStatusCol {
flex: 4;
}
#recipientComposeKeyCol {
flex: 3;
}
#statusComposeKeyCol {
flex: 2;
}