The JWE object, encryption algorithms and token serializers are part of the encryption component (web-token/jwt-encryption
). Claim and header checkers are decoupled and can be found in the checker component (web-token/jwt-checker
).
Why are encryption and checker components not together? The main reason is that when you issue encrypted tokens, you do not need any checker. Those components are decoupled to avoid the installation of unnecessary files.
The encryption and decryption processes have been completely reviewed.
In the examples below, we suppose we already have a JWK object ($key
).
Before
After
Before
After
Please note that it is important to check the token header before the decryption of the token. It will help you to reject tokens signed with unsupported algorithms or for other audiences.