• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

supabase / supabase-flutter / 18535920272

15 Oct 2025 04:33PM UTC coverage: 79.677% (-1.2%) from 80.885%
18535920272

push

github

web-flow
feat(gotrue): introduce getClaims method to verify and extract JWT claims (#1246)

* feat(gotrue): introduce getClaims method to verify and extract JWT claims

This introduces a new `getClaims` method that supports verifying JWTs
(both symmetric and asymmetric) and returns the entire set of claims
in the JWT payload.

Key changes:
- Add `getClaims()` method to GoTrueClient for JWT verification and claims extraction
- Implement base64url encoding/decoding utilities (RFC 4648)
- Add JWT types: JwtHeader, JwtPayload, DecodedJwt, GetClaimsResponse
- Add helper functions: decodeJwt() and validateExp()
- Add AuthInvalidJwtException for JWT-related errors
- Include comprehensive tests for getClaims, JWT helpers, and base64url utilities

The method verifies JWTs by calling getUser() to validate against the
server, supporting both HS256 (symmetric) and RS256/ES256 (asymmetric)
algorithms.

Note: This is an experimental API and may change in future versions.

Ported from: https://github.com/supabase/auth-js/pull/1030

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* feat(gotrue): make getClaims() non-experimental, add options parameter

Following up on the initial getClaims implementation, this commit:

- Removes experimental status from getClaims() method
- Adds GetClaimsOptions class with allowExpired parameter
- Updates getClaims() to accept optional options parameter
- Improves documentation to better describe the method's behavior
- Exports helper functions (decodeJwt, validateExp) for public use
- Adds tests for allowExpired option

The allowExpired option allows users to extract claims from expired
JWTs without throwing an error during expiration validation. This is
useful for scenarios where you need to access JWT data even after
expiration.

Ported from: https://github.com/supabase/auth-js/pull/1078

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <n... (continued)

64 of 141 new or added lines in 5 files covered. (45.39%)

3301 of 4143 relevant lines covered (79.68%)

2.71 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

28.0
/packages/gotrue/lib/src/types/jwt.dart


Source Not Available

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc