JOSE implementation in Python providing JWT, JWS, JWE, and JWK functionality with multiple cryptographic backends.
75
A small library that surfaces JOSE headers and JWT claims without performing any signature verification, enabling offline inspection of incoming tokens.
alg HS256, typ JWT, and kid primary, the header extractor returns a mapping containing those keys without needing any signing secret. @testsub user-123, role admin, and an expired exp, the claim extractor returns all claims exactly as encoded, even when the token is expired or signed with an unknown key. @testkid (or None if absent), and the sub claim (or None if absent). @testValueError mentioning a malformed token and does not attempt any verification. @test@generates
from dataclasses import dataclass
from typing import Any, Dict, List, Optional
@dataclass
class TokenSummary:
header: Dict[str, Any]
claims: Dict[str, Any]
kid: Optional[str]
subject: Optional[str]
def read_header(token: str) -> Dict[str, Any]:
"""Return the decoded header from a compact JWT/JWS without verifying its signature."""
def read_claims(token: str) -> Dict[str, Any]:
"""Return the decoded claims from a compact JWT without verifying its signature."""
def summarize_tokens(tokens: List[str]) -> List[TokenSummary]:
"""Return per-token summaries containing unverified headers/claims; preserve input order."""Provides JOSE/JWT parsing utilities without requiring signature verification.
Install with Tessl CLI
npx tessl i tessl/pypi-python-jose