[git] GPGME - branch, javascript-binding, updated. gpgme-1.11.1-84-g9d247b7

[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  9d247b7fd5edd11fb5710a057baec671276f5034 (commit)
      from  e16a87e83910ebb6bfdc4148369165f121f0997e (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 9d247b7fd5edd11fb5710a057baec671276f5034
Author: Maximilian Krambach <[email protected]>
Date:   Tue Jul 31 16:54:43 2018 +0200

    js: Fix Key.hasSecret answer
    
    --
    
    * The comparision result between Keyring and Keyring with secrets was
      set to the wrong Object which was not returned at all.

diff --git a/lang/js/src/Key.js b/lang/js/src/Key.js
index f431a28..88c49d3 100644
--- a/lang/js/src/Key.js
+++ b/lang/js/src/Key.js
@@ -74,7 +74,7 @@ export class GPGME_Key {
          * @returns {Boolean} If the Key has a secret subkey.
          */
         this.hasSecret= function (){
-            return this.get('hasSecret', true);
+            return this.get('hasSecret');
         };
 
         /**
diff --git a/lang/js/src/Keyring.js b/lang/js/src/Keyring.js
index 31c4f92..8715a47 100644
--- a/lang/js/src/Keyring.js
+++ b/lang/js/src/Keyring.js
@@ -46,7 +46,7 @@ export class GPGME_Keyring {
          * resort to a refresh() first.
          * @param {Boolean} search (optional) retrieve Keys from external
          * servers with the method(s) defined in gnupg (e.g. WKD/HKP lookup)
-         * @returns {Promise.<Array<GPGME_Key>|GPGME_Error>}
+         * @returns {Promise<Array<GPGME_Key>>}
          * @static
          * @async
          */
@@ -79,9 +79,9 @@ export class GPGME_Keyring {
                             };
                         }
                         secondrequest().then(function(answer) {
-                            for (let i=0; i < result.keys.length; i++){
+                            for (let i=0; i < answer.keys.length; i++){
                                 if (prepare_sync === true){
-                                    result.keys[i].hasSecret = false;
+                                    result.keys[i].hasSecret = undefined;
                                     if (answer && answer.keys) {
                                         for (let j=0;
                                             j < answer.keys.length; j++ ){
@@ -91,7 +91,9 @@ export class GPGME_Keyring {
                                                 a.fingerprint === b.fingerprint
                                             ) {
                                                 if (a.secret === true){
-                                                    a.hasSecret = true;
+                                                    b.hasSecret = true;
+                                                } else {
+                                                    b.hasSecret = false;
                                                 }
                                                 break;
                                             }

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

Summary of changes:
 lang/js/src/Key.js     |  2 +-
 lang/js/src/Keyring.js | 10 ++++++----
 2 files changed, 7 insertions(+), 5 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.