diff options
author | Maximilian Krambach <[email protected]> | 2018-08-17 12:40:27 +0000 |
---|---|---|
committer | Maximilian Krambach <[email protected]> | 2018-08-17 12:40:27 +0000 |
commit | 754e799d35fd62d7a979452f44342934659908c7 (patch) | |
tree | 4c16eea728543c50fd747220c755c4e980885d21 /lang/js/src/Keyring.js | |
parent | js: importKey feedback refactor (diff) | |
download | gpgme-754e799d35fd62d7a979452f44342934659908c7.tar.gz gpgme-754e799d35fd62d7a979452f44342934659908c7.zip |
js: disallow bulk set data on key from outside
--
* src/Key.js Key class is not exported anymore, as it should not be
used directly anywhere. setKeyData is no more a method of the Key,
(optional) data are now validated and set on Key creation and on
updates, both from within this module, thus no longer exposing
setKeyData to the outside.
* createKey now gained an optional parameter which allows to set Key
data at this point.
Diffstat (limited to 'lang/js/src/Keyring.js')
-rw-r--r-- | lang/js/src/Keyring.js | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lang/js/src/Keyring.js b/lang/js/src/Keyring.js index a6787986..43ab96c8 100644 --- a/lang/js/src/Keyring.js +++ b/lang/js/src/Keyring.js @@ -100,8 +100,8 @@ export class GPGME_Keyring { // TODO getArmor() to be used in sync } } - let k = createKey(result.keys[i].fingerprint); - k.setKeyData(result.keys[i]); + let k = createKey(result.keys[i].fingerprint, + !prepare_sync, result.keys[i]); resultset.push(k); } resolve(resultset); @@ -170,7 +170,7 @@ export class GPGME_Keyring { * @async * @static */ - this.getDefaultKey = function() { + this.getDefaultKey = function(prepare_sync = false) { let me = this; return new Promise(function(resolve, reject){ let msg = createMessage('config_opt'); @@ -202,8 +202,9 @@ export class GPGME_Keyring { for (let i=0; i< result.keys.length; i++ ) { if (result.keys[i].invalid === false) { let k = createKey( - result.keys[i].fingerprint); - k.setKeyData(result.keys[i]); + result.keys[i].fingerprint, + !prepare_sync, + result.keys[i]); resolve(k); break; } else if (i === result.keys.length - 1){ |