{"id":16432513,"url":"https://github.com/guzart/toktok","last_synced_at":"2025-02-25T14:49:04.003Z","repository":{"id":62559233,"uuid":"84750968","full_name":"guzart/toktok","owner":"guzart","description":"JWT authentication for Ruby","archived":false,"fork":false,"pushed_at":"2017-03-22T00:54:19.000Z","size":29,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-08T12:47:02.212Z","etag":null,"topics":["jwt-authentication","ruby"],"latest_commit_sha":null,"homepage":null,"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/guzart.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-03-12T19:23:33.000Z","updated_at":"2017-03-18T02:43:03.000Z","dependencies_parsed_at":"2022-11-03T11:15:43.480Z","dependency_job_id":null,"html_url":"https://github.com/guzart/toktok","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guzart%2Ftoktok","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guzart%2Ftoktok/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guzart%2Ftoktok/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guzart%2Ftoktok/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/guzart","download_url":"https://codeload.github.com/guzart/toktok/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240689842,"owners_count":19841947,"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-authentication","ruby"],"created_at":"2024-10-11T08:43:38.417Z","updated_at":"2025-02-25T14:49:03.600Z","avatar_url":"https://github.com/guzart.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Toktok\n\n[![Build Status](https://travis-ci.org/guzart/toktok.svg?branch=master)](https://travis-ci.org/guzart/toktok)\n[![codecov](https://codecov.io/gh/guzart/toktok/branch/master/graph/badge.svg)](https://codecov.io/gh/guzart/toktok)\n[![Code Climate](https://codeclimate.com/github/guzart/toktok/badges/gpa.svg)](https://codeclimate.com/github/guzart/toktok)\n[![Gem Version](https://badge.fury.io/rb/toktok.svg)](https://badge.fury.io/rb/toktok)\n\n\nJWT Authentication for Ruby\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'toktok'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install toktok\n\n## Usage\n\n**Configuration**\n\n```ruby\n# 'none' | 'HS256' | 'RS256' | 'ES256'\nToktok.algorithm = 'HS256'\n\n# REQUIRED unless algorithm = 'none'\nToktok.secret_key = ENV['SECRET_KEY_BASE']\n\n# OPTIONAL – in seconds\nToktok.lifetime = nil\n```\n\n**Encode/Decode**\n\n```ruby\ntoken = Toktok::Token.new(identity: 'guzart', payload: { message: 'Hola' })\nputs token.jwt # 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1...'\n\ntoken = Toktok::Token.new(jwt: 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1...')\nputs token.identity # 'guzart'\nputs token.payload # { sub: 'guzart', message: 'Hola' }\n```\n\n## Claims\n\n### Subject Claim\n\nToktok uses the required `identity` argument as the payload `sub` attribute defined\nby the [JWT Subject Claim](https://tools.ietf.org/html/rfc7519#section-4.1.2).\n\n### Expiration Time Claim\n\nToktok automatically calculates the token expiration using the `Toktok.lifetime` configuration\nvalue and sets the `exp` attribute defined by the\n[JWT Expiration Time Claim](https://tools.ietf.org/html/rfc7519#section-4.1.4)\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests.\nYou can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version,\nupdate the version number in `version.rb`, and then run `bundle exec rake release`, which will create\na git tag for the version, push git commits and tags, and push the `.gem` file to\n[rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/guzart/toktok.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguzart%2Ftoktok","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fguzart%2Ftoktok","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguzart%2Ftoktok/lists"}