fork-openpgpjs/test/general
Wiktor Kwapisiewicz c3d4bf3529
Fix Key#getPrimaryUser on keys without valid UIDs
During tests of weird keys [0] it was found out that OpenPGP.js does not
handle keys without valid UIDs well.

There are two issues that this change corrects, first one is adding
filtering of user IDs in `getPrimaryUser` such as only users with self
certifications are considered. Without that change using
`getPrimaryUser` on a key without valid UIDs would throw an exception
(`Cannot read property 'verified' of undefined` [1]).

Second issue is correcting condition whether to throw if no UID was
found. Previous condition checked for `userId` variable, but this is
initialized by default and as such is almost always set. This causes
`key.getPrimaryUser()` (without condition) to throw `Could not find user
that matches that user ID`. The condition has been modified to match the
filter condition (checking if any property of `userId` has been
initialized).

[0]: https://gitlab.com/sequoia-pgp/weird-keys/tree/master/openpgpjs

[1]: 576ed08a54/openpgpjs/results/no-bound-uid.pgp.txt
2018-07-12 14:04:07 +02:00
..
armor.js Use let and const ES6 features. 2018-02-13 23:33:09 +01:00
brainpool.js change some variable names in tests to camelCase 2018-06-04 12:33:01 +02:00
decompression.js Fix #607 - Add support for bzip2 de/compression 2018-02-14 14:14:07 +01:00
ecc_nist.js change some variable names in tests to camelCase 2018-06-04 12:33:01 +02:00
hkp.js Use let and const ES6 features. 2018-02-13 23:33:09 +01:00
index.js Add Web Key Directory lookup 2018-05-29 21:21:24 +02:00
key.js Fix Key#getPrimaryUser on keys without valid UIDs 2018-07-12 14:04:07 +02:00
keyring.js Use let and const ES6 features. 2018-02-13 23:33:09 +01:00
oid.js OID's stored as Uint8Array 2018-03-01 11:35:16 -08:00
openpgp.js Run tests with randomly generated strings 2018-05-17 12:40:30 +02:00
packet.js Fix reading signersUserId packet in signatures 2018-06-27 12:17:19 +02:00
signature.js Merge pull request #712 from openpgpjs/signature_formatting 2018-05-22 17:32:22 -07:00
testInputs.js Run tests with randomly generated strings 2018-05-17 12:40:30 +02:00
util.js Add ZBase32 encoding function 2018-05-29 09:55:47 +02:00
wkd.js Add Web Key Directory lookup 2018-05-29 21:21:24 +02:00
x25519.js change some variable names in tests to camelCase 2018-06-04 12:33:01 +02:00