diff options
author | Maximilian Krambach <[email protected]> | 2018-05-23 10:56:23 +0000 |
---|---|---|
committer | Maximilian Krambach <[email protected]> | 2018-05-23 10:56:23 +0000 |
commit | f7ed80ff6a66f2c5ee6f1c3daebd597f4592733d (patch) | |
tree | 3dc2b4dde55c14825b9dfa9db7ed225db77ab9d0 /lang/js/BrowserTestExtension | |
parent | js: transfer encoding changes (diff) | |
download | gpgme-f7ed80ff6a66f2c5ee6f1c3daebd597f4592733d.tar.gz gpgme-f7ed80ff6a66f2c5ee6f1c3daebd597f4592733d.zip |
js: remove openpgp mode
--
* After discussion, that mode is not required, and can result in
being quite misleading and a maintenance hassle later on.
Diffstat (limited to 'lang/js/BrowserTestExtension')
-rw-r--r-- | lang/js/BrowserTestExtension/index.html | 7 | ||||
-rw-r--r-- | lang/js/BrowserTestExtension/openpgpModeTest.html | 23 | ||||
-rw-r--r-- | lang/js/BrowserTestExtension/tests/inputValues_openpgpjs.js | 32 | ||||
-rw-r--r-- | lang/js/BrowserTestExtension/tests/openpgpModeTest.js | 169 | ||||
-rw-r--r-- | lang/js/BrowserTestExtension/tests/startup.js | 16 |
5 files changed, 0 insertions, 247 deletions
diff --git a/lang/js/BrowserTestExtension/index.html b/lang/js/BrowserTestExtension/index.html index c49aedae..05d413ba 100644 --- a/lang/js/BrowserTestExtension/index.html +++ b/lang/js/BrowserTestExtension/index.html @@ -34,13 +34,6 @@ Functionality tests with larger/longer running data sets. </a> </li> - <li> - <a href="openpgpModeTest.html"> - Testing openPGP mode. - </a> - Please notice that, due to comparing - the inputs and outputs with openpgpjs objects, this test - requires a copy of openpgpjs in libs. - </li> </ul> </p> </body> diff --git a/lang/js/BrowserTestExtension/openpgpModeTest.html b/lang/js/BrowserTestExtension/openpgpModeTest.html deleted file mode 100644 index e7a12be9..00000000 --- a/lang/js/BrowserTestExtension/openpgpModeTest.html +++ /dev/null @@ -1,23 +0,0 @@ -<!DOCTYPE html> -<html> - <head> - <meta charset="utf-8"> - <link href="libs/mocha.css" rel="stylesheet" /> - </head> -<body> - <h3>Openpgp mode test</h3> - <div id="mocha"></div> - <!-- load unit tests --> - <script src="libs/mocha.js"></script> - <script src="libs/chai.js"></script> - <script src="setup_testing.js"></script> - <script src="libs/gpgmejs.bundle.js"></script> - <script src="libs/openpgp.min.js"></script> - <script src="tests/inputvalues.js"></script> - <script src="tests/inputValues_openpgpjs.js"></script> -<!-- insert tests here--> - <script src="tests/openpgpModeTest.js"></script> -<!-- run tests --> - <script src="runbrowsertest.js"></script> - </body> -</html> diff --git a/lang/js/BrowserTestExtension/tests/inputValues_openpgpjs.js b/lang/js/BrowserTestExtension/tests/inputValues_openpgpjs.js deleted file mode 100644 index 945955be..00000000 --- a/lang/js/BrowserTestExtension/tests/inputValues_openpgpjs.js +++ /dev/null @@ -1,32 +0,0 @@ -const openpgpInputs = { - pubKeyArmored: '-----BEGIN PGP PUBLIC KEY BLOCK-----\n' - + '\n' - + 'mQENBFrsKEkBCADKw4Wt8J6M/88qD8PO6lSMCxH1cpwH8iK0uPaFFYsJkkXo7kWf\n' - + 'PTAtrV+REqF/o80dvYcdLvRsV21pvncZz/HXLu1yQ18mC3XObrKokbdgrTTKA5XE\n' - + 'BZkNsqyaMMJauT18H4hYkSg62/tTdO1cu/zWv/LFf7Xyn6+uA74ovXCJlO1s0N2c\n' - + 'PShtr98QRzPMf2owgVk37JnDNp4gGVDGHxSZOuUwxgYAZYnA8SFc+c+3ZrQfY870\n' - + '+O4j3Mz4p7yD13AwP4buQLBsb/icxekeQCqpRJhLH9f7MdEcGXa1x36RcEkHdu+M\n' - + 'yJ392eMgD+dKNfRCtyTPhjZTxvbNELIBYICfABEBAAG0EHRlc3RAZXhhbXBsZS5v\n' - + 'cmeJAVQEEwEIAD4WIQTUFzW5Ejb9uIIEjFojAWNe7/DLBQUCWuwoSQIbAwUJA8Jn\n' - + 'AAULCQgHAgYVCgkICwIEFgIDAQIeAQIXgAAKCRAjAWNe7/DLBf9kB/wOQ/S60HGw\n' - + 'Fq07W9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GRgnpI/OZZjnUuUfBUvMGHr1phW+y7aeymC9PnUGdViRdJe23nntMSD\n' - + 'A+0/I7ESO9JsWvJbyBmuiZpu9JjScOjYH9xpQLqRNyw4WHpZriN69F0t9Mmd7bM1\n' - + '+UyPgbPEr0iWMeyctYsuOLeUyQKMscDT\n' - + '=QyY6\n' - + '-----END PGP PUBLIC KEY BLOCK-----\n' -}; diff --git a/lang/js/BrowserTestExtension/tests/openpgpModeTest.js b/lang/js/BrowserTestExtension/tests/openpgpModeTest.js deleted file mode 100644 index cccaf604..00000000 --- a/lang/js/BrowserTestExtension/tests/openpgpModeTest.js +++ /dev/null @@ -1,169 +0,0 @@ -/* gpgme.js - Javascript integration for gpgme - * Copyright (C) 2018 Bundesamt für Sicherheit in der Informationstechnik - * - * This file is part of GPGME. - * - * GPGME is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * GPGME is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, see <http://www.gnu.org/licenses/>. - * SPDX-License-Identifier: LGPL-2.1+ - */ - -describe('Encrypting-Decrypting in openpgp mode, using a Message object', function () { - it('Simple Encrypt-Decrypt', function (done) { - let prm = Gpgmejs.init({api_style: 'gpgme_openpgpjs'}); - prm.then(function (context) { - context.encrypt({ - data: openpgp.message.fromText(inputvalues.encrypt.good.data), - publicKeys: inputvalues.encrypt.good.fingerprint} - ).then(function (answer) { - expect(answer).to.not.be.empty; - expect(answer).to.be.an("object"); - expect(answer.data).to.include('BEGIN PGP MESSAGE'); - expect(answer.data).to.include('END PGP MESSAGE'); - let msg = openpgp.message.fromText(answer.data); - context.decrypt({message:msg}).then(function (result) { - expect(result).to.not.be.empty; - expect(result.data).to.be.a('string'); - expect(result.data).to.equal(inputvalues.encrypt.good.data); - context._GpgME.connection.disconnect(); - done(); - }); - }); - }); - }); - it('Keys as Fingerprints', function(done){ - let prm = Gpgmejs.init({api_style: 'gpgme_openpgpjs'}); - let input = inputvalues.encrypt.good.data_nonascii; - prm.then(function (context) { - context.encrypt({ - data: input, - publicKeys: inputvalues.encrypt.good.fingerprint} - ).then(function (answer) { - expect(answer).to.not.be.empty; - expect(answer.data).to.be.a("string"); - expect(answer.data).to.include('BEGIN PGP MESSAGE'); - expect(answer.data).to.include('END PGP MESSAGE'); - context.decrypt({message:answer.data}).then(function (result) { - expect(result).to.not.be.empty; - expect(result.data).to.be.a('string'); - expect(result.data).to.equal(input); - context._GpgME.connection.disconnect(); - done(); - }); - }); - }); - }); - it('Keys as openpgp Keys', function(){ - let prm = Gpgmejs.init({api_style: 'gpgme_openpgpjs'}); - let data = inputvalues.encrypt.good.data_nonascii; - let key = openpgp.key.readArmored(openpgpInputs.pubKeyArmored); - expect(key).to.be.an('object'); - prm.then(function (context) { - context.encrypt({ - data: data, - publicKeys: [key]} - ).then( function (answer) { - expect(answer).to.not.be.empty; - expect(answer.data).to.be.a("string"); - expect(answer.data).to.include('BEGIN PGP MESSAGE'); - expect(answer.data).to.include('END PGP MESSAGE'); - context.decrypt({message:answer.data}).then( function (result){ - expect(result).to.not.be.empty; - expect(result.data).to.be.a('string'); - expect(result.data).to.equal(data); - context._GpgME.connection.disconnect(); - done(); - }); - }); - }); - }); - it('Trying to send non-implemented parameters: passwords', function(done){ - let prm = Gpgmejs.init({api_style: 'gpgme_openpgpjs'}); - let data = 'Hello World'; - let key = inputvalues.encrypt.good.fingerprint; - prm.then(function (context) { - context.encrypt({ - data: data, - publicKeys: [key], - passwords: 'My secret password'} - ).then( function(){}, - function(error){ - expect(error).to.be.an.instanceof(Error); - expect(error.code).equal('NOT_IMPLEMENTED'); - done(); - }); - }); - }); - it('Trying to send non-implemented parameters: signature', function(done){ - let prm = Gpgmejs.init({api_style: 'gpgme_openpgpjs'}); - let data = 'Hello World'; - let key = inputvalues.encrypt.good.fingerprint; - prm.then(function (context) { - context.encrypt({ - data: data, - publicKeys: [key], - signature: {any: 'value'} - }).then( - function(){}, - function(error){ - expect(error).to.be.an.instanceof(Error); - expect(error.code).equal('NOT_IMPLEMENTED'); - done(); - }); - }); - }); -}); - -describe('Keyring in openpgp mode', function(){ - it('Check Existence and structure of Keyring after init', function(done){ - let prm = Gpgmejs.init({api_style: 'gpgme_openpgpjs'}); - prm.then(function (context) { - expect(context.Keyring).to.be.an('object'); - expect(context.Keyring.getPublicKeys).to.be.a('function'); - expect(context.Keyring.deleteKey).to.be.a('function'); - expect(context.Keyring.getDefaultKey).to.be.a('function'); - done(); - }); - }); - // TODO: gpgme key interface not yet there -}); - -describe('Decrypting and verification in openpgp mode', function(){ - it('Decrypt', function(){ - let msg = openpgp.message.fromText(inputvalues.encryptedData); - let prm = Gpgmejs.init({api_style: 'gpgme_openpgpjs'}); - prm.then(function (context) { - context.decrypt({message: msg}) - .then(function(answer){ - expect(answer.data).to.be.a('string'); - expect(result.data).to.equal('¡Äußerste µ€ før ñoquis@hóme! Добрый день\n'); - done(); - }); - }); - }); - it('Decryption attempt with bad data returns gnupg error', function(done){ - let msg = openpgp.message.fromText(bigString(0.1)); - let prm = Gpgmejs.init({api_style: 'gpgme_openpgpjs'}); - prm.then(function (context) { - context.decrypt({message: msg}) - .then( function(){}, - function(error){ - expect(error).to.be.an.instanceof(Error); - expect(error.code).to.equal('GNUPG_ERROR'); - expect(error.message).to.be.a('string'); - // TBD: Type of error - done(); - }); - }); - }).timeout(4000); -}); diff --git a/lang/js/BrowserTestExtension/tests/startup.js b/lang/js/BrowserTestExtension/tests/startup.js index a5614a83..5de70a6b 100644 --- a/lang/js/BrowserTestExtension/tests/startup.js +++ b/lang/js/BrowserTestExtension/tests/startup.js @@ -36,22 +36,6 @@ }); }); }); -describe('openpgp mode', function(){ - it('startup of openpgp mode returns the correct parameters', function(done){ - let prm = Gpgmejs.init({api_style:"gpgme_openpgpjs"}); - prm.then(function(context){ - expect(context).to.be.an('object'); - expect(context.connection).to.be.undefined; - expect(context.Keyring).to.be.an('object'); - expect(context.encrypt).to.be.a('function'); - expect(context.decrypt).to.be.a('function'); - done(); - }, function(error){ - expect(error).to.be.undefined; - done(); - }); - }); -}); describe('GPGME does not start with invalid parameters', function(){ for (let i=0; i < inputvalues.init.invalid_startups.length; i++){ |