kbpgp
kbpgp copied to clipboard
Using Crypto in FireFox WebWorker
Can't figure out how to get kbpgp to recognize Crypto in FF's webworker. Basically self.crypto isn't set, and kbpgp appears to look for window.crypto only.
Here's an ugly fix I use to get past this.
/** Fix **/
if(!_browser_rng_primitive && typeof self.crypto !== "undefined") {
_browser_rng_primitive = function(arg) {
return self.crypto.getRandomValues(arg);
};
}
The fix would only require searching for self.crypto along with window.crypto in the _browser_rng_primitive. I can push a fix if you want.
Where do you place the fix? I'd like to try it out.