square/js-jose

Algorithm support feature detection

fletchgqc opened this issue · 4 comments

What would the best way to detect algorithm support in browsers?

In our case, we want to use the algorithm A256CBC-HS512 but we found that it is not supported in IE11, so in IE11 we would fall back to the default. Unfortunately, IE hangs when you try to encrypt with A256CBC-HS512 so we can't even use try/catch.

At the moment we are looking at UA-sniffing - I really want to use feature detection if possible. Any ideas?

My understanding is that IE11 doesn't have Promises, so you are going to run into much bigger problems than algorithm choice.

Correct, but we have polyfill for that. I believe Angular JS is providing it for me.

I don't see how Angular can involve itself at that level. js-jose is expecting WebCrypto to be returning Promise-like objects, but IE11 is going to be giving us these incompatible CryptoOperation objects instead. You're going to need some sort of shim for that.