{"id":15965238,"url":"https://github.com/bwplotka/go-jwt","last_synced_at":"2025-12-15T09:21:29.021Z","repository":{"id":57535899,"uuid":"87803502","full_name":"bwplotka/go-jwt","owner":"bwplotka","description":"Golang JSON Web Token builder with easy to use API for JWS and nested JWT (JWS+JWE)","archived":false,"fork":false,"pushed_at":"2017-05-22T13:11:35.000Z","size":24,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-19T13:33:45.343Z","etag":null,"topics":["go","jsonwebtoken","jwe","jws","jwt"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bwplotka.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}},"created_at":"2017-04-10T11:33:34.000Z","updated_at":"2023-10-04T16:52:24.000Z","dependencies_parsed_at":"2022-08-29T00:41:04.352Z","dependency_job_id":null,"html_url":"https://github.com/bwplotka/go-jwt","commit_stats":null,"previous_names":["bplotka/go-jwt"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bwplotka%2Fgo-jwt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bwplotka%2Fgo-jwt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bwplotka%2Fgo-jwt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bwplotka%2Fgo-jwt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bwplotka","download_url":"https://codeload.github.com/bwplotka/go-jwt/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":232031973,"owners_count":18462965,"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":["go","jsonwebtoken","jwe","jws","jwt"],"created_at":"2024-10-07T17:40:29.566Z","updated_at":"2025-10-09T08:07:52.528Z","avatar_url":"https://github.com/bwplotka.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-jwt [![JWT Compatible](https://jwt.io/assets/badge-compatible.svg)](https://jwt.io)\n\n[![Build Status](https://travis-ci.org/Bplotka/go-jwt.svg?branch=master)](https://travis-ci.org/Bplotka/go-jwt) [![Go Report Card](https://goreportcard.com/badge/github.com/Bplotka/go-jwt)](https://goreportcard.com/report/github.com/Bplotka/go-jwt)\nGolang JSON Web Token builder with easy to use API for JWS and nested JWT (JWS+JWE)\n\nIt wraps and is inspired by [gopkg.in/square/go-jose.v2](https://github.com/square/go-jose/tree/v2.1.0) (especially `jwt` subpackage)\n\nNOTE: Please, make sure you get fixed version of go-jose.v2. https://github.com/square/go-jose/issues/142\n\n## Usage:\n\n```go\npackage main\n\nimport (\n    \"fmt\"\n    \"github.com/Bplotka/go-jwt\"\n)\n\nfunc main() {\n    p := \"some_payload\"\n    cl := jwt.Claims{\n        // Your standard claims here...\n    }\n    \n    b, err := jwt.NewDefaultBuilder() // or jwt.NewBuilder(rsaPrvKey, signAlg, keyAlg, contentAlg)\n    if err != nil {\n        // Handle error here...\n    }\n    \n    token, err := b.SignedAndEncryptedJWT().\n        Claims(cl).\n        Payload(p).\n        CompactSerialize()\n    if err != nil {\n        // Handle error here...\n    }\n    \n    // Generated valid nested JWT in `token` variable!\n    // (....)\n    // Let's revert the process:\n     \n    obtainer := b.FromSignedAndEncryptedJWT(token)\n    \n    var fetched string\n    err = obtainer.Payload(\u0026fetched)\n    if err != nil {\n        // Handle error here..\n    }\n    \n    // We have \"some_payload\" again in `fetched` variable.\n    \n    fetchedStdClaims, err := obtainer.StdClaims()\n    if err != nil {\n        // Handle error here..\n    }\n    \n    // We have our standard claims again in `fetchedStdClaims` variable.\n    fmt.Println(fetchedStdClaims.Issuer)\n    fmt.Println(fetchedStdClaims.Subject)\n    // ...\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbwplotka%2Fgo-jwt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbwplotka%2Fgo-jwt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbwplotka%2Fgo-jwt/lists"}