aboutsummaryrefslogtreecommitdiffstats
path: root/lang/js (follow)
Commit message (Collapse)AuthorAgeFilesLines
* js: improve connection checkMaximilian Krambach2019-07-032-25/+47
| | | | | | | | | -- * Connection.js: In some cases, the browser disconnect does not happen inmediately (e.g. wrong extension for the app). I added a delay of 25 ms to see if the connection was closed by the browser. Also, I tried to make the checkConnection more readable.
* js: Error handling for browser errorsMaximilian Krambach2019-06-194-27/+99
| | | | | | | | | | | | | | | | | | | | | | | | | | -- * Connection.js - Add some meaningful nativeMessaging feedback for failing communication due to misconfiguration or other browser-originated fails - add an "isDisconnected" property - "isNativeHostUnknown" tries to match browser's feedback string if the browser does not find gpgme-json * init.js - initialization will now reject with a more meaningful error if the configuration is not set up or other browser-based errors (chrome.runtime.lastError) are present. This should speed up the normal initialization (not having to waiting for a timeout any more in case of improper setup) * errors.js - CONN_NATIVEMESSAGE: New error that passes the browser's nativeMessaging error - CONN_NO_CONFIG: native messaging error indicating that the nativeMessaging host was not set up properly * unittests.js: - added the "isDisconnected" property to the startup tests - added tests for proper behavior of connection checks
* Add SPDX identifiers to most source filesWerner Koch2018-11-161-4/+3
| | | | | | -- Signed-off-by: Werner Koch <[email protected]>
* spelling: fix misspellingsDaniel Kahn Gillmor2018-11-085-6/+6
| | | | Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* doc: convert more http:// links to https://Daniel Kahn Gillmor2018-10-181-1/+1
| | | | | | -- Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* doc: use https:// for www.gnu.orgDaniel Kahn Gillmor2018-10-1829-29/+29
| | | | | | -- Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* js: increase default startup timeoutMaximilian Krambach2018-10-171-1/+1
| | | | | | | -- * src/index.js: change the init default if none is given, so that all initialization defaults line up to 1000 miliseconds
* js: renamed keygen algo optionMaximilian Krambach2018-09-201-2/+2
| | | | | | | | -- * src/Keyring.js: Confused default-future with future-default * reverts commit 34be6163f6c1057e2a87705925a9d0c70e4ecf17
* js: add 'default-future' as createKey optionMaximilian Krambach2018-09-191-1/+1
| | | | | | -- * src/Keyring.js: default-future can be used now for key creation as algo.
* json: Remove subkey-algo from createkey command.Werner Koch2018-09-192-12/+1
| | | | | | | | | | | | | | | | | * src/gpgme-json.c (op_createkey): Remove subkey-algo param. (GPG_AGENT_ALLOWS_KEYGEN_TRHOUGH_BROWSER): Fix typo. * lang/js/src/Keyring.js: Remove subkey-algo support. * lang/js/src/permittedOperations.js: Ditto. -- We do not want to expose details of the protocol's key generation and thus the subkey-algo does not make sense. Right now we support only the default and future-default algorithms. A user can configure them anyway using new-default-key-algo in gpg.conf. Eventually we may officially support a more flexible way of creating special structured OpenPGP keys but right now that is not part of the API. Signed-off-by: Werner Koch <[email protected]>
* js: add configuration option on startupMaximilian Krambach2018-09-1912-29/+41
| | | | | | | | | | | | | | -- * src/index.js: Added an optional configuration object for the startup. * configuration: timeout - the initial check for a connection ran into timeouts on slower testing machines. 500ms for initial startup is not sufficient everywhere. The default timeout was raised to 1000ms, and as an option this timeout can be increased even further. * BrowsertestExtension: Set the initial connection timeouts to 2 seconds, to be able to test on slower machines.
* js: Fix errorDetails of GPGME_SignatureThomas Oberndörfer2018-09-101-2/+2
| | | | | * lang/js/src/Signature.js (GPGME_Signature.errorDetails): Access properties from the summary object.
* js: add new documentation file to extra_distMaximilian Krambach2018-09-061-0/+1
| | | | | | -- * jsdoc_index.md is the documentation's 'main page' to offer a better intro than only the parser-generated API confusion.
* js: fix error in toKeyIdArrayMaximilian Krambach2018-09-062-3/+3
| | | | | | | | -- * src/Helpers.js: GPGME_Keys were not parsed as valid, as their fingerprint getter is not a fingerprint 'property'. * BrowserTestExtension: fixed a dsplay typo in counting of tests.
* js: documentation cleanupMaximilian Krambach2018-09-0511-101/+215
| | | | --
* js: key deletion after testMaximilian Krambach2018-08-311-2/+2
| | | | | | -- * Yet again some wrong syntax in Browsertests
* js: cleanup after key import testMaximilian Krambach2018-08-311-1/+3
| | | | | | -- * one of the public Keys imported was not removed afterwards.
* js: tests for file name encodingMaximilian Krambach2018-08-302-2/+60
| | | | | | | | | -- * BrowsertestExtension/tests/decryptTest.js: There were cases in which file names returned in a wrong encoding from decryption. The test cases here are a 'Hello World' in a text file with different names, then being encrypted with cli gnupg.
* js: decoding of informationMaximilian Krambach2018-08-301-1/+1
| | | | | | | | | | -- * src/Helpers.js: This additional escape should 'repair' special characters like spaces in filenames. In the strange world of encoding there is little hope that this captures all cases, or that it will never fail to return some value, let alone meaningful. In my test cases it worked.
* js: add testsMaximilian Krambach2018-08-304-5/+138
| | | | | | | | | | | | | -- * BrowserTestExtension/tests: - decryptTest.js: Check Decryption and return values of binary data - encryptTest.js: Return data type of armored/non-armored encryption - added a small encoded input png for testing * DemoExtension/maindemo.js: Fixed unexpected usage of the Demo encrypt (non-armored)
* js: add encoding parameter for encrypt returnMaximilian Krambach2018-08-301-2/+9
| | | | | | | | | -- * src/gpgme.js: In case the encryption was done unarmored, the result is binary data. Added an option to either return the binary data as base64-encoded string or as Uint8Array, similar to return values of decrypt
* js: separate gpgme answer by type of dataMaximilian Krambach2018-08-302-47/+75
| | | | | | | | | | | -- * src/Connection.js; src/permittedOperations.js: To avoid further encoding problems, data sent by gpgme is now sorted as either 'payload' or 'info'. Payload data may come in any encoding, and here the 'expected' and 'format' options are used, 'info' data may contain text created by gnupg which may need re-encoding, but this should not be affected by 'expected' and 'format'
* js: return base64 after encrypt with armor=falseMaximilian Krambach2018-08-292-3/+7
| | | | | | | | | -- * src/gpgmejs.js/encrypt: the encrypted data were converted back to a (incorrect) string, whereas they should be data with no encoding specified. Returning base64 data is the expected way. * DemoExtension: caught yet another usage of old syntax.
* js: small documentation updateMaximilian Krambach2018-08-271-1/+2
| | | | --
* js: make non-payload data more encoding-tolerantMaximilian Krambach2018-08-271-1/+8
| | | | | | | | | | | | -- * src/Helpers.js: As non-payload data might come in different encodings, a conversion has been introduced that worked in most cases. Data like the userid might come in different encodings, which we don't know of. For now, a try..catch returns the data as they are if the utf-8 decoding fails. Sometimes this yields the correct result, sometimes it may not work, but it won't stop the whole operation anymore.
* js: typecheck destructured parametersMaximilian Krambach2018-08-273-20/+40
| | | | | | | | | | | | | | -- * destructuring just takes the input argument and treats it as object. In cases like in src/Keyring/generateKey, where I forgot to change the old syntax, the fingerprint as string was destructured into an object without "pattern", which caused all Keys to be retrieved. So, methods with a destructuring now check if the first argument is an object and get a default empty object if no parameter is submitted. This allows the further use of destructured parameters, while still ensuring nothing vastly incorrect is used. * src/Kering.js, unittsets.js: fixed old syntax in method usage
* js: extend information on decoding in decryptMaximilian Krambach2018-08-272-3/+9
| | | | | | | | | | | | -- * src/Connection.js: resulting data, if not pure ascii, is base64 encoded in the result message. A further decoding attempt into javascript 'string' will be attempted by default, unless specified at the decrypt() method. The return value 'format' now shows which of the possibilities has been applied. The old boolean 'base64' now turns into format:'base64' if the returned payload is a base64 string after decryption.
* js: fix file_name return on decryptMaximilian Krambach2018-08-271-17/+17
| | | | | | -- * src/gpgmejs: Line 228 checked the wrong variable. To avoid further confusion, _result was renamed to returnValue in the whole file
* js: add new options to permittedOperationsMaximilian Krambach2018-08-241-0/+6
| | | | | | | | -- * reflecting the new optional strings accepted by the backend. 'file_name' and 'sender' can be used via the 'additional' parameter in encrypt operations
* js: fix syntax inside Keyring methodsMaximilian Krambach2018-08-231-1/+2
| | | | | | | | -- * recent changes in parameter calling led to a forgotten internal call in getDefaultKey using old syntax (and failing in case a default key is configured)
* js: offer an always-trust parameter on encryptMaximilian Krambach2018-08-231-1/+7
| | | | | | | | | | -- * src/gpgmejs.js: Setting the default to 'always trust' assumes that most api users will already have made their internal checks, but may not have the gnupg web-of-trust model implemented, thus trusting the key themselves, without gnupg having full or even any information. Still it should stay an option to have gnupg decide.
* js: use destructured option parametersMaximilian Krambach2018-08-233-107/+66
| | | | | | | -- * Adds to f0409bbdafcbd4f8b0be099a6b3ce0d5352c9bcd and makes use of destructuring, allowing for defaults, and cleaning up the validation.
* js: update getDefaultKey to more precise logicMaximilian Krambach2018-08-231-1/+6
| | | | | | | | | | | | | | | | | -- * src/Keyring.js: Adapted Keyring.getDefaultKey() to my current understanding of a default signing key: either the default key set in the gpg config, or 'the first usable private key' - usability meaning 'not invalid, expired, revoked, and can be used for signing'. It should be the same key used as in command line when doing a --sign operation. In case the user has a smartcard plugged in, we currently won't know of this here, so our choice may differ. But as we do all javascript-binding sign operations with the key fingerprint explicitly set, this should not be a real problem. This method is seen more as a convenience to tell using librarys which key represents the main user.
* js: add decrypt result optionsMaximilian Krambach2018-08-224-12/+44
| | | | | | | | | | | -- * As a decrypt result cannot be known beforehand, the decrypt operation may add an 'expect' property, taking either 'uint8' or 'base64', which will return the decrypted data in the appropiate formats. the return property 'format' will give a feedback on which option was taken. A test was added to reflect these changes.
* js: make method parameters objectsMaximilian Krambach2018-08-2211-309/+385
| | | | | | | | | | | | -- * 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
* js: improve decryption performanceMaximilian Krambach2018-08-225-19/+100
| | | | | | | | | | | | | | | | | | -- * src/Connection.js, src/Helpers.js: performance of decoding incoming base64 data was improved to about 4 times the speed by introducing two more efficient functions (thanks to [email protected] for finding and testing them) * src/gpgmejs.js: Decrypted data will now return as Uint8Array, if the caller does not wish for a decoding. Decoding binary data will return invalid data, and a Uint8Array may be desired. This can be indicated by using the (new) 'binary' option in decrypt. * src/Errors.js A new error in case this decoding fails * src/Message.js, src/Connection.js: expected is change from base64 to binary, to avoid confusion later on.
* js: Return error if signature has no fingerprintMaximilian Krambach2018-08-221-1/+4
| | | | | | | | -- * src/Signature.js/get fingerprint: A signature with no fingerprint should not happen, but if it does, we should throw an error here, as the method is a getter.
* js: changed verify signature result infosjavascript-bindingMaximilian Krambach2018-08-222-21/+28
| | | | | | | -- * the resulting information of verify now are as documented, and the same as in a decrypt callback
* js: throw errors in sync functionsMaximilian Krambach2018-08-226-61/+76
| | | | | | | | | | | | | | | | -- * synchronous functions should throw errors if something goes wrong, Promises should reject. This commit changes some error cases that returned Error objects instead of throwing them - src/Key.js: createKey() and sync Key.get() throw errors - src/Error.js: Exporting the list of errors to be able to test and compare against these strings - src/Keyring.js: Setting a null value in pattern is not useful, and now caused an error with the new changes. - src/Message.js: createMessage and Message.setParameter now throw errors
* js: update decrypt/verify resultsMaximilian Krambach2018-08-214-12/+49
| | | | | | | | | | -- * src/gpgmejs.js: Decrypt now parses additional optional dec_info information, as well as any verify information, if present * src/permittedOperations: Now decrypt also expect the new return object dec_inf (containing info such as is_mime and file_name)
* js: remove outdated checklistsMaximilian Krambach2018-08-213-36/+0
| | | | | | -- * They are heavily outdated and offer no more useful information
* js: Fix library name mentioned in js MakefilesAndre Heinecke2018-08-214-15/+15
| | | | --
* js: Update extra_dist filesAndre Heinecke2018-08-212-2/+4
| | | | | * lang/js/BrowserTestExtension/Makefile.am, lang/js/Makefile.am (EXTRA_DIST): Update.
* js: Improve READMEAndre Heinecke2018-08-211-9/+36
| | | | * lang/js/README: Clarify structure at the beginning.
* js: set expiry of generatedKey to seconds from nowMaximilian Krambach2018-08-211-6/+4
| | | | | | | | -- * 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.
* js: add option "subkey-algo" to generateKeyMaximilian Krambach2018-08-202-2/+14
| | | | | | | -- * The option was recently added to gpgme-json; this reflects this on javascript side
* js: set expiry date on generateKeyMaximilian Krambach2018-08-201-1/+2
| | | | | | | -- * on the javascript side a Date is expected, gpggme-json expects seconds from 'now'
* js: add and apply eslint rulesMaximilian Krambach2018-08-2025-397/+421
| | | | | | -- * mainly spacing, see .eslintrc.json for details
* js: revert changes to class read/write restrictionMaximilian Krambach2018-08-209-1255/+1164
| | | | | | | | | | | | | | -- * undoes 94ee0988d4eaac27785de6efb7c19ca9976e1e9c and e16a87e83910ebb6bfdc4148369165f121f0997e. I do not fully understand why my approach was bad, but I am not in a position to argue. This revert was requested to me after a review, and I'm doing it in the assumption that more experienced people know better than me. * unittests: Also changed some outdated tests that stopped working since 754e799d35fd62d7a979452f44342934659908c7 (as GPGME_Key is not exported, one cannot check for instanceof in the tests anymore)
* js: decode arriving gpg message stringsMaximilian Krambach2018-08-174-4/+76
| | | | | | | | | -- * Arriving strings (i.e. user id names, error messages) are not always in javascript encoding. This is an attempt to go through the whole gpgme answer (with the exception of payload data) and to fix the encoding of these