[git] GPGME - branch, javascript-binding, updated. gpgme-1.11.1-106-g8b8c009

by Maximilian Krambach cvs at cvs.gnupg.org
Tue Aug 21 11:42:55 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  8b8c009dee8ae5493e7f888ee518468dbfcf5375 (commit)
      from  d77a1c887d6a5e892329534c94f95eaf8bb88492 (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 8b8c009dee8ae5493e7f888ee518468dbfcf5375
Author: Maximilian Krambach <maximilian.krambach at intevation.de>
Date:   Tue Aug 21 11:42:11 2018 +0200

    js: set expiry of generatedKey to seconds from now
    
    --
    
    * src/Keyring.js: Changed key ecpiration from Date to seconds from
      creation, as in gpgme. The Date parameter used before was due to a
      misunderstanding in documentation and requests from potential users.

diff --git a/lang/js/src/Keyring.js b/lang/js/src/Keyring.js
index 81a047c..ab0144e 100644
--- a/lang/js/src/Keyring.js
+++ b/lang/js/src/Keyring.js
@@ -367,8 +367,8 @@ export class GPGME_Keyring {
      * @param {String} algo (optional) algorithm (and optionally key size)
      * to be used. See {@link supportedKeyAlgos} below for supported
      * values. If ommitted, 'default' is used.
-     * @param {Date} expires (optional) Expiration date. If not set,
-     * expiration will be set to 'never'
+     * @param {Number} expires (optional) Expiration time in seconds from now.
+     * If not set or set to 0, expiration will be 'never'
      * @param {String} subkey_algo (optional) algorithm of the encryption
      * subkey. If ommited the same as algo is used.
      *
@@ -380,7 +380,7 @@ export class GPGME_Keyring {
             typeof (userId) !== 'string' ||
             // eslint-disable-next-line no-use-before-define
             supportedKeyAlgos.indexOf(algo) < 0 ||
-            (expires && !(expires instanceof Date))
+            (expires && !( Number.isInteger(expires) || expires < 0 ))
         ){
             return Promise.reject(gpgme_error('PARAM_WRONG'));
         }
@@ -397,9 +397,7 @@ export class GPGME_Keyring {
                 msg.setParameter('subkey-algo', subkey_algo );
             }
             if (expires){
-                const now = new Date();
-                msg.setParameter('expires',
-                    Math.floor((expires - now) /1000));
+                msg.setParameter('expires', expires);
             } else {
                 msg.setParameter('expires', 0);
             }

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

Summary of changes:
 lang/js/src/Keyring.js | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)


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




More information about the Gnupg-commits mailing list