diff options
author | Maximilian Krambach <[email protected]> | 2018-06-19 07:26:01 +0000 |
---|---|---|
committer | Maximilian Krambach <[email protected]> | 2018-06-19 07:26:01 +0000 |
commit | 780f7880c6598d4532354b348d7bd74026d162f4 (patch) | |
tree | 56ce4465927e76a7e0eb9bd0653973b11315c374 /lang/js/src/Keyring.js | |
parent | js: import result feedback (diff) | |
download | gpgme-780f7880c6598d4532354b348d7bd74026d162f4.tar.gz gpgme-780f7880c6598d4532354b348d7bd74026d162f4.zip |
js: getDefaultKey and GenerateKey improvements
--
* src/Keyring.js: added more options for key generation.
* src/Key.js: GetDefaultKey now relies on the info associated with the
key, as the approach of relying on a secret subkey did not work as
intended
* DemoExtension: Added a button for retrieval of the subkey, to test
this functionality.
Diffstat (limited to '')
-rw-r--r-- | lang/js/src/Keyring.js | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/lang/js/src/Keyring.js b/lang/js/src/Keyring.js index 43d257d2..8bec1cea 100644 --- a/lang/js/src/Keyring.js +++ b/lang/js/src/Keyring.js @@ -273,21 +273,18 @@ export class GPGME_Keyring { * Keys can not be _deleted_ from inside gpgmejs. * * @param {String} userId The user Id, e.g. "Foo Bar <[email protected]>" - * @param {*} algo (optional) algorithm to be used. See - * {@link supportedKeyAlgos } below for supported values. - * @param {Number} keyLength (optional) TODO + * @param {*} algo (optional) algorithm (and optionally key size to be + * used. See {@link supportedKeyAlgos } below for supported values. * @param {Date} expires (optional) Expiration date. If not set, expiration * will be set to 'never' * * @returns{Promise<Key>} */ - generateKey(userId, algo = 'default', keyLength, expires){ + generateKey(userId, algo = 'default', expires){ if ( typeof(userId) !== 'string' || supportedKeyAlgos.indexOf(algo) < 0 || (expires && !(expires instanceof Date)) - // TODO keylength - // TODO check for completeness of algos ){ return Promise.reject(gpgme_error('PARAM_WRONG')); } @@ -295,12 +292,11 @@ export class GPGME_Keyring { return new Promise(function(resolve, reject){ let msg = createMessage('createkey'); msg.setParameter('userid', userId); - msg.setParameter('algo', algo); + msg.setParameter('algo', algo ); if (expires){ msg.setParameter('expires', Math.floor(expires.valueOf()/1000)); } - // TODO append keylength to algo msg.post().then(function(response){ me.getKeys(response.fingerprint, true).then( // TODO make prepare_sync (second parameter) optional here. @@ -321,9 +317,11 @@ export class GPGME_Keyring { */ const supportedKeyAlgos = [ 'default', - 'rsa', - 'dsa', - 'elg', + 'rsa', 'rsa2048', 'rsa3072', 'rsa4096', + 'dsa', 'dsa2048', 'dsa3072', 'dsa4096', + 'elg', 'elg2048', 'elg3072', 'elg4096', 'ed25519', - 'cv25519' + 'cv25519', + 'brainpoolP256r1', 'brainpoolP384r1', 'brainpoolP512r1', + 'NIST P-256', 'NIST P-384', 'NIST P-521' ];
\ No newline at end of file |