diff options
author | Maximilian Krambach <[email protected]> | 2018-04-23 17:15:40 +0000 |
---|---|---|
committer | Maximilian Krambach <[email protected]> | 2018-04-23 17:15:40 +0000 |
commit | 727340b295f25e04cb595022ba143cda48364697 (patch) | |
tree | 81d54f26c2dfcdd324382119486b6681a529aed2 /lang/js/src/gpgmejs.js | |
parent | js: Key handling stubs, Error handling, refactoring (diff) | |
download | gpgme-727340b295f25e04cb595022ba143cda48364697.tar.gz gpgme-727340b295f25e04cb595022ba143cda48364697.zip |
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.
Diffstat (limited to 'lang/js/src/gpgmejs.js')
-rw-r--r-- | lang/js/src/gpgmejs.js | 9 |
1 files changed, 3 insertions, 6 deletions
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'); |