{"id":50527524,"url":"https://github.com/zetcco/decode-jwt","last_synced_at":"2026-06-03T09:03:55.744Z","repository":{"id":358613161,"uuid":"1235230491","full_name":"zetcco/decode-jwt","owner":"zetcco","description":"Script locally decode, format, and compare JSON Web Tokens","archived":false,"fork":false,"pushed_at":"2026-05-18T06:23:04.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-18T08:37:32.004Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zetcco.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-11T06:12:08.000Z","updated_at":"2026-05-18T06:23:36.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/zetcco/decode-jwt","commit_stats":null,"previous_names":["zetcco/decode-jwt"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/zetcco/decode-jwt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zetcco%2Fdecode-jwt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zetcco%2Fdecode-jwt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zetcco%2Fdecode-jwt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zetcco%2Fdecode-jwt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zetcco","download_url":"https://codeload.github.com/zetcco/decode-jwt/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zetcco%2Fdecode-jwt/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33856288,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-03T02:00:06.370Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2026-06-03T09:03:55.009Z","updated_at":"2026-06-03T09:03:55.737Z","avatar_url":"https://github.com/zetcco.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# jwt-decoder\n\nA terminal-focused Bash script to decode, format, and compare JSON Web Tokens (JWTs). It automatically translates UNIX epoch timestamps into human-readable dates using your local or preferred timezone, calculates token expiration lifespans, and provides a direct terminal diff tool for structural debugging.\n\n## How it Works\n\n1. The script validates input structures and automatically adjusts missing base64url padding to decode token segments into raw JSON.\n2. It parses the payload via `jq`, recursively sweeping for standard timestamp claims (`exp`, `iat`, `nbf`) to translate them into localized date-time strings.\n3. It evaluates the current clock against expiration metrics to display real-time status indicators (active, expired, remaining time, and total lifespan).\n4. For comparisons, it isolates and alpha-sorts key fields from two independent payloads to pipe a colorized, unified diff straight to the stdout.\n\n## Prerequisites\n\nThis script requires `jq` for JSON manipulation and timestamp formatting.\n\n```bash\n# macOS\nbrew install jq\n\n# Linux (Debian/Ubuntu)\nsudo apt install jq\n\n```\n\n## Usage\n\n```bash\n# Make executable\nchmod +x jwt-decode.sh\n\n# Decode a single token (autodetects timezone)\n./jwt-decode.sh \u003cjwt-token\u003e [timezone]\n\n# Compare two tokens\n./jwt-decode.sh --diff \u003ctoken1\u003e \u003ctoken2\u003e [timezone]\n\n# List common timezones\n./jwt-decode.sh --list-tz\n\n```\n\n## Examples\n\n### Standard Decode\n\n```bash\n./jwt-decode.sh eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyLCJleHAiOjE1MTYyNDI2MjJ9.signature\n\n```\n\n**Output:**\n\n```text\nActive Timezone: EST\n(Detected from local computer)\n\nHEADER\n------------------------------------------------------------\n{\n  \"alg\": \"HS256\",\n  \"typ\": \"JWT\"\n}\n\nPAYLOAD\n------------------------------------------------------------\nTOKEN METADATA\nCurrent Clock   : May 18, 2026 at 11:37:50 AM EST\nStatus          : EXPIRED (272314 min ago)\nTotal Lifespan  : 1h 0m 0s\n------------------------------------------------------------\n{\n  \"sub\": \"1234567890\",\n  \"name\": \"John Doe\",\n  \"iat\": \"January 18, 2018 at 03:17:02 PM EST\",\n  \"exp\": \"January 18, 2018 at 04:17:02 PM EST\"\n}\n\n```\n\n### Comparing Tokens\n\n```bash\n./jwt-decode.sh --diff \u003ctoken_1\u003e \u003ctoken_2\u003e UTC\n\n```\n\n**Output:**\n\n```text\nCOMPARING TWO TOKENS (TZ: UTC)\n\nLegend: - Token 1 | + Token 2\n\n@@ -1,6 +1,6 @@\n {\n-  \"exp\": \"May 18, 2026 at 12:00:00 PM UTC\",\n-  \"role\": \"user\",\n+  \"exp\": \"May 18, 2026 at 01:00:00 PM UTC\",\n+  \"role\": \"admin\",\n   \"sub\": \"1234567890\"\n }\n------------------------------------------------------------\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzetcco%2Fdecode-jwt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzetcco%2Fdecode-jwt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzetcco%2Fdecode-jwt/lists"}