diff options
author | Maximilian Krambach <[email protected]> | 2018-08-22 16:37:46 +0000 |
---|---|---|
committer | Maximilian Krambach <[email protected]> | 2018-08-22 16:37:46 +0000 |
commit | f0409bbdafcbd4f8b0be099a6b3ce0d5352c9bcd (patch) | |
tree | fc94d23b0abef3c9e7c73d8a0165262f16e575e7 /lang/js/DemoExtension/maindemo.js | |
parent | js: improve decryption performance (diff) | |
download | gpgme-f0409bbdafcbd4f8b0be099a6b3ce0d5352c9bcd.tar.gz gpgme-f0409bbdafcbd4f8b0be099a6b3ce0d5352c9bcd.zip |
js: make method parameters objects
--
* As requested by using parties, the options to be passed into the
methods are now objects, with the objects' properties better
describing what they do, and to avoid the need to type several nulls
in a method call if one wants the last parameter.
- src/Keyring.js, src/gpgme.js: Changed parameters and their
validations
- BrowserTest/*.js Had to adapt quite some calls to the new format
Diffstat (limited to 'lang/js/DemoExtension/maindemo.js')
-rw-r--r-- | lang/js/DemoExtension/maindemo.js | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/lang/js/DemoExtension/maindemo.js b/lang/js/DemoExtension/maindemo.js index 8d190852..97a27f60 100644 --- a/lang/js/DemoExtension/maindemo.js +++ b/lang/js/DemoExtension/maindemo.js @@ -29,7 +29,7 @@ document.addEventListener('DOMContentLoaded', function () { function (){ let data = document.getElementById('inputtext').value; let keyId = document.getElementById('pubkey').value; - gpgmejs.encrypt(data, keyId).then( + gpgmejs.encrypt({ data: data, privateKeys: keyId }).then( function (answer){ if (answer.data){ document.getElementById( @@ -43,7 +43,7 @@ document.addEventListener('DOMContentLoaded', function () { document.getElementById('buttondecrypt').addEventListener('click', function (){ let data = document.getElementById('inputtext').value; - gpgmejs.decrypt(data).then( + gpgmejs.decrypt({ data: data }).then( function (answer){ if (answer.data){ document.getElementById( @@ -68,7 +68,7 @@ document.addEventListener('DOMContentLoaded', function () { function (){ let data = document.getElementById('inputtext').value; let keyId = document.getElementById('pubkey').value; - gpgmejs.sign(data, keyId).then( + gpgmejs.sign({ data: data, keys: keyId }).then( function (answer){ if (answer.data){ document.getElementById( @@ -82,7 +82,7 @@ document.addEventListener('DOMContentLoaded', function () { document.getElementById('verifytext').addEventListener('click', function (){ let data = document.getElementById('inputtext').value; - gpgmejs.verify(data).then( + gpgmejs.verify({ data: data }).then( function (answer){ let vals = ''; if (answer.all_valid === true){ @@ -101,7 +101,11 @@ document.addEventListener('DOMContentLoaded', function () { document.getElementById('searchkey').addEventListener('click', function (){ let data = document.getElementById('inputtext').value; - gpgmejs.Keyring.getKeys(data, true, true).then(function (keys){ + gpgmejs.Keyring.getKeys({ + pattern: data, + prepare_sync: true, + search: true } + ).then(function (keys){ if (keys.length === 1){ document.getElementById( 'pubkey').value = keys[0].fingerprint; |