node-jose
node-jose copied to clipboard
Add defensive error messages to decrypt
When webcrypto fails to decrypt because the ciphertext is not decryptable, it rejects with a fairly obtuse DOMException/OperationError.
Debugging would be a lot easier if, before attempting to decrypt, there was a check to make sure that the value to decrypt is, in fact, a JWE.
This is a worthwhile request. It'll need to cover JWE as well as JWS, and deal with the various serialization forms, but at least a cursory pass would help.