Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I access MSCrypto from a Web Worker in IE11?

IE11's Web Crypto is located inside of window.msCrypto, whereas for Firefox or Chrome, it's accessible in window.crypto.

Web Workers do not have access to the window context but, thankfully, Chrome and Firefox also expose the crypto variable in the Web Worker context (so, at the global level, you can use this.crypto to access the Web Crypto suite in a Web Worker). It would seem, however, that IE11 does not expose this.msCrypto in their Web Worker context.

Is that correct? Is there any way to use Web Crypto in an IE11 Web Worker?

like image 420
Cody S Avatar asked Oct 19 '22 05:10

Cody S


1 Answers

"support Web Crypto API inside a Web Worker" is an open issue on Microsoft developer site https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/7607496/

The Web Crypto API is not available inside a Web Worker. Both "self.crypto" and "self.msCrypto" are undefined inside a worker context.

I guess is the same issue for IE11 but I have not found documentation

In this thread suggests a workaround, changing from web worker thread to main thread to execute the WebCrypto operations. It is assumed that performance will be lost, and programming surely will be complex

like image 123
pedrofb Avatar answered Oct 20 '22 22:10

pedrofb