This code uses the go jwt library: https://github.com/golang-jwt/jwt and runs through a couple of different scenarios.
- building a JWT with the 'hmac' algorithm
- building a JWT with the 'rsa' algorithm
- building a JWT with the 'hmac' algorithm but verifying additional claims
- decoding an invalid JWT with the 'hmac' algorithm
- decoding a JWT with the 'hmac' algorithm and the wrong key
- re-issuing an 'rsa' signed JWT with an 'hmac' algorithm
go run <file>
Tested on go 1.15.7 and 1.21.1