aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaximilian Krambach <[email protected]>2018-08-23 10:30:49 +0000
committerMaximilian Krambach <[email protected]>2018-08-23 10:30:49 +0000
commit352c53040d75e70dcda16c153d10c21e8eee0e01 (patch)
tree8b5c534abcdf52980f8c56cb21f8f583194ca99b
parentjs: use destructured option parameters (diff)
downloadgpgme-352c53040d75e70dcda16c153d10c21e8eee0e01.tar.gz
gpgme-352c53040d75e70dcda16c153d10c21e8eee0e01.zip
js: offer an always-trust parameter on encrypt
-- * src/gpgmejs.js: Setting the default to 'always trust' assumes that most api users will already have made their internal checks, but may not have the gnupg web-of-trust model implemented, thus trusting the key themselves, without gnupg having full or even any information. Still it should stay an option to have gnupg decide.
-rw-r--r--lang/js/src/gpgmejs.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/lang/js/src/gpgmejs.js b/lang/js/src/gpgmejs.js
index ffee719c..1a5d5574 100644
--- a/lang/js/src/gpgmejs.js
+++ b/lang/js/src/gpgmejs.js
@@ -128,6 +128,9 @@ export class GpgME {
* block.
* @param {Boolean} options.wildcard (optional) If true, recipient
* information will not be added to the message.
+ * @param {Boolean} always_trust (optional, default true) This assumes that
+ * used keys are fully trusted. If set to false, encryption to a key not
+ * fully trusted in gnupg will fail
* @param {Object} additional use additional valid gpg options as
* defined in {@link permittedOperations}
* @returns {Promise<encrypt_result>} Object containing the encrypted
@@ -135,7 +138,7 @@ export class GpgME {
* @async
*/
encrypt ({ data, publicKeys, secretKeys, base64 = false, armor = true,
- wildcard, additional = {} }){
+ wildcard, always_trust = true, additional = {} }){
if (!data || !publicKeys){
return Promise.reject(gpgme_error('MSG_INCOMPLETE'));
}
@@ -148,6 +151,9 @@ export class GpgME {
if (base64 === true) {
msg.setParameter('base64', true);
}
+ if (always_trust === true) {
+ msg.setParameter('always-trust', true);
+ }
let pubkeys = toKeyIdArray(publicKeys);
if (!pubkeys.length) {
return Promise.reject(gpgme_error('MSG_NO_KEYS'));