馃専 [Major]: JWT v2 overhaul delivers a new typed, standards-aligned interface (#26)
Jwt v2 is a full overhaul of token creation, parsing, validation, and key handling. The user-facing interface is now type-first, standards-aligned, and designed for safer default behavior and clearer composition in automation.
Breaking Changes
The v1 JWT surface has been replaced by the v2 typed interface.
Existing integrations that depended on legacy command signatures or output shapes must migrate to the v2 command contracts.
Generated-key bundle output from New-Jwt was removed in favor of a stable [Jwt] return shape; key ownership/export should use New-JwtSigningKey.
New: Typed, composable JWT object model
Commands now center on typed objects ([Jwt], [JwtHeader], [JwtPayload], [JwtKey], [JwtKeySet]) so callers can work directly with structured data instead of string-only flows.
This includes stable formatting/type metadata for better terminal output and safer default key display behavior.
Changed: Safer JOSE/JWT validation behavior
Test-Jwt now enforces JOSE critical-header (crit) semantics when present.
Tokens declaring crit require explicit allow-listing via -AllowedCriticalHeader and fail closed on unsupported or malformed critical declarations.
No crit header is required for normal validation flows.
Changed: Clearer key-conversion behavior
ConvertFrom-JwtKey now returns raw byte[] for kty=oct by default.
When an HMAC instance is needed, callers can explicitly request it with -AsHmac -Algorithm HS256|HS384|HS512.
Changed: CI/release safety alignment
Process-PSModule workflow secret forwarding now uses explicit secret mapping instead of secrets: inherit.
Technical Details
- Implemented JOSE
critenforcement inTest-Jwtand addedCriticalHeadersto-Detailedchecks. - Standardized
New-Jwtoutput contract to[Jwt]across parameter sets. - Updated oct JWK conversion to explicit/algorithm-safe behavior.
- Added
New-JwtSigningKeyand aligned examples/docs around explicit key ownership. - Added class docs plus type/format metadata for safer default object display.
- Split test coverage into integration + per-command unit tests and expanded protocol/security cases.
- Final CI loop fixes included PowerShell lint cleanup (
GenerateKeyusage) and UTF-8 BOM normalization on edited PowerShell files. - Full suite is green locally (
113tests passed).
Related issues
- Fixes #13