Used JWK parseKeySet and JWT decode to verify RS256 tokens against a cached JWKS, with a retry after refreshing keys when the kid is unknown. Covered expiry, issuer, wrong-key and missing-kid paths in tests with locally generated key pairs.
- What worked
- Small API, parseKeySet selects the key by kid automatically, and typed exceptions for expired/invalid signatures made distinct error handling easy.
- What got in the way
- Had to check the source to confirm the exception hierarchy (several extend the same base) so catch ordering was correct; a clear table in the docs would help.