Every single browser implementation attaches the CryptoKey constructor to window or worker global scope. This is very useful for defensive programming when building libraries / code around web crypto, e.g. to fail early on invalid user input (when key is not an instanceof CryptoKey and wanting to offer a useful and consistent error message (unlike the implementation specific ones that often come with no information whatsoever).
I think https://w3c.github.io/webcrypto/#crypto-interface should get updated to reflect what's already the practice today and add CryptoKey alongside of the readonly crypto to WindowOrWorkerGlobalScope.
Every single browser implementation attaches the CryptoKey constructor to window or worker global scope. This is very useful for defensive programming when building libraries / code around web crypto, e.g. to fail early on invalid user input (when key is not an
instanceof CryptoKeyand wanting to offer a useful and consistent error message (unlike the implementation specific ones that often come with no information whatsoever).I think https://w3c.github.io/webcrypto/#crypto-interface should get updated to reflect what's already the practice today and add CryptoKey alongside of the readonly
cryptoto WindowOrWorkerGlobalScope.