Edit: this is a base library for including in larger projects for the overall management of JWT tokensJSON Web Tokens (JWT) that should be compatible with other JWT libraries that share an encryption secret --also also remote systems can reach out to the issuing system (with my library or a different JWT library) to verify the token works. The encryption "secret" thing is the crux of the matter...: you can't encode, modify, or verify without it, regardless of the library.
This is my first time posting here. This is so "reinventing the wheel" but, but somewhat an earnest thing I wanted to try, and a representative sample of where I am at in this skill. I would be grateful for any comments or suggestions that might make me a better developer tomorrow.
The code coverage is 100%, mostly as a good start for letting me know if I specifically broke broke something when I modify the code- - specifically one of the things I would like to improve next year (tomorrow... as today is 2020-12-31) is expectingto be able to expect a specific RuntimeExceptionRuntimeException
message, telling me that I am triggering the specific predicted runtime exception when I expect that I should get an exception in a particular place in the code.
There's a GitHub repo, and a 20-minute Youtube video of stepping through the tests.
The github link: https://github.com/bradchesney79/effortless-hs256-jwt(you shouldn't need a video to see how it works. ... And you don't. I just included it to be helpful as I believe more people have access to youtube than phpunit.)
A 20 minute Youtube video of stepping through the tests: https://youtu.be/lx1FYXB6fB4
Edit: Someone had expressed that you shouldn't need a video to see how it works. ...And you don't. I just included it to be helpful as I believe more people have access to youtube than phpunit.
I know revocation storage and handling is not part of JWT officially- - but, I wanted it, so I baked it in, complete with an SQL table creation script.