openpgpjs/openpgpjs — pull request #175 by tanx (2014-02-12 14:27:52+00:00)
Title: Async api

I added an optional async style to the public api that calls the AsyncProxy behind the scenes. The api now works similar to the [node crypto api](http://nodejs.org/api/crypto.html#crypto_crypto_randombytes_size_callback). If you add an additional callback to a call e.g.:

openpgp.encryptMessage([publicKey], plaintext, function(err, result) {
...
});

Then openpgp will know what to do. If you're in the browser and you've call `openpgp.initWorker('openpgp.worker.js')`, all operation will automatically be handled in a worker thread. If you're in node it will still work though internally it's just synchronous code.

This should also allow us to support the W3C web crypto api more easily in the future, since all webcrypto calls are async as well.

@toberndo `openpgp.AsyncProxy` is still exposed externally for backwards compatibility. I would love to get your opinion on this since you were the one who wrote the original AsyncProxy. Thanks!