aboutsummaryrefslogtreecommitdiffstats
path: root/lang/js/src/Keyring.js (follow)
Commit message (Collapse)AuthorAgeFilesLines
* spelling: fix misspellingsDaniel Kahn Gillmor2018-11-081-1/+1
| | | | Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* doc: use https:// for www.gnu.orgDaniel Kahn Gillmor2018-10-181-1/+1
| | | | | | -- Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* 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-191-9/+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: documentation cleanupMaximilian Krambach2018-09-051-5/+5
| | | | --
* js: typecheck destructured parametersMaximilian Krambach2018-08-271-9/+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
* 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: use destructured option parametersMaximilian Krambach2018-08-231-55/+25
| | | | | | | -- * 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: make method parameters objectsMaximilian Krambach2018-08-221-57/+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
* js: throw errors in sync functionsMaximilian Krambach2018-08-221-1/+3
| | | | | | | | | | | | | | | | -- * 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: 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-201-2/+11
| | | | | | | -- * 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-201-42/+41
| | | | | | -- * mainly spacing, see .eslintrc.json for details
* js: revert changes to class read/write restrictionMaximilian Krambach2018-08-201-337/+338
| | | | | | | | | | | | | | -- * 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: don't expire new keys if no date is setMaximilian Krambach2018-08-171-0/+2
| | | | | | | | -- * src/Keyring.js A new Key without expiration is documented as 'never expire' here, and should behave accordingly. This requires sending '0' here.
* js: removed Key.armor property in synchronous useMaximilian Krambach2018-08-171-7/+5
| | | | | | | | | | | | | | -- * src/Key.js The synchronous mode for a Key does not offer an armor/ armored property anymore. This frees up a lot of performance issues, also the armored expoort is expected to change quite often, so a cached version is not advisable. * hasSecret/getHasSecret is now refactored, to reflect their uses. With get('hasSecret') there is a method that fetches the result. * src/Key.js also some refactoring
* js: disallow bulk set data on key from outsideMaximilian Krambach2018-08-171-5/+6
| | | | | | | | | | | | -- * src/Key.js Key class is not exported anymore, as it should not be used directly anywhere. setKeyData is no more a method of the Key, (optional) data are now validated and set on Key creation and on updates, both from within this module, thus no longer exposing setKeyData to the outside. * createKey now gained an optional parameter which allows to set Key data at this point.
* js: importKey feedback refactorMaximilian Krambach2018-08-161-18/+13
| | | | | | | -- * src/Keyring.js: An empty result should no longer cause an error, the import feedback summary has been refactored slightly * Browsertests to reflect import feedback change
* js: fix import feedbackMaximilian Krambach2018-08-161-1/+9
| | | | | | -- * src/Keyring.js For Key imports without prepare_sync the import feedback was lacking the summary
* js: wrong object assumed in recent commitMaximilian Krambach2018-08-161-2/+5
| | | | | | | | -- * src/Keyring.js I wrongly assumed an object to be a GPGME_Key, it was the raw answer from nativeMessaging instead. Now it returns a GPGME_Key again.
* js: get default key fixesMaximilian Krambach2018-08-161-7/+15
| | | | | | | | | | -- * src/Keyring.js: The answer was not parsed correctly, so a config was being ignored. * If no config is set, we return the first non-invalid key with a secret, instead of the first key (which may be e.g. an expired one)
* js: simplify getDefaultKeyMaximilian Krambach2018-08-161-11/+7
| | | | | | | | -- * src/Keyring.js: In case no default Key is set in configuration, only Keys reported as having a secret part should be considered for default Keys, avoiding some extra requests.
* js: fix confusion about loop in last commitMaximilian Krambach2018-07-311-2/+1
| | | | | | | | | -- * The aim is to iterate through the results of the first request (all keys), and then add the propert 'hasSecret' to those that are in the second request (secret Keysring) as well. I messed this up in a recent change, and it escaped testing.
* js: Fix Key.hasSecret answerMaximilian Krambach2018-07-311-4/+6
| | | | | | | -- * The comparision result between Keyring and Keyring with secrets was set to the wrong Object which was not returned at all.
* js: fix indentaionMaximilian Krambach2018-07-271-322/+331
| | | | | | | -- * doing the indentation changes that became neccesary in the last commit.
* js: change the write access for js class methodsMaximilian Krambach2018-07-271-13/+13
| | | | | | | | | | | | | | | | | | -- * 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.
* js: fix getkeys with locate optionMaximilian Krambach2018-07-171-2/+4
| | | | | | | | -- * src/Keyring.js: As locate will not work with the "secret" option, the first message cannot be reused, thus a new one must be created here
* js: allow optional Key retrieve pattern to be nullMaximilian Krambach2018-07-121-2/+2
| | | | | | | | | -- * src/Keyring.js: If the optional "pattern" parameter is not to be used, but another, following parameter is, null is more of a convention in javascript, thus both null and undefined are interpreted as "this parameter is not meant to be set".
* js: add with-sec-fprs to getKeysArmoredMaximilian Krambach2018-07-121-7/+27
| | | | | | | | | | | | | | -- * 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.
* js: documentationMaximilian Krambach2018-07-101-50/+82
| | | | | | | | | | | | | | | | | | -- * 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
* js: reduce request spam at getKeys()Maximilian Krambach2018-07-091-17/+35
| | | | | | | | | | | | | | | | | | -- * Don't make a secret-Key request for each Key retrieved, use one request for all of them instead, and assemble the info later. This should reduce the traffic with large Keyrings. The bulk retrieval for the public armored Keys for each of these Keys is still up to discussion * unittests: disabled assertion for the armored key (as it currently doesn't work) * encryptTest: clarified the mechanism/reason of rejection for Messages >64 MB. This is still a TODO, as this error comes from a different place (the browser itself) and behaves different from the other errors.
* js: Add jsdoc, update webpack-cli dependencyMaximilian Krambach2018-07-041-3/+3
| | | | | | | | | | | | | | | -- * package.json: - the old webpack-cli version depended on two packages with vulnerabilities, set to minimum version 3.0.8 to fix this (nodesecurity.io/advisories/157, nodesecurity.io/advisories/612) - added License identifier * README: Updated documentation * jsdoc.conf: Added a configuration file for jsdoc * some minor documentation changes, indentations
* js: add Key lookupMaximilian Krambach2018-07-041-1/+6
| | | | | | | | | | | | -- * src/Keyring.js: getKeys() now has the option "search", which will trigger a remote lookup (as configured in gpg) for the string given as pattern. * src/permittedOperations: make use of the new 'locate' option in keylist * DemoExtension: Add a button for lookup, to demonstrate the functionality
* js: getDefaultKey and GenerateKey improvementsMaximilian Krambach2018-06-191-12/+10
| | | | | | | | | | | | -- * src/Keyring.js: added more options for key generation. * src/Key.js: GetDefaultKey now relies on the info associated with the key, as the approach of relying on a secret subkey did not work as intended * DemoExtension: Added a button for retrieval of the subkey, to test this functionality.
* js: import result feedbackMaximilian Krambach2018-06-141-18/+36
| | | | | | | -- * src/Keyring.js: Changed and documented the import result feedback towards the javascript side
* js: add verify and signature parsingMaximilian Krambach2018-06-141-2/+0
| | | | | | | | | | | | | | | | | | -- * 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
* js: getDefaultKey and verify fixMaximilian Krambach2018-06-131-1/+55
| | | | | | | | | | | | | | | | -- * DemoExtension/maindemo.js - added a Demo for retrieving the default signing key * src/Errors.js - add a new Error if no default key can be determined * src/Key.js added documentation and a TODO marker for hasSecret. * src/Keyring.js implemented getDefaultKey * src/permittedOperations.js: Added missing entry for verify, added config_opt
* js: Add key creation to KeyringMaximilian Krambach2018-06-111-1/+59
| | | | | | | | | | | -- * src/Keyring.js: Added method generateKey for new Keys Still TODO: Key length and some further testing. Automated testing does not work in this case, and gpgmejs will not be able to delete test keys again. * src/permittedOperations.js Added new method's definitions according to gpgme-json
* js: code cleanup (eslint)Maximilian Krambach2018-06-061-12/+20
| | | | | | | | -- * 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
* js: implement import/delete Key, some fixesMaximilian Krambach2018-06-061-26/+118
| | | | | | | | | | | | | | | | | | | | | | | | | -- * Keyring.js - implemented importKey: importing one or more armored public key blocks. - implemented deleteKey: deleting a public Key from gpg. * Key.js renamed property Key.armor to Key.armored * Helpers.js: toKeyIDArray does not complain anymore if there are no keys. Not having Keys in e.g. signing keys in encrypt is legitimate and common, the complaints were getting spammy * Errors.js: gpgme_errors now always pass an optional additional message, for easier debugging in minified code * Connection.js: Fix in gpgme-json responses containing objects * eslintrc.json: Start using eslint. A cleanup to conform to it is not done yet * Added further tests for the new functionality
* js: more Keyring/Key handlingMaximilian Krambach2018-05-301-6/+26
| | | | | | | | | | | | | | | | | -- * 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
* js: Keyring listing keysMaximilian Krambach2018-05-281-96/+33
| | | | | | | | | | | | | | | -- * implementing Keyring methods: - Keyring.getKeys: has an additional option that retrieves the armor and secret state once at the beginning. This is power hungry, but allows for Keys to be used directly (without querying gpgme-json each call) * permittedOperations.js: reflect recent changes in the native counterpart, adding more options * Key: adding two methods for retrieving the armored Key block and for finding out if the Key includes a secret subkey.
* js: Treat a connection as a gpgme ContextMaximilian Krambach2018-05-281-17/+3
| | | | | | | | | | | | | -- * 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
* js: use version operation for connection checksMaximilian Krambach2018-05-251-31/+27
| | | | | | | | | | | -- * 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
* js: Added browser testing for unit testsMaximilian Krambach2018-05-031-1/+1
| | | | | | | | | | | -- * Added unittests to be run inside a Browser. To be able to access the non-exposed functions and classes, a testing bundle will be created, containing the tests (unittests.js) and the items to be tested. * src/Helpelpers, src/Key, src/Keyring: fixed some errors found during testing.
* js: changed Key class stubMaximilian Krambach2018-05-031-1/+2
| | | | | | | | -- * src/Key.js: A Key object cannot offer more than basic functionality outside a connection, so it now requires a connection to be present.
* js: more testingMaximilian Krambach2018-04-271-0/+4
| | | | | | | | | | | | | | | -- * 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