> > > Well you have to add all dependant js scripts to the web worker. Even if > > they functions are called asynchronously, they will still be executed in > > the worker thread. > > > > Im thinking this problem could be solved by depency injection. Namely by > > saving the function in a variable "var crypto = window.crypto" and then > > passing these function pointers into the constructor of openpgp.js. This > > way the javascript does not need knowledge of the window object. Do you > > think this could work? > > Alex, Sean, you're the OpenPGP guru guys, what do you think on it? > > Frankly i don't have the deep knowledge to understand if the proposed > fix solve the issue. > > I would just underline that this is a critical issue to be able to > handle in "background" the encryption process without blocking the UI > that will be able to show nice progress-bar on the status of operation. > > It would represent a major step in the "architectural constrain" of > OpenPGPJS, let's improve it! >
So, I've tried if the solution with passing the function pointers works. It seems that you can only pass serializable data such as Strings or JSON objects to a web worker ( http://www.html5rocks.com/en/tutorials/workers/basics/#toc-gettingstarted-workercomm ). If this is true, it means that random numbers would theoretically have to be computed before starting the web worker and then pass the precomputed numbers to the encryption logic. Also the openpgp.js code which uses window.getLocalstorage() would have to be in another javascript file. In other words, in order to make the library run with webworker, all encryption logic would have to be externalized in a seperate .js file which has no knowledge of window.* or document.*. Can anyone verify this? Maybe theres a simpler solution or work around. Thanks Tankred
_______________________________________________ http://openpgpjs.org

