aboutsummaryrefslogtreecommitdiffstats
path: root/lang/js/BrowserTestExtension/tests/KeyImportExport.js
diff options
context:
space:
mode:
authorMaximilian Krambach <[email protected]>2018-07-12 09:36:55 +0000
committerMaximilian Krambach <[email protected]>2018-07-12 09:36:55 +0000
commit30bb5490466119b66eeac255d71fb7bdc79149fa (patch)
tree46b6a9ed771ecee047db0daca1070db3f996594f /lang/js/BrowserTestExtension/tests/KeyImportExport.js
parentjs: documentation (diff)
downloadgpgme-30bb5490466119b66eeac255d71fb7bdc79149fa.tar.gz
gpgme-30bb5490466119b66eeac255d71fb7bdc79149fa.zip
js: add with-sec-fprs to getKeysArmored
-- * Reflects the changes made to gpgme-json in commit 6cc842c9aa76d19448141e5117ac59452d7a1ff3. - getKeysArmored now returns an object with property 'armored' being the exported armored block, and an (optional) array of fingerprint strings for those keys that can be used in sign/encrypt operations as property 'secret_fprs'. With this, extensions such as mailvelope will be able to bulk fetch all necessary key information in one request.
Diffstat (limited to 'lang/js/BrowserTestExtension/tests/KeyImportExport.js')
-rw-r--r--lang/js/BrowserTestExtension/tests/KeyImportExport.js29
1 files changed, 27 insertions, 2 deletions
diff --git a/lang/js/BrowserTestExtension/tests/KeyImportExport.js b/lang/js/BrowserTestExtension/tests/KeyImportExport.js
index 33e6bd29..4a53c7a6 100644
--- a/lang/js/BrowserTestExtension/tests/KeyImportExport.js
+++ b/lang/js/BrowserTestExtension/tests/KeyImportExport.js
@@ -22,7 +22,7 @@
* Raimund Renkert <[email protected]>
*/
-/* global describe, it, expect, Gpgmejs, ImportablePublicKey */
+/* global describe, it, expect, Gpgmejs, ImportablePublicKey, inputvalues */
describe('Key importing', function () {
it('Prepare test Key (deleting it from gnupg, if present)', function(done){
@@ -83,5 +83,30 @@ describe('Key importing', function () {
});
});
});
-
+ it('exporting armored Key with getKeysArmored', function (done) {
+ let prm = Gpgmejs.init();
+ const fpr = inputvalues.encrypt.good.fingerprint;
+ prm.then(function (context) {
+ context.Keyring.getKeysArmored(fpr).then(function(result){
+ expect(result).to.be.an('object');
+ expect(result.armored).to.be.a('string');
+ expect(result.secret_fprs).to.be.undefined;
+ done();
+ });
+ });
+ });
+ it('exporting armored Key (including secret fingerprints) with '
+ + 'getKeysArmored', function (done) {
+ let prm = Gpgmejs.init();
+ const fpr = inputvalues.encrypt.good.fingerprint;
+ prm.then(function (context) {
+ context.Keyring.getKeysArmored(fpr, true).then(function(result){
+ expect(result).to.be.an('object');
+ expect(result.armored).to.be.a('string');
+ expect(result.secret_fprs).to.be.an('array');
+ expect(result.secret_fprs[0]).to.equal(fpr);
+ done();
+ });
+ });
+ });
}); \ No newline at end of file