[git] GPGME - branch, javascript-binding, updated. gpgme-1.11.1-79-g4b343c4
[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 4b343c4e339862a5faf8dd20590a3c4592fb6abb (commit)
via 040b1ed40ada7c9ce095dec696406aea730e3766 (commit)
from a965e3e0b89521ad4f3898a8483161624c2e5848 (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 4b343c4e339862a5faf8dd20590a3c4592fb6abb
Author: Maximilian Krambach <[email protected]>
Date: Tue Jul 24 14:56:33 2018 +0200
js: include armored Key in import callback
--
* The import answer now also directly contains the armored Key as Key
property, without need to refresh the Key object created in the
answer. This allows for direct comparision of input and output.
* BrowserTestExtension: added test for that import callback
diff --git a/lang/js/BrowserTestExtension/tests/KeyImportExport.js b/lang/js/BrowserTestExtension/tests/KeyImportExport.js
index 4a53c7a..ed307b3 100644
--- a/lang/js/BrowserTestExtension/tests/KeyImportExport.js
+++ b/lang/js/BrowserTestExtension/tests/KeyImportExport.js
@@ -83,6 +83,32 @@ describe('Key importing', function () {
});
});
});
+
+ it('Import result feedback', function(done){
+ let prm = Gpgmejs.init();
+ prm.then(function (context) {
+ context.Keyring.getKeys(ImportablePublicKey.fingerprint).then(
+ function(result){
+ expect(result).to.be.an('array');
+ expect(result.length).to.equal(0);
+ context.Keyring.importKey(ImportablePublicKey.key, true)
+ .then(function(result){
+ expect(result).to.be.an('object');
+ expect(result.Keys[0]).to.be.an('object');
+ expect(result.Keys[0].key.fingerprint).to.equal(
+ ImportablePublicKey.fingerprint);
+ expect(result.Keys[0].status).to.equal('newkey');
+ result.Keys[0].key.getArmor().then(function(armor){
+ expect(armor).to.be.a('string');
+ result.Keys[0].key.delete().then(function(){
+ done();
+ });
+ });
+ });
+ });
+ });
+ });
+
it('exporting armored Key with getKeysArmored', function (done) {
let prm = Gpgmejs.init();
const fpr = inputvalues.encrypt.good.fingerprint;
diff --git a/lang/js/src/Key.js b/lang/js/src/Key.js
index 30f507c..b024a77 100644
--- a/lang/js/src/Key.js
+++ b/lang/js/src/Key.js
@@ -141,7 +141,7 @@ export class GPGME_Key {
* during a session. The key still can be reloaded by invoking
* {@link refreshKey}.
* @returns {*|Promise<*>} the value (Boolean, String, Array, Object).
- * If 'cached' is true, the value will be resolved as a Promise.
+ * If 'cached' is false, the value will be resolved as a Promise.
*/
get(property, cached=true) {
if (cached === false) {
@@ -194,8 +194,11 @@ export class GPGME_Key {
if (result.keys.length === 1){
me.setKeyData(result.keys[0]);
me.getHasSecret().then(function(){
- //TODO retrieve armored Key
- resolve(me);
+ me.getArmor().then(function(){
+ resolve(me);
+ }, function(error){
+ reject(error);
+ });
}, function(error){
reject(error);
});
commit 040b1ed40ada7c9ce095dec696406aea730e3766
Author: Maximilian Krambach <[email protected]>
Date: Tue Jul 24 14:50:54 2018 +0200
js: Fix wrong encoding in received error messages
--
* The libgpg error strings arrive in the browser in a different
encoding than used by browsers. Escaping and then decoding it
should cover most languages in the supported browsers.
diff --git a/lang/js/src/Connection.js b/lang/js/src/Connection.js
index ef54dd6..d89fa72 100644
--- a/lang/js/src/Connection.js
+++ b/lang/js/src/Connection.js
@@ -240,7 +240,8 @@ class Answer{
switch (key) {
case 'type':
if (_decodedResponse.type === 'error'){
- return (gpgme_error('GNUPG_ERROR', _decodedResponse.msg));
+ return (gpgme_error('GNUPG_ERROR',
+ decodeURIComponent(escape(_decodedResponse.msg))));
} else if (poa.type.indexOf(_decodedResponse.type) < 0){
return gpgme_error('CONN_UNEXPECTED_ANSWER');
}
-----------------------------------------------------------------------
Summary of changes:
.../BrowserTestExtension/tests/KeyImportExport.js | 26 ++++++++++++++++++++++
lang/js/src/Connection.js | 3 ++-
lang/js/src/Key.js | 9 +++++---
3 files changed, 34 insertions(+), 4 deletions(-)
hooks/post-receive
--
GnuPG Made Easy
http://git.gnupg.org