AJ ONeal 3f7985317f
ajwt: implement redesigned API from REDESIGN.md
Rename ValidateParams → Validator, make Issuer immutable after construction.

Key changes:
- StandardClaims.GetStandardClaims() + StandardClaimsSource interface: any
  struct embedding StandardClaims satisfies the interface for free via
  Go's method promotion — zero boilerplate for callers
- Issuer is now immutable after construction; keys and validator are
  unexported; Params field removed
- New constructors: New, NewWithJWKs, NewWithOIDC, NewWithOAuth2
- UnsafeVerify(tokenStr string) (*JWS, error): Decode + sig verify + iss
  check; "unsafe" means exp/aud/etc. are NOT checked
- VerifyAndValidate(tokenStr, claims, now): full pipeline requiring non-nil
  Validator; fails loudly with nil Validator
- FetchJWKs(ctx, url), FetchJWKsFromOIDC(ctx, base),
  FetchJWKsFromOAuth2(ctx, base): standalone fetch functions with context
- PublicJWK.Thumbprint(): RFC 7638 SHA-256 thumbprint, canonical field
  ordering per spec (EC: crv/kty/x/y, RSA: e/kty/n, OKP: crv/kty/x)
- DecodePublicJWKsJSON: auto-populates KID from Thumbprint when absent
- Tests: 14 pass, covering VerifyAndValidate, UnsafeVerify, nil-validator
  error, all alg round trips, tampered alg, Thumbprint, auto-KID
2026-03-13 10:28:47 -06:00
2021-03-10 16:58:54 -07:00
2026-03-01 00:18:32 -07:00
2026-02-12 00:38:04 -07:00
2025-10-11 19:03:58 -06:00

golib

Go Reference

Sometimes a little copying, sometimes a little dependency. Too small for their own repos.

The default branch is dev, but the stable, versioned tags are based on main.

Also, my Go Cheatsheet:

Description
Sometimes a little copying, sometimes a little dependency, but too small for their own repos.
Readme MPL-2.0 19 MiB
Languages
Go 100%