[git] GPGME - branch, javascript-binding, updated. gpgme-1.11.1-105-gd77a1c8

[email protected] (by Maximilian Krambach)
Newsgroups gmane.comp.encryption.gpg.cvs
Message-ID <[email protected]>
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GnuPG Made Easy".

The branch, javascript-binding has been updated
       via  d77a1c887d6a5e892329534c94f95eaf8bb88492 (commit)
      from  91c2362550f787cc28d764c0e571e911c740f74f (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit d77a1c887d6a5e892329534c94f95eaf8bb88492
Author: Maximilian Krambach <[email protected]>
Date:   Mon Aug 20 18:05:34 2018 +0200

    js: add option "subkey-algo" to generateKey
    
    --
    
    * The option was recently added to gpgme-json; this reflects this on
      javascript side

diff --git a/lang/js/src/Keyring.js b/lang/js/src/Keyring.js
index 7d9b370..81a047c 100644
--- a/lang/js/src/Keyring.js
+++ b/lang/js/src/Keyring.js
@@ -366,14 +366,16 @@ export class GPGME_Keyring {
      * @param {String} userId The user Id, e.g. 'Foo Bar <[email protected]>'
      * @param {String} algo (optional) algorithm (and optionally key size)
      * to be used. See {@link supportedKeyAlgos} below for supported
-     * values.
+     * values. If ommitted, 'default' is used.
      * @param {Date} expires (optional) Expiration date. If not set,
      * expiration will be set to 'never'
+     * @param {String} subkey_algo (optional) algorithm of the encryption
+     * subkey. If ommited the same as algo is used.
      *
      * @return {Promise<Key|GPGME_Error>}
      * @async
      */
-    generateKey (userId, algo = 'default', expires){
+    generateKey (userId, algo = 'default', expires, subkey_algo){
         if (
             typeof (userId) !== 'string' ||
             // eslint-disable-next-line no-use-before-define
@@ -382,11 +384,18 @@ export class GPGME_Keyring {
         ){
             return Promise.reject(gpgme_error('PARAM_WRONG'));
         }
+        // eslint-disable-next-line no-use-before-define
+        if (subkey_algo && supportedKeyAlgos.indexOf(subkey_algo) < 0 ){
+            return Promise.reject(gpgme_error('PARAM_WRONG'));
+        }
         let me = this;
         return new Promise(function (resolve, reject){
             let msg = createMessage('createkey');
             msg.setParameter('userid', userId);
             msg.setParameter('algo', algo );
+            if (subkey_algo) {
+                msg.setParameter('subkey-algo', subkey_algo );
+            }
             if (expires){
                 const now = new Date();
                 msg.setParameter('expires',
diff --git a/lang/js/src/permittedOperations.js b/lang/js/src/permittedOperations.js
index 48ff7fa..3142725 100644
--- a/lang/js/src/permittedOperations.js
+++ b/lang/js/src/permittedOperations.js
@@ -331,6 +331,9 @@ export const permittedOperations = {
             algo: {
                 allowed: ['string']
             },
+            'subkey-algo': {
+                allowed: ['string']
+            },
             expires: {
                 allowed: ['number'],
             }

-----------------------------------------------------------------------

Summary of changes:
 lang/js/src/Keyring.js             | 13 +++++++++++--
 lang/js/src/permittedOperations.js |  3 +++
 2 files changed, 14 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
GnuPG Made Easy
http://git.gnupg.org
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.