aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Brunschwig <[email protected]>2022-03-20 17:18:18 +0100
committerPatrick Brunschwig <[email protected]>2022-03-20 17:18:18 +0100
commit9d87457a7420b93dddfb9be6c902490db02c94df (patch)
tree0ce34d04b42a467c021875775c87772594d3ef17
parentcd1afdba10a4a2514cf14b2fdedd0f40d7375429 (diff)
downloadenigmail-9d87457a7420b93dddfb9be6c902490db02c94df.tar.gz
enigmail-9d87457a7420b93dddfb9be6c902490db02c94df.tar.bz2
enigmail-9d87457a7420b93dddfb9be6c902490db02c94df.zip
don't try to set ownertrust for OpenPGP.js API
-rw-r--r--package/autocrypt.jsm42
1 files changed, 23 insertions, 19 deletions
diff --git a/package/autocrypt.jsm b/package/autocrypt.jsm
index b590c251..77a68065 100644
--- a/package/autocrypt.jsm
+++ b/package/autocrypt.jsm
@@ -603,7 +603,7 @@ var EnigmailAutocrypt = {
return new Promise((resolve, reject) => {
let start = {},
end = {};
- let msgType = EnigmailArmor.locateArmoredBlock(attachmentData, 0, "", start, end, {});
+ EnigmailArmor.locateArmoredBlock(attachmentData, 0, "", start, end, {});
openPGPjs.message.readArmored(attachmentData.substring(start.value, end.value)).then(encMessage => {
let enc = {
@@ -614,28 +614,32 @@ var EnigmailAutocrypt = {
return openPGPjs.decrypt(enc);
})
- .then(msg => {
+ .then(async function _f(msg) {
EnigmailLog.DEBUG("autocrypt.jsm: handleBackupMessage: data: " + msg.data.length + "\n");
let setupData = importSetupKey(msg.data);
if (setupData) {
- keyManagement.setKeyTrust(null, "0x" + setupData.fpr, "5")
- .then(resultObj => {
- if (resultObj.returnCode === 0) {
- let id = EnigmailStdlib.getIdentityForEmail(EnigmailFuncs.stripEmail(fromAddr).toLowerCase());
- let ac = EnigmailFuncs.getAccountForIdentity(id.identity);
- ac.incomingServer.setBoolValue("enableAutocrypt", true);
- ac.incomingServer.setIntValue("acPreferEncrypt", (setupData.preferEncrypt === "mutual" ? 1 : 0));
- id.identity.setCharAttribute("pgpkeyId", "0x" + setupData.fpr);
- id.identity.setBoolAttribute("enablePgp", true);
- id.identity.setBoolAttribute("pgpSignEncrypted", true);
- id.identity.setIntAttribute("pgpKeyMode", 1);
- resolve(setupData);
- }
- else {
- reject("keyImportFailed");
- }
- });
+ let resultObj = {
+ returnCode: 0
+ };
+
+ if (cApi.supportsFeature("ownertrust")) {
+ resultObj = await keyManagement.setKeyTrust(null, "0x" + setupData.fpr, "5");
+ }
+ if (resultObj.returnCode === 0) {
+ let id = EnigmailStdlib.getIdentityForEmail(EnigmailFuncs.stripEmail(fromAddr).toLowerCase());
+ let ac = EnigmailFuncs.getAccountForIdentity(id.identity);
+ ac.incomingServer.setBoolValue("enableAutocrypt", true);
+ ac.incomingServer.setIntValue("acPreferEncrypt", (setupData.preferEncrypt === "mutual" ? 1 : 0));
+ id.identity.setCharAttribute("pgpkeyId", "0x" + setupData.fpr);
+ id.identity.setBoolAttribute("enablePgp", true);
+ id.identity.setBoolAttribute("pgpSignEncrypted", true);
+ id.identity.setIntAttribute("pgpKeyMode", 1);
+ resolve(setupData);
+ }
+ else {
+ reject("keyImportFailed");
+ }
}
else {
reject("keyImportFailed");