/usr/share/xul-ext/enigmail/modules/trust.jsm is in enigmail 2:1.9.9-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | /*global Components: false */
/*jshint -W097 */
/*
* 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/.
*/
"use strict";
var EXPORTED_SYMBOLS = ["EnigmailTrust"];
Components.utils.import("resource://enigmail/locale.jsm"); /*global EnigmailLocale: false */
// trust flags according to GPG documentation:
// - http://www.gnupg.org/documentation/manuals/gnupg.pdf
// - sources: doc/DETAILS
// In the order of trustworthy:
// ---------------------------------------------------------
// i = The key is invalid (e.g. due to a missing self-signature)
// n = The key is not valid / Never trust this key
// d/D = The key has been disabled
// r = The key has been revoked
// e = The key has expired
// g = group (???)
// ---------------------------------------------------------
// ? = INTERNAL VALUE to separate invalid from unknown keys
// see validKeysForAllRecipients() in enigmailMsgComposeHelper.js
// ---------------------------------------------------------
// o = Unknown (this key is new to the system)
// - = Unknown validity (i.e. no value assigned)
// q = Undefined validity (Not enough information for calculation)
// '-' and 'q' may safely be treated as the same value for most purposes
// ---------------------------------------------------------
// m = Marginally trusted
// ---------------------------------------------------------
// f = Fully trusted / valid key
// u = Ultimately trusted
// ---------------------------------------------------------
const TRUSTLEVELS_SORTED = "indDreg?o-qmfu";
const TRUSTLEVELS_SORTED_IDX_UNKNOWN = 7; // index of '?'
const EnigmailTrust = {
/**
* @return - |string| containing the order of trust/validity values
*/
trustLevelsSorted: function() {
return TRUSTLEVELS_SORTED;
},
/**
* @return - |boolean| whether the flag is invalid (neither unknown nor valid)
*/
isInvalid: function(flag) {
return TRUSTLEVELS_SORTED.indexOf(flag) < TRUSTLEVELS_SORTED_IDX_UNKNOWN;
},
/**
* return a merged value of trust level "key disabled"
*
* @keyObj - |object| containing the key data
*
* @return - |string| containing the trust value or "D" for disabled keys
*/
getTrustCode: function(keyObj) {
if (keyObj.keyUseFor.indexOf("D") >= 0) {
return "D";
}
else {
return keyObj.keyTrust;
}
},
getTrustLabel: function(trustCode) {
let keyTrust;
switch (trustCode) {
case 'q':
keyTrust = EnigmailLocale.getString("keyValid.unknown");
break;
case 'i':
keyTrust = EnigmailLocale.getString("keyValid.invalid");
break;
case 'd':
case 'D':
keyTrust = EnigmailLocale.getString("keyValid.disabled");
break;
case 'r':
keyTrust = EnigmailLocale.getString("keyValid.revoked");
break;
case 'e':
keyTrust = EnigmailLocale.getString("keyValid.expired");
break;
case 'n':
keyTrust = EnigmailLocale.getString("keyTrust.untrusted");
break;
case 'm':
keyTrust = EnigmailLocale.getString("keyTrust.marginal");
break;
case 'f':
keyTrust = EnigmailLocale.getString("keyTrust.full");
break;
case 'u':
keyTrust = EnigmailLocale.getString("keyTrust.ultimate");
break;
case 'g':
keyTrust = EnigmailLocale.getString("keyTrust.group");
break;
case '-':
keyTrust = "-";
break;
default:
keyTrust = "";
}
return keyTrust;
}
};
|