microsoft/MSR-JavaScript-Crypto

Expose CryptoKey class

mjeanroy opened this issue · 2 comments

Hi,

Problem

We are using the library to polyfill the web crypto API in a react-native environment, and it seems the CryptoKey interface is not exposed.

To give more details, we are using it with jose:

  • When used in a non node environment, jose expects the polyfill to emulate the presence of required globals.
  • Problem: since version 4.8.0, the jose library expect the CryptoKey interface to be exposed in the global namespace.

This is especially due to this check in the jose library, and it seems there is no plan to change it in the short term (see here).

Question

We fixed it on our side (by exposing a CryptoKey class in the global namespace).
Would you be open to reviewing a PR fixing this specific issue?

Thanks!

Sorry for the delay, I missed this request.

This was something I considered adding. The library's original intent, as a polyfill for older browsers, just having a CryptoKey-like object was enough. I'll add CryptoKey.

I'll do my own PR because I have to consider older browsers and situations where there is a native CryptoKey already - and then add/update some tests.

If you want to post your own PR, that will help me ensure I'm addressing your specific requirements.

Hi @ljoy913,

For what it's worth, I just opened a PR here. I tried to take care of old browsers and cases where the native CryptoKey interface is defined.

  • Of course, feel free to close it and submit your own PR, at least you have something to start with 🙂
  • If you want to merge my PR, let me know, and I'll sign the CLA 😉