{"id":29311500,"url":"https://github.com/abecodes/tkn","last_synced_at":"2025-07-07T08:15:04.007Z","repository":{"id":97065361,"uuid":"466785477","full_name":"abecodes/tkn","owner":"abecodes","description":"Tkn is a cli tool that creates signed JSON Web Tokens from a JSON or YAML description","archived":false,"fork":false,"pushed_at":"2022-03-07T11:51:52.000Z","size":12,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-06-20T05:33:12.978Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/abecodes.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":"2022-03-06T16:01:00.000Z","updated_at":"2022-03-06T16:01:49.000Z","dependencies_parsed_at":"2023-03-13T16:19:40.307Z","dependency_job_id":null,"html_url":"https://github.com/abecodes/tkn","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/abecodes/tkn","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abecodes%2Ftkn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abecodes%2Ftkn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abecodes%2Ftkn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abecodes%2Ftkn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/abecodes","download_url":"https://codeload.github.com/abecodes/tkn/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abecodes%2Ftkn/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264040975,"owners_count":23548077,"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":[],"created_at":"2025-07-07T08:15:02.962Z","updated_at":"2025-07-07T08:15:03.996Z","avatar_url":"https://github.com/abecodes.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# :package: Tkn\n\n**Tkn** is a cli tool that creates signed\n[JSON Web Tokens](https://jwt.io/introduction) from a `JSON` or `YAML`\ndescription.\n\nThe **JWT** can be signed via _secret_ or _RSA key_ and with different\nalgorithms.\n\nThe following algorithms are supported:\n\n- HS256\n- HS384\n- HS512\n- RS256\n- RS384\n- RS512\n- PS256\n- PS384\n- PS512\n\n## :floppy_disk: Install\n\n```bash\ngo install github.com/abecodes/tkn@latest\n```\n\n## :computer: Example\n\nA **JWT** can be described via `JSON`:\n\n```json\n{\n  \"headers\": { \"KID\": \"01SwHRh9DRhSevAE\" },\n  \"payload\": {\n    \"iss\": \"admin\",\n    \"sub\": \"1337\",\n    \"exp\": 16459032010,\n    \"iat\": 1645903201,\n    \"Roles\": [\"ADMIN\", \"USER\"],\n    \"Test\": [\"another\", \"array\", \"here\"],\n    \"hello\": \"world\"\n  }\n}\n```\n\nor `YAML`:\n\n```yaml\nheaders:\n  KID: 01SwHRh9DRhSevAE\npayload:\n  iss: admin\n  sub: '1337'\n  exp: 16459032010\n  iat: 1645903201\n  Roles:\n    - ADMIN\n    - USER\n  Test:\n    - another\n    - array\n    - here\n  hello: world\n```\n\n### Signing with a secret\n\n```bash\ntkn -token token.json -secret '6w9z$C\u0026F)J@NcRfTjWnZr4u7x!A%D*G-' -alg hs256\n```\n\n### Signing with a RSA key\n\n```bash\ntkn -t token.yaml -k path/to/keyfile.pem -a rs256\n```\n\n### Output\n\n**Tkn** will print the generated token as well as _secret_ or _public key_ that\ncan be used to verify its integrity.\n\n```\n-----BEGIN JWT TOKEN-----\neyJLSUQiOiIwMVN3SFJoOURSaFNldkFFIiwiYWxnIjoiSFMyNTYiLCJ0eXAiOiJKV1QiLCJ5b2xvIjoxMjN9.eyJSb2xlcyI6WyJBRE1JTiIsIlVTRVIiXSwiVGVzdCI6WyJhbm90aGVyIiwiYXJyYXkiLCJoZXJlIl0sImV4cCI6MTY0NTkwMzIwMTAsImhlbGxvIjoid29ybGQiLCJpYXQiOjE2NDU5MDMyMDEsImlzcyI6ImFkbWluIiwic3ViIjoiMTMzNyJ9.thTxEWqPozH2WWmiBaVvHIi4tTTAYDBbt4GA3nhhzKY\n-----END JWT TOKEN-----\n\n-----BEGIN SECRET-----\n6w9z$C\u0026F)J@NcRfTjWnZr4u7x!A%D*G-\n-----END SECRET-----\n```\n\n## :clipboard: Options\n\n| Parameter     | Description                                  | Default      |\n| ------------- | -------------------------------------------- | ------------ |\n| -a\u003cbr\u003e-alg    | algorithm used to sign the token             | RS256        |\n| -k\u003cbr\u003e-key    | path to a RSA private key                    | null         |\n| -s\u003cbr\u003e-secret | secret used to sign the token                | null         |\n| -t\u003cbr\u003e-token  | path to a JSON/YAML description of the token | ./token.yaml |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabecodes%2Ftkn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fabecodes%2Ftkn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabecodes%2Ftkn/lists"}