Metadata-Version: 2.5
Name: lupaxa-token-decoder
Version: 0.1.0
Summary: Decode and inspect JWTs and other common token formats.
Project-URL: Homepage, https://github.com/lupaxa-security-toolbox/token-decoder
Project-URL: Repository, https://github.com/lupaxa-security-toolbox/token-decoder
Project-URL: Issues, https://github.com/lupaxa-security-toolbox/token-decoder/issues
Author: The Lupaxa Project
License: MIT License
        
        Copyright (c) The Lupaxa Project
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENCE
Keywords: cli,decoder,jwt,security,token
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: MacOS
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Security
Classifier: Topic :: Utilities
Requires-Python: >=3.11
Provides-Extra: dev
Requires-Dist: bump-my-version>=1.2.0; extra == 'dev'
Requires-Dist: mypy>=1.12.0; extra == 'dev'
Requires-Dist: pytest-cov>=5.0; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Requires-Dist: ruff>=0.6.0; extra == 'dev'
Provides-Extra: test
Requires-Dist: pytest-cov>=5.0; extra == 'test'
Requires-Dist: pytest>=8.0; extra == 'test'
Description-Content-Type: text/markdown

<p align="center">
  <a href="https://github.com/lupaxa-security-toolbox">
    <img src="https://raw.githubusercontent.com/the-lupaxa-project/brand-assets/master/logos/organisations/security-toolbox/readme-logo.png" alt="Security Toolbox" />
  </a>
</p>

<h1 align="center">Token Decoder</h1>

Token Decoder inspects a JWT or another common token and prints a JSON report. It does not verify signatures and it does not decrypt JWE payloads.

The library import is `lupaxa.token_decoder`. The command is `token-decoder`.

## Install

Python 3.11 or newer. There are no runtime dependencies.

```bash
pip install lupaxa-token-decoder
```

## Quick Start

Pass a token, or pipe one line on stdin:

```bash
token-decoder "$TOKEN"
printf '%s\n' "$TOKEN" | token-decoder
```

With no argument, a terminal prompts on stderr. The JSON report is written to stdout.

> **Note:** A token passed as an argument can be stored in your shell history. Pipe it on stdin when that matters. `signature_verified` is always false. This tool never checks a signature and never decrypts a JWE.

## Library

```python
from lupaxa.token_decoder import decode_token

print(decode_token(token)["type"])
```

`lupaxa` is a namespace package. There is no `lupaxa/__init__.py`.

## What it Decodes

| Type               | When                                                                                                                     |
| ------------------ | ------------------------------------------------------------------------------------------------------------------------ |
| JWT                | Three segments whose header is JSON and contains `alg`. `exp`, `iat`, and `nbf` gain a UTC reading beside the raw value. |
| JWE                | Five segments whose header is JSON and contains `enc`. The ciphertext is reported, not decrypted.                        |
| JSON               | The token itself is a JSON document.                                                                                     |
| Hexadecimal        | An even-length hex string. UTF-8 text is included when the bytes decode.                                                 |
| Base64 / Base64URL | Standard or URL-safe Base64 that decodes to UTF-8. JSON text is parsed.                                                  |
| Opaque / Unknown   | None of the formats above.                                                                                               |

A leading `Bearer` prefix is ignored. Line wrapping is removed except inside a JSON document.

## Command Line Options

| Option         | Meaning                             |
| -------------- | ----------------------------------- |
| `TOKEN`        | Token to decode.                    |
| `-`            | Read one line from stdin.           |
| `--help`, `-h` | Print the command summary and exit. |
| `--version`    | Print the version and exit.         |

<a href="https://github.com/the-lupaxa-project">
  <img src="https://raw.githubusercontent.com/the-lupaxa-project/brand-assets/master/logos/components/footer-for-child-orgs.svg" alt="The Lupaxa Project Footer" width="100%" />
</a>
