Skip to content

fathom.verify_token

fathom.verify_token(token, public_key)

Verify a JWT token and return the decoded payload.

Raises AttestationError if verification fails.

Source code in src/fathom/attestation.py
def verify_token(token: str, public_key: Ed25519PublicKey) -> dict[str, Any]:
    """Verify a JWT token and return the decoded payload.

    Raises AttestationError if verification fails.
    """
    try:
        return jwt.decode(token, public_key, algorithms=["EdDSA"])
    except jwt.InvalidTokenError as exc:
        raise AttestationError(f"Token verification failed: {exc}") from exc