[git] GPGME - branch, javascript-binding, updated. gpgme-1.11.1-62-g3cd428b

by Maximilian Krambach cvs at cvs.gnupg.org
Thu Jun 14 14:50:21 CEST 2018


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  3cd428ba442f43e470b977e27e18ff52567baba5 (commit)
      from  3c783bd09ce54b0d50dc3bea201e70e4fcbbf6a3 (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 3cd428ba442f43e470b977e27e18ff52567baba5
Author: Maximilian Krambach <maximilian.krambach at intevation.de>
Date:   Thu Jun 14 14:50:25 2018 +0200

    js: import result feedback
    
    --
    
    * src/Keyring.js: Changed and documented the import result feedback
      towards the javascript side

diff --git a/lang/js/src/Keyring.js b/lang/js/src/Keyring.js
index 451f936..43d257d 100644
--- a/lang/js/src/Keyring.js
+++ b/lang/js/src/Keyring.js
@@ -155,26 +155,36 @@ export class GPGME_Keyring {
 
     /**
      *
-     * @param {String} armored Armored Key block of the Kex(s) to be imported
+     * @param {String} armored Armored Key block of the Key(s) to be imported
      * into gnupg
      * @param {Boolean} prepare_sync prepare the keys for synched use
      * (see getKeys()).
-     * @returns {Promise<Array<Object>>} An array of objects for the Keys
-     * considered:
-    *       Key.key <Object>: The key itself as a GPGME_Key
-     *      Key.status <String>:
-     *          'nochange' if the Key was not changed,
-     *          'newkey' if the Key was imported in gpg, and did not exist
-     *              previously,
-     *          'change' if the key existed, but details were updated. For
-     *              details, Key.changes is available.
-     *          Key.changes.userId: <Boolean> userIds changed
-     *          Key.changes.signature: <Boolean> signatures changed
-     *          Key.changes.subkey: <Boolean> subkeys changed
-     * // TODO: not yet implemented: Information about Keys that failed
-     *          (e.g. malformed Keys, secretKeys are not accepted)
+     *
+     * @returns {Promise<Object>} result: A summary and an array of Keys
+     * considered
+     *
+     * @returns result.summary: Numerical summary of the result. See the
+     * feedbackValues variable for available values and the gnupg documentation
+     * https://www.gnupg.org/documentation/manuals/gpgme/Importing-Keys.html
+     * for details on their meaning.
+     * @returns {Array<Object>} result.Keys: Array of objects containing:
+     * @returns {GPGME_Key} Key.key The resulting key
+     * @returns {String} Key.status:
+     *      'nochange' if the Key was not changed,
+     *      'newkey' if the Key was imported in gpg, and did not exist
+     *         previously,
+     *      'change' if the key existed, but details were updated. For
+     *         details, Key.changes is available.
+     * @returns {Boolean} Key.changes.userId: userIds changed
+     * @returns {Boolean} Key.changes.signature: signatures changed
+     * @returns {Boolean} Key.changes.subkey: subkeys changed
      */
     importKey(armored, prepare_sync) {
+        let feedbackValues = ['considered', 'no_user_id', 'imported',
+            'imported_rsa', 'unchanged', 'new_user_ids', 'new_sub_keys',
+            'new_signatures', 'new_revocations', 'secret_read',
+            'secret_imported', 'secret_unchanged', 'skipped_new_keys',
+            'not_imported', 'skipped_v3_keys'];
         if (!armored || typeof(armored) !== 'string'){
             return Promise.reject(gpgme_error('PARAM_WRONG'));
         }
@@ -185,8 +195,8 @@ export class GPGME_Keyring {
             msg.post().then(function(response){
                 let infos = {};
                 let fprs = [];
-                for (let res=0; res < response.result[0].imports.length; res++){
-                    let result = response.result[0].imports[res];
+                for (let res=0; res<response.result.imports.length; res++){
+                    let result = response.result.imports[res];
                     let status = '';
                     if (result.status === 0){
                         status = 'nochange';
@@ -217,7 +227,15 @@ export class GPGME_Keyring {
                                 status: infos[result[i].fingerprint].status
                             });
                         }
-                        resolve(resultset);
+                        let summary = {};
+                        for (let i=0; i < feedbackValues.length; i++ ){
+                            summary[feedbackValues[i]] =
+                                response[feedbackValues[i]];
+                        }
+                        resolve({
+                            Keys:resultset,
+                            summary: summary
+                        });
                     }, function(error){
                         reject(error);
                     });

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

Summary of changes:
 lang/js/src/Keyring.js | 54 +++++++++++++++++++++++++++++++++-----------------
 1 file changed, 36 insertions(+), 18 deletions(-)


hooks/post-receive
-- 
GnuPG Made Easy
http://git.gnupg.org




More information about the Gnupg-commits mailing list