mastercoin-MSC/omniwallet — pull request #384 by wanderingbort (2014-04-20 16:50:23+00:00)
Title: Spinner lifetime and async.generateAsymmetricPair fixes

Fixes for a few bugs introduced in my last PR
1) the spinner should no longer disappear on a successful, this removes any awkward gap between the modal dialogue and the next UI mode where the spinner would prematurely stop

2) my job queue was actually a job stack, which explained why things would go wonky if the "queue" had a height greater than 1 (well that was embarassing)

3) the generateAsymmetricPair method of CryptUtilAsync was not properly respecting the return value that included an RSAKey object. Message passing to/from the worker only works on simple types. As a result, when called through the async wrapper the private key is temporarily PEM encoded for transport. The paired wrapper converts it back to the appropriate RSAKey object.

NB: there is a several month old bug in the jsrsasign library (https://github.com/kjur/jsrsasign/issues/37) that we have a workaround for. The private side of the asymmetric pair was not marked as private, resulting in a error when PEM encoding it. The work around is to manually set the expected "isPrivate" boolean on the object before passing it to the PEM encoding method.