From 727340b295f25e04cb595022ba143cda48364697 Mon Sep 17 00:00:00 2001 From: Maximilian Krambach Date: Mon, 23 Apr 2018 19:15:40 +0200 Subject: js: don't allow message operation changes -- Once an operation is changed, their set of allowed/required parameters will change. So we shouldn't set/change the operation later. --- lang/js/src/gpgmejs.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'lang/js/src/gpgmejs.js') diff --git a/lang/js/src/gpgmejs.js b/lang/js/src/gpgmejs.js index c23a356b..b15477f0 100644 --- a/lang/js/src/gpgmejs.js +++ b/lang/js/src/gpgmejs.js @@ -76,8 +76,7 @@ export class GpgME { */ encrypt (data, publicKeys, wildcard=false){ - let msg = new GPGME_Message; - msg.operation = 'encrypt'; + let msg = new GPGME_Message('encrypt'); // TODO temporary msg.setParameter('armor', true); @@ -108,8 +107,7 @@ export class GpgME { if (data === undefined){ return Promise.reject(new GPGMEJS_Error ('EMPTY_MSG')); } - let msg = new GPGME_Message; - msg.operation = 'decrypt'; + let msg = new GPGME_Message('decrypt'); putData(msg, data); return this._connection.post(msg); @@ -117,8 +115,7 @@ export class GpgME { deleteKey(key, delete_secret = false, no_confirm = false){ return Promise.reject(new GPGMEJS_Error ('NOT_YET_IMPLEMENTED')); - let msg = new GPGME_Message; - msg.operation = 'deletekey'; + let msg = new GPGME_Message('deletekey'); let key_arr = toKeyIdArray(key); if (key_arr.length !== 1){ throw('TODO'); -- cgit v1.2.3