openpgpjs/openpgpjs — pull request #179 by toberndo (2014-02-23 20:43:55+00:00)
Title: Refactoring keyring, Key update method, Fixes

This includes a new design of the keyring:

- key storage is split up in public and private keys. This allows to implement different storage strategies in the storage handler, faster access (don't need to loop through all public keys to query private keys).

- new class KeyArray for public and private key bucket, several new access methods.

- all access methods support keyid and long id (fingerprint).

- query methods with `deep` option to include subkeys in the search

The key packet now buffers keyid and fingerprint. Access to keyid is required in several places in Key and Message class and the keyring. Buffering the keyid and fingerprint requires to do the costly hash operation only once. Fingerprints are returned now as hex by default.

A update method is added to the Key class:
```
/**
* Update key with new components from specified key with same key ID:
* users, subkeys, certificates are merged into the destination key,
* duplicates are ignored.
* If the specified key is a private key and the destination key is public,
* the destination key is tranformed to a private key.
* @param {module:key~Key} key source key to merge
*/
```

Fixes:
- Key.getPrimaryUser: evaluation of most significant self signature
- https://github.com/openpgpjs/openpgpjs/issues/178