aboutsummaryrefslogtreecommitdiffstats
path: root/lang/js/src/gpgmejs.js (unfollow)
Commit message (Collapse)AuthorFilesLines
2018-10-18doc: use https:// for www.gnu.orgDaniel Kahn Gillmor1-1/+1
-- Signed-off-by: Daniel Kahn Gillmor <[email protected]>
2018-09-05js: documentation cleanupMaximilian Krambach1-43/+60
--
2018-08-30js: add encoding parameter for encrypt returnMaximilian Krambach1-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
2018-08-29js: return base64 after encrypt with armor=falseMaximilian Krambach1-2/+6
-- * 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.
2018-08-27js: small documentation updateMaximilian Krambach1-1/+2
--
2018-08-27js: typecheck destructured parametersMaximilian Krambach1-4/+16
-- * 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
2018-08-27js: extend information on decoding in decryptMaximilian Krambach1-2/+6
-- * 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.
2018-08-27js: fix file_name return on decryptMaximilian Krambach1-17/+17
-- * src/gpgmejs: Line 228 checked the wrong variable. To avoid further confusion, _result was renamed to returnValue in the whole file
2018-08-23js: offer an always-trust parameter on encryptMaximilian Krambach1-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.
2018-08-23js: use destructured option parametersMaximilian Krambach1-50/+37
-- * Adds to f0409bbdafcbd4f8b0be099a6b3ce0d5352c9bcd and makes use of destructuring, allowing for defaults, and cleaning up the validation.
2018-08-22js: add decrypt result optionsMaximilian Krambach1-8/+13
-- * 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.
2018-08-22js: make method parameters objectsMaximilian Krambach1-61/+86
-- * 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
2018-08-22js: improve decryption performanceMaximilian Krambach1-6/+12
-- * 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.
2018-08-22js: changed verify signature result infosjavascript-bindingMaximilian Krambach1-2/+4
-- * the resulting information of verify now are as documented, and the same as in a decrypt callback
2018-08-22js: throw errors in sync functionsMaximilian Krambach1-15/+24
-- * 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
2018-08-21js: update decrypt/verify resultsMaximilian Krambach1-8/+11
-- * 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)
2018-08-20js: add and apply eslint rulesMaximilian Krambach1-20/+20
-- * mainly spacing, see .eslintrc.json for details
2018-08-20js: revert changes to class read/write restrictionMaximilian Krambach1-221/+204
-- * 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)
2018-08-17js: decrypt callback is_mime fixMaximilian Krambach1-1/+3
-- * src/gpgmejs: is_mime should report its' counterpart. Also, file_name is not optional in specification. We'll send null if there is no file_name
2018-07-30js: Making objects inmutableMaximilian Krambach1-6/+3
-- * An Object.freeze should stop any malicious third party from changing objects' methods once the objects are instantiated (see unittest for an approach that would have worked before) - An initialized gpgmejs- object doesn't have a '_Keyring' property anymore (it still has its 'Keyring') - The internal expect='base64' needed to be turned into a method.
2018-07-27js: fix indentaionMaximilian Krambach1-184/+187
-- * doing the indentation changes that became neccesary in the last commit.
2018-07-27js: change the write access for js class methodsMaximilian Krambach1-27/+50
-- * src/ [Connection, Error, Key, Keyring, MEssage, Signature, gpgmejs]: Functions and values that are not meant to be overwritten are now moved into their constructors, thus eliminating the possibility of overwrites after initialization. * Key: The mode of use (synchronous cached, or async promises) ivs now determined at initialization of that Key. The property Key.isAsync reflects this state. * unittests: fixed old Key syntax for testing. * Message.js isComplete is now a method and not a getter anymore. * Added some startup tests.
2018-07-10js: documentationMaximilian Krambach1-55/+91
-- * Fixed errors: - src/Message.js post(): Set chunksize to defined default value instead of hardcoded - src/Keys.js: added getHasSecret() to refreshKey operation. * Reviewed and updated the documentation * non-documentation changes which do not affect functionality: - src/Errors: disabled a console.warn that is only useful for debugging - helpers.js: renamed "string" to "value" in isFingerprint and isLongId to avoid confusion - src/Keyring: prepare_sync, search are both explicitly set to false by default
2018-07-04js: properly reject pgp message without signatureMaximilian Krambach1-1/+1
-- * A verify at gpgme-json does not fail if there is a valid pgp message that does not include a signature. Instead, the answer will be devoid of signatures. In javascript, the SIG_NO_SIG error should be reported here, but wasn't.
2018-06-20js: Demoextension updateMaximilian Krambach1-3/+3
-- * src/Signature: typo * src/gpgmejs.js: fixed wrong scope in verification * right now verify does not succeed in the DemoExtension. This is probably a problem in conversion or line ending.
2018-06-14js: add verify and signature parsingMaximilian Krambach1-8/+130
-- * src/gpgmejs.js: - Added verify method - Added verification results in decrypt (if signatures are present in the message) - Added a base64 option to decrypt * src/Signature.js: Convenience class for verification results. Used for e.g. converting timestamps to javascript time, quick overall validity checks * src/Keyring.js: removed debug code * src/Errors.js add two new Signature errors
2018-06-11js: removed configMaximilian Krambach1-3/+1
-- * There is no use for a configuration at the moment, and it seems improbable that this use will arise.
2018-06-08js: change chunksize handling and decodingMaximilian Krambach1-13/+9
-- * the nativeApp now sends all data in one base64-encoded string, which needs reassembly, but in a much easier way now. * there are some new performance problems now, especially with decrypting data
2018-06-06js: code cleanup (eslint)Maximilian Krambach1-22/+35
-- * trying to stick to eslint from now on for readability * As some attribution was lost in previous git confusions, I added my name into some of the licence headers
2018-05-30js: more Keyring/Key handlingMaximilian Krambach1-40/+45
-- * src/Keys.js - made setKeyData more consistent with other methods - added convenience methods (Key.armored, Key.hasSecret) - Added a Key delete function * src/Keyring.js: - added a getkeysArmored which allows for bulk export of public Keys gpgmejs: - removed deleteKey. It is now a method of the Key itself - Encrypt: Added some common options as parameter, and the possibility to set all allowed flags via an additional Object
2018-05-28js: Treat a connection as a gpgme ContextMaximilian Krambach1-35/+10
-- * After an operation a connection should be disconnected again. The "end of operation" is now assumed to be either an error as answer, or a message not including a "more" * GPGME, GPGME_Key, GPGME_Keyring don't require a connection anymore * Message.js: The Message.post() method will open a connection as required
2018-05-25js: use version operation for connection checksMaximilian Krambach1-7/+1
-- * src/Connection.js: isConnected was renamed to checkConnection, that returns a promise with either version information or Boolean * Connection checks have been adapted to reflect that checkConnection returns a Promise * BrowsertestExtension: tests/signTest.js was missing from my last commit
2018-05-24js: adding sign methodMaximilian Krambach1-0/+38
-- * src/gpgmejs.js: method, update in src/permittedOperations * basic testing in BrowsertestExtension
2018-05-23js: remove openpgp modeMaximilian Krambach1-2/+2
-- * After discussion, that mode is not required, and can result in being quite misleading and a maintenance hassle later on.
2018-05-22js: transfer encoding changesMaximilian Krambach1-26/+16
-- * Uint8Arrays are not supported for now there are unsolved issues in conversion, and they are lower priority * encrypt gains a new option to indicate that input values are base64 encoded * as decrypted values are always base64 encoded, the option base64 will not try to decode the result into utf, but leave it as it is
2018-05-14js: Tests and improvements for openpgp modeMaximilian Krambach1-3/+15
-- * Added openpgp - Mode tests to the browsertest Extension. These tests require openpgp, which should not be a hard dependency for the main project. Packing openpgpjs into the extension is still TODO * Fixes: - openpgp mode API now correctly handles parameters as an object, similar to openpgpjs - proper check and parsing of openpgpjs Message Objects
2018-05-08js: more testingMaximilian Krambach1-5/+6
-- * Tests: Under certain circumstances, some data change during encrypt-decrypt. Committing the current state so the problem can be discussed. * Fixes: - disconnecting the test ports after tests are complete - fixed passing of the error message from gpgme-json
2018-04-27js: more testingMaximilian Krambach1-25/+31
-- * Tests: initialization of the two modes, encryption * gpgme.js: reintroduced message check before calling Connection.post() * gpgmejs_openpgp.js: Fixed openpgp mode not passing keys * index.js: fixed some confusion in parseconfig() * Inserted some TODO stubs for missing error handling
2018-04-25js: First testing and improvementsMaximilian Krambach1-10/+21
-- * Introduced Mocha/chai as testsuite. After development build 'npm test' should run the unit tests. Functionality exclusive to Browsers/WebExtensions cannot be run this way, so some other testing is still needed. - package.json: Added required development packages - .babelrc indirect configuration for mocha. ES6 transpiling needs some babel configuration, but mocha has no setting for it. - test/mocha.opts Vonfiguration for mocha runs * Fixed errors: - Helpers.js toKeyIdArray; isLongId is now exported - Key.js Key constructor failed - Message.js will not throw an Error during construction, a new message is now created with createMessage, which can return an Error or a GPGME_Message object * Tests: - test/Helpers: exports from Helpers.js, GPGME_Error handling - test/Message: first init test with bad parameters
2018-04-25js: Configuration and Error handlingMaximilian Krambach1-8/+11
-- * gpgmejs_openpgpjs - unsuported values with no negative consequences can now reject, warn or be ignored, according to config.unconsidered_params - cleanup of unsupported/supported parameters and TODOS * A src/index.js init() now accepts a configuration object * Errors will now be derived from Error, offering more info and a stacktrace. * Fixed Connection.post() timeout triggering on wrong cases * Added comments in permittedOperations.js, which gpgme interactions are still unimplemented and should be added next
2018-04-25js: change in Error behaviourMaximilian Krambach1-8/+5
-- * Error objects will now return the error code if defined as error type in src/Errors.js, or do a console.log if it is a warning. Errors from the native gpgme-json will be marked as GNUPG_ERROR.
2018-04-25js: allow openpgp-like Message objects as DataMaximilian Krambach1-0/+7
-- * src/gpgmejs.js: If a message offers a getText, consider it as the message's content
2018-04-24js: change in initialization ancd connection handlingMaximilian Krambach1-35/+26
-- * The Connection will now be started before an object is created, to better account for failures. * index.js: now exposes an init(), which returns a Promise of configurable <GpgME | gpgmeGpgME_openPGPCompatibility> with an established connection. * TODO: There is currently no way to recover from a "connection lost" * Connection.js offers Connection.isConnected, which toggles on port closing.
2018-04-23js: don't allow message operation changesMaximilian Krambach1-6/+3
-- Once an operation is changed, their set of allowed/required parameters will change. So we shouldn't set/change the operation later.
2018-04-23js: Key handling stubs, Error handling, refactoringMaximilian Krambach1-31/+77
-- * Error handling: introduced GPGMEJS_Error class that handles errors at a more centralized and consistent position * src/Connection.js: The nativeMessaging port now opens per session instead of per message. Some methods were added that reflect this change - added methods disconnect() and reconnect() - added connection status query * src/gpgmejs.js - stub for key deletion - error handling - high level API for changing connection status * src/gpgmejs_openpgpjs.js - added stubs for Key/Keyring handling according to current state of discussion. It is still subject to change * src/Helpers.js - toKeyIdArray creates an array of KeyIds, now accepting fingerprints, GPGMEJS_Key objects and openpgp Key objects. * Key objects (src/Key.js) Querying information about a key directly from gnupg. Currently a stub, only the Key.fingerprint is functional. * Keyring queries (src/Keyring.js): Listing and searching keys. Currently a stub.
2018-04-20js: encrypt improvement and decrypt methodMaximilian Krambach1-169/+113
* Compatibility class gpgme_openpgpjs offers an API that should accept openpgpjs syntax, throwing errors if a parameter is unexpected/not implemented * tried to be more generic in methods * waiting for multiple answers if 'more' is in the answer * more consistency checking on sending and receiving * updated the example extension --
2018-04-10js: Initial commit for JavaScript Native Messaging API[email protected]1-0/+187
-- Note this code misses all the legal boilerplate; please add this as soon as possible and provide a DCO so we can merge it into master. I also removed the dist/ directory because that was not source code.