{"id":26121524,"url":"https://github.com/mkbeh/xjwt","last_synced_at":"2026-06-10T09:31:33.040Z","repository":{"id":281373411,"uuid":"910079512","full_name":"mkbeh/xjwt","owner":"mkbeh","description":"library provides an API for working with JSON Web Token, using jwt-go","archived":false,"fork":false,"pushed_at":"2026-06-01T15:10:34.000Z","size":30,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-06-01T17:10:46.886Z","etag":null,"topics":["auth","ed25519","go","golang","jwt","security"],"latest_commit_sha":null,"homepage":"","language":"Go","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/mkbeh.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-12-30T12:49:15.000Z","updated_at":"2026-06-01T15:42:49.000Z","dependencies_parsed_at":"2025-08-16T16:12:49.985Z","dependency_job_id":"73007dba-9f9c-4037-ac11-aae85a55fc0a","html_url":"https://github.com/mkbeh/xjwt","commit_stats":null,"previous_names":["mkbeh/xjwt"],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/mkbeh/xjwt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkbeh%2Fxjwt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkbeh%2Fxjwt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkbeh%2Fxjwt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkbeh%2Fxjwt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mkbeh","download_url":"https://codeload.github.com/mkbeh/xjwt/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkbeh%2Fxjwt/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34146871,"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-10T02:00:07.152Z","response_time":89,"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":["auth","ed25519","go","golang","jwt","security"],"created_at":"2025-03-10T14:23:36.552Z","updated_at":"2026-06-10T09:31:32.950Z","avatar_url":"https://github.com/mkbeh.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# xjwt\n\n![Go Version](https://img.shields.io/badge/go-1.26+-blue)\n![License](https://img.shields.io/badge/license-MIT-green)\n\nLightweight wrapper around [golang-jwt/jwt](https://github.com/golang-jwt/jwt)\nthat provides a clean API for creating and validating JSON Web Tokens.\n\n## What is a JWT?\n\nJWT.io has [a great introduction](https://jwt.io/introduction) to JSON Web Tokens.\n\nIn short, it's a signed JSON object used for secure data exchange between parties.\nCommonly used for `Bearer` tokens in OAuth 2.0. A token consists of three\nbase64url-encoded parts separated by `.`:\n\n- **Header** — signing algorithm and token type\n- **Claims** — the payload: subject, expiration, custom fields, etc.\n- **Signature** — verifies the token hasn't been tampered with\n\nSee [RFC 7519](https://datatracker.ietf.org/doc/html/rfc7519) for the full spec.\n\n## Requirements\n\n- Go 1.21+\n\n## Installation\n\n```sh\ngo get github.com/mkbeh/xjwt\n```\n\n## Quick Start\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"time\"\n\n\t\"github.com/golang-jwt/jwt/v5\"\n\t\"github.com/mkbeh/xjwt\"\n)\n\ntype MyClaims struct {\n\tjwt.RegisteredClaims\n\tUserID string `json:\"user_id\"`\n}\n\nfunc main() {\n\tmanager, err := xjwt.New(xjwt.WithSecretKey([]byte(\"secret\")))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// Create token\n\ttoken, err := manager.CreateWithClaims(\u0026MyClaims{\n\t\tUserID: \"42\",\n\t\tRegisteredClaims: jwt.RegisteredClaims{\n\t\t\tExpiresAt: xjwt.AddExpiresAt(time.Hour),\n\t\t},\n\t})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Println(\"token:\", token)\n\n\t// Parse and validate token\n\tclaims := \u0026MyClaims{}\n\tif err := manager.ParseWithClaims(\"Bearer \"+token, claims); err != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Printf(\"user_id: %s\\n\", claims.UserID)\n}\n```\n\n## Configuration\n\n| Option                                 | Default  | Description       |\n|----------------------------------------|----------|-------------------|\n| `WithSecretKey([]byte)`                | required | HMAC secret key   |\n| `WithSigningMethod(jwt.SigningMethod)` | `HS256`  | Signing algorithm |\n\n## Error Handling\n\n```go\nimport \"errors\"\n\nerr := manager.ParseWithClaims(tokenString, claims)\nswitch {\n    case errors.Is(err, xjwt.ErrInvalidToken):\n    // malformed or missing token\n    case errors.Is(err, xjwt.ErrInvalidScheme):\n    // missing or wrong scheme (expected Bearer)\n    case errors.Is(err, xjwt.ErrTokenExpired):\n    // token is expired\n    case errors.Is(err, xjwt.ErrInvalidSignature):\n    // signature mismatch\n}\n```\n\n## Examples\n\nMore examples can be found in [/examples](https://github.com/mkbeh/xjwt/tree/main/examples).\n\n## License\n\n[MIT](LICENSE)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmkbeh%2Fxjwt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmkbeh%2Fxjwt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmkbeh%2Fxjwt/lists"}