kbpgp icon indicating copy to clipboard operation
kbpgp copied to clipboard

Using Crypto in FireFox WebWorker

Open clevertree opened this issue 10 years ago • 1 comments

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.

clevertree avatar Aug 13 '15 03:08 clevertree

Where do you place the fix? I'd like to try it out.

acasajus avatar Oct 18 '16 16:10 acasajus