{"id":16980971,"url":"https://github.com/guzba/jwtea","last_synced_at":"2025-06-27T13:37:28.937Z","repository":{"id":77099304,"uuid":"591818627","full_name":"guzba/jwtea","owner":"guzba","description":"Brew JSON Web Tokens in pure Nim.","archived":false,"fork":false,"pushed_at":"2023-08-28T18:32:51.000Z","size":61,"stargazers_count":25,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-26T17:46:48.812Z","etag":null,"topics":["jwt","nim"],"latest_commit_sha":null,"homepage":"","language":"Nim","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/guzba.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":"2023-01-22T00:43:42.000Z","updated_at":"2024-09-12T13:20:43.000Z","dependencies_parsed_at":null,"dependency_job_id":"3fd0fc24-44d5-4e6a-bb8b-70c2b525fc04","html_url":"https://github.com/guzba/jwtea","commit_stats":{"total_commits":9,"total_committers":1,"mean_commits":9.0,"dds":0.0,"last_synced_commit":"21d1617996f1928492e665c8008b0b3fc8b4a629"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":"treeform/nimtemplate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guzba%2Fjwtea","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guzba%2Fjwtea/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guzba%2Fjwtea/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guzba%2Fjwtea/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/guzba","download_url":"https://codeload.github.com/guzba/jwtea/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244882220,"owners_count":20525821,"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":["jwt","nim"],"created_at":"2024-10-14T02:04:16.635Z","updated_at":"2025-03-21T23:26:10.449Z","avatar_url":"https://github.com/guzba.png","language":"Nim","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JWTea\n\n`nimble install jwtea`\n\n![Github Actions](https://github.com/guzba/jwtea/workflows/Github%20Actions/badge.svg)\n\n[API reference](https://guzba.github.io/jwtea/)\n\nJWTea enables the creation of JSON Web Tokens in pure Nim, without any dependency on OpenSSL or other external libraries.\n\nOpenSSL is one of the truly legendary sources of programmer pain so this repo was motivated by refusing that dependency.\n\nJWTea does not currently support all JWT algorithms. Two very popular algorithms, including RS256 used by Google, are supported now and support for more can be added.\n\nAlgorithm | Status\n--- | ---:\nHS256 | ✅\nHS384 | ⛔\nHS512 | ⛔\nRS256 | ✅\nRS384 | ⛔\nRS512 | ⛔\nES256 | ⛔\nES384 | ⛔\nES512 | ⛔\nPS256 | ⛔\nPS384 | ⛔\nPS512 | ⛔\n\nTo learn more about JWT, this site is a great reference: https://jwt.io\n\n## How to use JWTea\n\nPer the [JWT spec](https://www.rfc-editor.org/rfc/rfc7519), a JWT is created with 3 parts:\n\n1) A header JSON object.\n2) A claims JSON object.\n3) A secret or private key.\n\nJWTea avoids making it any more complicated than that:\n\n`proc signJwt*(header, claims: JsonNode, secret: string): string`\n\n## Examples\n\n```nim\nimport jwtea, std/json\n\nlet\n  header = %*{\n    \"alg\": \"HS256\",\n    \"typ\": \"JWT\"\n  }\n  claims = %*{\n    \"sub\": \"1234567890\",\n    \"name\": \"John Doe\",\n    \"iat\": 1516239022\n  }\n  secret = \"abcdefghijklmnopqrstuvwxyz0123456789\"\n  jwt = signJwt(header, claims, secret)\n\necho jwt\n```\n\nIf you have an RSA private key, simply pass it to `signJwt` as the secret:\n\n```nim\nimport jwtea, std/json\n\nlet\n  header = %*{\n    \"alg\": \"RS256\",\n    \"typ\": \"JWT\"\n  }\n  claims = %*{\n    \"sub\": \"1234567890\",\n    \"name\": \"John Doe\",\n    \"admin\": true,\n    \"iat\": 1516239022\n  }\n  privateKey = \"\"\"-----BEGIN PRIVATE KEY-----\nMIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQC7VJTUt9Us8cKj\nMzEfYyjiWA4R4/M2bS1GB4t7NXp98C3SC6dVMvDuictGeurT8jNbvJZHtCSuYEvu\nNMoSfm76oqFvAp8Gy0iz5sxjZmSnXyCdPEovGhLa0VzMaQ8s+CLOyS56YyCFGeJZ\nqgtzJ6GR3eqoYSW9b9UMvkBpZODSctWSNGj3P7jRFDO5VoTwCQAWbFnOjDfH5Ulg\np2PKSQnSJP3AJLQNFNe7br1XbrhV//eO+t51mIpGSDCUv3E0DDFcWDTH9cXDTTlR\nZVEiR2BwpZOOkE/Z0/BVnhZYL71oZV34bKfWjQIt6V/isSMahdsAASACp4ZTGtwi\nVuNd9tybAgMBAAECggEBAKTmjaS6tkK8BlPXClTQ2vpz/N6uxDeS35mXpqasqskV\nlaAidgg/sWqpjXDbXr93otIMLlWsM+X0CqMDgSXKejLS2jx4GDjI1ZTXg++0AMJ8\nsJ74pWzVDOfmCEQ/7wXs3+cbnXhKriO8Z036q92Qc1+N87SI38nkGa0ABH9CN83H\nmQqt4fB7UdHzuIRe/me2PGhIq5ZBzj6h3BpoPGzEP+x3l9YmK8t/1cN0pqI+dQwY\ndgfGjackLu/2qH80MCF7IyQaseZUOJyKrCLtSD/Iixv/hzDEUPfOCjFDgTpzf3cw\nta8+oE4wHCo1iI1/4TlPkwmXx4qSXtmw4aQPz7IDQvECgYEA8KNThCO2gsC2I9PQ\nDM/8Cw0O983WCDY+oi+7JPiNAJwv5DYBqEZB1QYdj06YD16XlC/HAZMsMku1na2T\nN0driwenQQWzoev3g2S7gRDoS/FCJSI3jJ+kjgtaA7Qmzlgk1TxODN+G1H91HW7t\n0l7VnL27IWyYo2qRRK3jzxqUiPUCgYEAx0oQs2reBQGMVZnApD1jeq7n4MvNLcPv\nt8b/eU9iUv6Y4Mj0Suo/AU8lYZXm8ubbqAlwz2VSVunD2tOplHyMUrtCtObAfVDU\nAhCndKaA9gApgfb3xw1IKbuQ1u4IF1FJl3VtumfQn//LiH1B3rXhcdyo3/vIttEk\n48RakUKClU8CgYEAzV7W3COOlDDcQd935DdtKBFRAPRPAlspQUnzMi5eSHMD/ISL\nDY5IiQHbIH83D4bvXq0X7qQoSBSNP7Dvv3HYuqMhf0DaegrlBuJllFVVq9qPVRnK\nxt1Il2HgxOBvbhOT+9in1BzA+YJ99UzC85O0Qz06A+CmtHEy4aZ2kj5hHjECgYEA\nmNS4+A8Fkss8Js1RieK2LniBxMgmYml3pfVLKGnzmng7H2+cwPLhPIzIuwytXywh\n2bzbsYEfYx3EoEVgMEpPhoarQnYPukrJO4gwE2o5Te6T5mJSZGlQJQj9q4ZB2Dfz\net6INsK0oG8XVGXSpQvQh3RUYekCZQkBBFcpqWpbIEsCgYAnM3DQf3FJoSnXaMhr\nVBIovic5l0xFkEHskAjFTevO86Fsz1C2aSeRKSqGFoOQ0tmJzBEs1R6KqnHInicD\nTQrKhArgLXX4v3CddjfTRJkFWDbE/CkvKZNOrcf1nhaGCPspRJj2KUkj1Fhl9Cnc\ndn/RsYEONbwQSjIfMPkvxF+8HQ==\n-----END PRIVATE KEY-----\"\"\"\n\necho \"JWT = \", signJwt(header, claims, privateKey)\n```\n\n## Testing\n\n`nimble test`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguzba%2Fjwtea","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fguzba%2Fjwtea","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguzba%2Fjwtea/lists"}