openpgpjs/openpgpjs — pull request #235 by eirc (2014-06-16 22:25:49+00:00)
Title: Ability to read binary keys and messages.

Extended the ability of reading ASCII armored keys and messages to reading binary gpg files too. There are a couple issues here I would like some help addressing.

* `mocha_phantomjs` tests fail
* It looks like the `require('fs')` I did at the beginning of the test suite returns an empty object and `fs` does not have the `readFile` method.
* Code duplication
* The `readBinary` methods I added are mostly duplicated code from the `readArmored` methods since they do the exact same thing with the exception of the dearmoring part at the beginning. Extracting the common code is not a trivial task unfortunately though and would require some small refactoring due the heavy usage of exceptions in these methods. Also there are some TODOs left in the `readArmored` of `Message` which note the fact that that exception pattern is not used there. So before jumping in refactoring I'd like some feedback on whether there are some thoughts on how it should be done.
* No tests for `Message`
* There are no tests for the Message class at all so I wasn't sure if there's some reason for that.

PS: I have already used the methods I added by monkey patching them in my code in a project I'm working on so just want to shamelessly plug it :) https://github.com/eirc/pass.js