{"id":13463346,"url":"https://github.com/nov/json-jwt","last_synced_at":"2025-05-14T02:04:49.743Z","repository":{"id":44421771,"uuid":"2386488","full_name":"nov/json-jwt","owner":"nov","description":"JSON Web Token and its family (JSON Web Signature, JSON Web Encryption and JSON Web Key) in Ruby","archived":false,"fork":false,"pushed_at":"2024-10-15T16:02:41.000Z","size":393,"stargazers_count":297,"open_issues_count":2,"forks_count":81,"subscribers_count":13,"default_branch":"main","last_synced_at":"2025-04-25T19:58:14.584Z","etag":null,"topics":["jose","json-web-encryption","json-web-key","json-web-signature","json-web-token","jwe","jwk","jws","jwt"],"latest_commit_sha":null,"homepage":"","language":"Ruby","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/nov.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":"nov"}},"created_at":"2011-09-14T16:09:22.000Z","updated_at":"2025-04-23T13:25:22.000Z","dependencies_parsed_at":"2024-01-13T17:54:59.049Z","dependency_job_id":"344437af-336b-44c1-a339-71ccf8464e99","html_url":"https://github.com/nov/json-jwt","commit_stats":{"total_commits":428,"total_committers":27,"mean_commits":"15.851851851851851","dds":0.3107476635514018,"last_synced_commit":"9160130ed9216c4128e0cdf414fc04376a376c76"},"previous_names":[],"tags_count":96,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nov%2Fjson-jwt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nov%2Fjson-jwt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nov%2Fjson-jwt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nov%2Fjson-jwt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nov","download_url":"https://codeload.github.com/nov/json-jwt/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250930612,"owners_count":21509713,"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":["jose","json-web-encryption","json-web-key","json-web-signature","json-web-token","jwe","jwk","jws","jwt"],"created_at":"2024-07-31T13:00:51.566Z","updated_at":"2025-05-14T02:04:49.715Z","avatar_url":"https://github.com/nov.png","language":"Ruby","readme":"# JSON::JWT\n\nJSON Web Token and its family (JSON Web Signature, JSON Web Encryption and JSON Web Key) in Ruby\n\n## Installation\n\n```\ngem install json-jwt\n```\n\n## Resources\n\n* View Source on GitHub (https://github.com/nov/json-jwt)\n* Report Issues on GitHub (https://github.com/nov/json-jwt/issues)\n* Documentation on GitHub (https://github.com/nov/json-jwt/wiki)\n\n## Examples\n\n```ruby\nrequire 'json/jwt'\n\nprivate_key = OpenSSL::PKey::RSA.new \u003c\u003c-PEM\n-----BEGIN RSA PRIVATE KEY-----\nMIIEpAIBAAKCAQEAyBKIFSH8dP6bDkGBziB6RXTTfZVTaaNSWNtIzDmgRFi6FbLo\n :\n-----END RSA PRIVATE KEY-----\nPEM\n\npublic_key = OpenSSL::PKey::RSA.new \u003c\u003c-PEM\n-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyBKIFSH8dP6bDkGBziB6\n :\n-----END PUBLIC KEY-----\nPEM\n\n# Sign \u0026 Encode\nclaim = {\n  iss: 'nov',\n  exp: 1.week.from_now,\n  nbf: Time.now\n}\njws = JSON::JWT.new(claim).sign(private_key, :RS256)\njws.to_s\n\n# Decode \u0026 Verify\ninput = \"jwt_header.jwt_claims.jwt_signature\"\nJSON::JWT.decode(input, public_key)\n```\n\nIf you need to get a JWK from `jwks_uri` of OpenID Connect IdP, you can use `JSON::JWK::Set::Fetcher` to fetch (\u0026 optionally cache) it.\n\n```ruby\n# JWK Set Fetching \u0026 Caching\n# NOTE: Optionally by setting cache instance, JWKs are cached by kid.\nJSON::JWK::Set::Fetcher.cache = Rails.cache\n\nJSON::JWK::Set::Fetcher.fetch(jwks_uri, kid: kid)\n# =\u003e returns JSON::JWK instance or raise JSON::JWK::Set::KidNotFound\n```\n\nFor more details, read [Documentation Wiki](https://github.com/nov/json-jwt/wiki).\n\n## Note on Patches/Pull Requests\n\n* Fork the project.\n* Make your feature addition or bug fix.\n* Add tests for it. This is important so I don't break it in a\n  future version unintentionally.\n* Commit, do not mess with rakefile, version, or history.\n  (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)\n* Send me a pull request. Bonus points for topic branches.\n\n## Copyright\n\nCopyright (c) 2011 nov matake. See LICENSE for details.\n","funding_links":["https://github.com/sponsors/nov"],"categories":["Security","Ruby","Libraries"],"sub_categories":["Security Tools","Ruby"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnov%2Fjson-jwt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnov%2Fjson-jwt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnov%2Fjson-jwt/lists"}