parse

Parses a JWT token string into a Sep45AuthToken.

This method performs lenient parsing: if the JWT is malformed or claims cannot be parsed, it returns a Sep45AuthToken with default values. This allows graceful degradation in client applications.

Parsing Behavior

  • Validates JWT has 3 parts (header.payload.signature)

  • Handles Base64 URL-safe decoding with automatic padding

  • Extracts standard JWT claims (iss, sub, iat, exp)

  • Extracts SEP-45 specific claims (client_domain)

  • Returns token with defaults on any parsing error

Security Note

This parser does NOT verify JWT signatures. SEP-45 clients receive signed tokens from auth servers over HTTPS and use them as bearer tokens. Signature verification is the server's responsibility.

Return

Sep45AuthToken with parsed claims, or Sep45AuthToken with defaults on error

Parameters

jwt

The JWT token string (format: "header.payload.signature")

See also