{"id":13828763,"url":"https://github.com/lmammino/jwtinfo","last_synced_at":"2025-04-07T17:09:49.383Z","repository":{"id":62441489,"uuid":"227074820","full_name":"lmammino/jwtinfo","owner":"lmammino","description":"A command-line tool to get information about JWTs (Json Web Tokens)","archived":false,"fork":false,"pushed_at":"2024-08-27T10:35:45.000Z","size":116,"stargazers_count":77,"open_issues_count":6,"forks_count":9,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-31T14:12:43.775Z","etag":null,"topics":["cli","helper","info","inspector","jwt","jwtinfo","token"],"latest_commit_sha":null,"homepage":"https://loige.co","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lmammino.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-12-10T09:11:08.000Z","updated_at":"2025-03-09T11:52:40.000Z","dependencies_parsed_at":"2024-10-23T05:33:33.685Z","dependency_job_id":null,"html_url":"https://github.com/lmammino/jwtinfo","commit_stats":{"total_commits":75,"total_committers":5,"mean_commits":15.0,"dds":0.1333333333333333,"last_synced_commit":"4c8e56632f121724f40bf30ad2c72110e36e93c0"},"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lmammino%2Fjwtinfo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lmammino%2Fjwtinfo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lmammino%2Fjwtinfo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lmammino%2Fjwtinfo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lmammino","download_url":"https://codeload.github.com/lmammino/jwtinfo/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247694876,"owners_count":20980733,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","helper","info","inspector","jwt","jwtinfo","token"],"created_at":"2024-08-04T09:03:07.268Z","updated_at":"2025-04-07T17:09:49.355Z","avatar_url":"https://github.com/lmammino.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# jwtinfo\n\n[![build badge](https://github.com/lmammino/jwtinfo/workflows/Rust/badge.svg)](https://github.com/lmammino/jwtinfo/actions?query=workflow%3ARust)\n[![codecov](https://codecov.io/gh/lmammino/jwtinfo/graph/badge.svg?token=jYukD16Axe)](https://codecov.io/gh/lmammino/jwtinfo)\n[![crates.io badge](https://img.shields.io/crates/v/jwtinfo.svg)](https://crates.io/crates/jwtinfo)\n[![Documentation](https://docs.rs/jwtinfo/badge.svg)](https://docs.rs/jwtinfo)\n[![rustc badge](https://img.shields.io/badge/rustc-1.40+-lightgray.svg)](https://blog.rust-lang.org/2019/12/19/Rust-1.40.0.html)\n[![Clippy Linting Result](https://img.shields.io/badge/clippy-\u003c3-yellowgreen)](https://github.com/rust-lang/rust-clippy)\n[![License: MIT OR Apache-2.0](https://img.shields.io/crates/l/jwtinfo.svg)](#license)\n[![Gitpod Ready-to-Code](https://img.shields.io/badge/Gitpod-Ready--to--Code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/lmammino/jwtinfo)\n\nA command line tool to get information about\n[JWTs](https://tools.ietf.org/html/rfc7519) (Json Web Tokens).\n\n## Usage\n\n`jwtinfo` is a command line interface that allows you to inspect a given JWT.\nThe tool currently allows to see the body of the token in JSON format. It\naccepts a single command line argument which should be a valid JWT.\n\nHere's an example:\n\n```bash\njwtinfo eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c\n```\n\nWhich will print:\n\n```json\n{ \"sub\": \"1234567890\", \"name\": \"John Doe\", \"iat\": 1516239022 }\n```\n\nIf you want to visualize the token header (rather than the body), you can do\nthat by passing the `--header` flag:\n\n```bash\njwtinfo --header eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c\n```\n\nWhich will print:\n\n```json\n{ \"alg\": \"HS256\", \"typ\": \"JWT\" }\n```\n\nYou can combine the tool with other command line utilities, for instance\n[`jq`](https://stedolan.github.io/jq/):\n\n```bash\njwtinfo eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c | jq .\n```\n\n## Install\n\nYou can install the binary in several ways:\n\n### Cargo\n\nYou can install the binary in your system with\n[`cargo`](https://doc.rust-lang.org/cargo/getting-started/installation.html):\n\n```bash\ncargo install jwtinfo\n```\n\nAt this point `jwtinfo` will be available as a binary in your system.\n\n### Install script\n\nThe following script will download and install precompiled binaries from the\nlatest GitHub release\n\n```bash\ncurl https://raw.githubusercontent.com/lmammino/jwtinfo/main/install.sh | sh\n```\n\nBy default, it will install the binary in `/usr/local/bin`. You can customize\nthis by setting the `INSTALL_DIRECTORY` environment variable before running the\nscript (e.g. `INSTALL_DIRECTORY=$HOME` will install the binary in `$HOME/bin`).\n\nIf you want to install a specific release you can set the `RELEASE_TAG`\nenvironment variable to point to your target version before running the script\n(e.g. `RELESE_TAG=v0.1.7`).\n\n### Precompiled binaries\n\nPre-compiled binaries for x64 (Windows, macOs and Unix) and ARMv7 are available\nin the [Releases](https://github.com/lmammino/jwtinfo/releases) page.\n\n### Using Nix\n\nIf you are using [Nix](https://nixos.org/), you can install the `jwtinfo` binary\nwith the following command:\n\n```bash\nnix profile install github:lmammino/jwtinfo\n```\n\nOr, if you prefer to use a configuration file, you can add the following to your\nflake:\n\n```nix\njwtinfo = {\n    url = \"github:lmammino/jwtinfo\";\n    inputs.nixpkgs.follows = \"nixpkgs\"; \n};\n\n# ... with home.nix\nhome.packages = [ inputs.jwtinfo.packages.\"x86_64-linux\".default ];\n\n# ... with configuration.nix\nenvironment.systemPackages = [ inputs.jwtinfo.packages.\"x86_64-linux\".default ];\n```\n\nMake sure to replace `\"x86_64-linux\"` with your target platform.\n\nYou can also just try it out in a Nix shell with:\n\n```bash\nnix shell github:lmammino/jwtinfo -c jwtinfo \u003csome_jwt_token\u003e\n```\n\nFinally, for development purposes, you can clone this repo and then run:\n\n```bash\nnix develop\n```\n\n#### Alternatives\n\nIf you don't want to install a binary for debugging JWT, a super simple `bash`\nalternative called\n[`jwtinfo.sh`](https://gist.github.com/lmammino/920ee0699af627a3492f86c607c859f6)\nis available.\n\n## Programmatic usage\n\nInstall with cargo:\n\n```toml\n[dependencies]\njwtinfo = \"*\"\n```\n\nThen use it in your code\n\n```rust\nuse jwtinfo::{jwt};\nlet token_str = \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c\";\nlet token = jwt::parse(token_str).unwrap();\nassert_eq!(token.header.to_string(), \"{\\\"alg\\\":\\\"HS256\\\",\\\"typ\\\":\\\"JWT\\\"}\");\nassert_eq!(token.body.to_string(), \"{\\\"iat\\\":1516239022,\\\"name\\\":\\\"John Doe\\\",\\\"sub\\\":\\\"1234567890\\\"}\");\n```\n\nSince `jwt:Token` implements `str::FromStr`, you can also do the following:\n\n```rust\nuse jwtinfo::{jwt};\nlet token = \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c\".parse::\u003cjwt::Token\u003e().unwrap();\nassert_eq!(token.header.to_string(), \"{\\\"alg\\\":\\\"HS256\\\",\\\"typ\\\":\\\"JWT\\\"}\");\nassert_eq!(token.body.to_string(), \"{\\\"iat\\\":1516239022,\\\"name\\\":\\\"John Doe\\\",\\\"sub\\\":\\\"1234567890\\\"}\");\n```\n\n## Coverage reports\n\nIf you want to run coverage reports locally you can follow this recipe.\n\nFirst of all you will need Rust Nightly that you can get with `rustup`\n\n```bash\nrustup install nightly\n```\n\nYou will also need `grcov` that you can get with `cargo`:\n\n```bash\ncargo install grcov\n```\n\nNow you can run the tests in profile mode:\n\n```bash\nexport CARGO_INCREMENTAL=0\nexport RUSTFLAGS=\"-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Zno-landing-pads\"\ncargo +nightly test\n```\n\nThis will run your tests and generate coverage info in `./target/debug/`\n\nNow we can run `grcov`:\n\n```bash\ngrcov ./target/debug/ -s . -t html --llvm --branch --ignore-not-existing -o ./target/debug/coverage/\n```\n\nFinally you will have your browsable coverage report at\n`./target/debug/coverage/index.html`.\n\n### Tarpaulin coverage\n\nSince `grcov` tends to be somewhat inaccurate at times, you can also get a\ncoverage report by running [tarpaulin](https://github.com/xd009642/tarpaulin)\nusing docker:\n\n```bash\ndocker run --security-opt seccomp=unconfined -v \"${PWD}:/volume\" xd009642/tarpaulin:develop-nightly bash -c 'cargo build \u0026\u0026 cargo tarpaulin -o Html'\n```\n\nYour coverage report will be available as `tarpaulin-report.html` in the root of\nthe project.\n\n## Credits\n\nA special thank you goes to the\n[Rust Reddit community](https://www.reddit.com/r/rust/) for providing a lot of\nuseful suggestions on how to improve this project. A special thanks goes to:\n[mardiros](https://www.reddit.com/user/mardiros/),\n[matthieum](https://www.reddit.com/user/matthieum/),\n[steveklabnik1](https://www.reddit.com/user/steveklabnik1/),\n[ESBDB](https://www.reddit.com/user/ESBDB/),\n[Dushistov](https://www.reddit.com/user/Dushistov/),\n[Doddzilla7](https://www.reddit.com/user/Doddzilla7/). Another huge thank you\ngoes to the\n[Rust stackoverflow community](https://chat.stackoverflow.com/rooms/62927/rust),\nespecially to [Denys Séguret](https://chat.stackoverflow.com/users/263525).\n\nBig thanks also go to [Tim McNamara](https://twitter.com/timClicks) for\nconducting a\n[live code review](https://loige.co/learning-rust-through-open-source-and-live-code-reviews)\nof this codebase.\n\n## Contributing\n\nEveryone is very welcome to contribute to this project. You can contribute just\nby submitting bugs or suggesting improvements by\n[opening an issue on GitHub](https://github.com/lmammino/jwtinfo/issues).\n\n## License\n\nLicensed under [MIT License](LICENSE). © Luciano Mammino \u0026 Stefano Abalsamo.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flmammino%2Fjwtinfo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flmammino%2Fjwtinfo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flmammino%2Fjwtinfo/lists"}