{"id":13746218,"url":"https://github.com/f0rmiga/sessiongate","last_synced_at":"2025-07-02T06:04:02.109Z","repository":{"id":79852382,"uuid":"83538057","full_name":"f0rmiga/sessiongate","owner":"f0rmiga","description":"⚡️A Redis module that provides session management.","archived":false,"fork":false,"pushed_at":"2023-02-25T03:27:19.000Z","size":89,"stargazers_count":53,"open_issues_count":5,"forks_count":4,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-05-22T15:32:59.273Z","etag":null,"topics":["redis","redis-module","session","session-management","session-manager","session-store","sessionmanager","sessions","sessionstorage","sessionstore"],"latest_commit_sha":null,"homepage":"","language":"C","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/f0rmiga.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":"2017-03-01T09:41:53.000Z","updated_at":"2024-06-20T10:18:20.877Z","dependencies_parsed_at":"2023-06-09T05:30:37.462Z","dependency_job_id":null,"html_url":"https://github.com/f0rmiga/sessiongate","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/f0rmiga/sessiongate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/f0rmiga%2Fsessiongate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/f0rmiga%2Fsessiongate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/f0rmiga%2Fsessiongate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/f0rmiga%2Fsessiongate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/f0rmiga","download_url":"https://codeload.github.com/f0rmiga/sessiongate/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/f0rmiga%2Fsessiongate/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263083562,"owners_count":23411162,"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":["redis","redis-module","session","session-management","session-manager","session-store","sessionmanager","sessions","sessionstorage","sessionstore"],"created_at":"2024-08-03T06:00:50.054Z","updated_at":"2025-07-02T06:04:02.083Z","avatar_url":"https://github.com/f0rmiga.png","language":"C","readme":"[![CircleCI](https://circleci.com/gh/f0rmiga/sessiongate/tree/master.svg?style=svg)](https://circleci.com/gh/f0rmiga/sessiongate/tree/master)\n\n[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Ff0rmiga%2Fsessiongate.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Ff0rmiga%2Fsessiongate?ref=badge_large)\n\n# Session Gate\n\nSession Gate is a Redis module to ease session management using tokens. This module does NOT do user\nmanagement, don't get confused. In the real world, most of the sessions are related to a user but do\nyour crazy logic to manage the users the way you want.\n\n## How it works\n\nThis module provides creation and administration of sessions using tokens. Each session can have\nmore than one payload and those payloads can be accessed individually. A single instance of Redis\nloaded with this module can handle sessions from multiple applications.\n\nRedis is a high performance, in-memory data structure store. This module is built on top of it,\nmeaning this module operates in a very similar way Redis itself operates.\n\nTo access this module, any Redis compatible driver can be used. The commands to operate this module\nare exposed like any other Redis command.\n\nTo know more about Redis modules, follow this [link](http://antirez.com/news/106).\n\n## How to build\n\nThe module is written in C and uses Bazel to build. Bazel manages all the dependencies. :D\n\nThe dependencies are:\n\n- [Redis Modules SDK](https://github.com/RedisLabs/RedisModulesSDK)\n- [Sodium crypto library (libsodium)](https://download.libsodium.org/doc/)\n\n### Building on Linux/OS X\n\nRun:\n\n```txt\nbazel build //:sessiongate.so\n```\n\n### Building on Windows\n\n¯\\\\\\_(ツ)\\_/¯\n\n### Building the Docker image\n\nOn Linux, Docker is necessary only if you want to load the built image into the daemon (which is\nalmost always the case). On OS X and Windows, Docker is always required to be installed.\n\nOn Linux, simply run `bazel run //:sessiongate_image`. It will build and load the image.\n\nOn OS X and Windows, run the script `./build_and_load_image_with_docker.sh`, which uses Docker in\nDocker for building the module and appending it as a layer on top of the Redis image.\n\n## How to run tests\n\nTests are located under `tests/` directory and are written in Python. You should have Python 2.7+\ninstalled in order to run the tests. Run:\n\n```txt\nbazel test //...\n```\n\nFor verbose tests run:\n\n```txt\nbazel test --test_output=all //...\n```\n\n## Loading the module for use\n\nThe module can be loaded in Redis 4+. The most convenient way to do that is by passing --loadmodule\nparameter when starting the Redis server:\n\n```txt\nredis-server --loadmodule \u003cpath_to_sessiongate.so\u003e\n```\n\nFor example, starting Redis open to the world and the Session Gate loaded:\n\n```txt\nredis-server --protected-mode no --loadmodule $(pwd)/bazel-bin/sessiongate.so\n```\n\nJust make sure to pass the right `sessiongate.so` path value to the --loadmodule parameter.\n\n## Commands\n\n### Start a session\n\nCommand: `SESSIONGATE.START \u003csign_key\u003e \u003cttl\u003e`\n\n- `\u003csign_key\u003e` is the secret string used by the HMAC algorithm to generate the token signature.\n- `\u003cttl\u003e` is the positive integer that represents the seconds that the session will live. If set to\n  0, the session expires immediately.\n\n#### Example\n\n```txt\nSESSIONGATE.START 'qwerty' 300\n```\n\nReturns: a token that is used to manage the session.\n\n### Set a session TTL\n\nCommand: `SESSIONGATE.EXPIRE \u003csign_key\u003e \u003ctoken\u003e \u003cttl\u003e`\n\n- `\u003csign_key\u003e` is the secret string used by the HMAC algorithm to verify the token signature.\n- `\u003ctoken\u003e` is the token returned by the START command.\n- `\u003cttl\u003e` is the positive integer that represents the seconds that the session will live. If set to\n  0, the session expires immediately.\n\n#### Example\n\n```txt\nSESSIONGATE.EXPIRE 'qwerty' \u003ctoken\u003e 300\n```\n\nReturns: OK.\n\n### Set a session payload\n\nCommand: `SESSIONGATE.PSET \u003csign_key\u003e \u003ctoken\u003e \u003cpayload_name\u003e \u003cpayload_data\u003e`\n\n- `\u003csign_key\u003e` is the secret string used by the HMAC algorithm to verify the token signature.\n- `\u003ctoken\u003e` is the token returned by the START command.\n- `\u003cpayload_name\u003e` is the payload name that is used to identify the payload data.\n- `\u003cpayload_data\u003e` is the payload data. It can be any string, for example, a JSON stringified\n  object.\n\n#### Example\n\n```txt\nSESSIONGATE.PSET 'qwerty' \u003ctoken\u003e 'user' '{\"name\":\"John Doe\"}'\n```\n\nReturns: OK.\n\n### Get a session payload\n\nCommand: `SESSIONGATE.PGET \u003csign_key\u003e \u003ctoken\u003e \u003cpayload_name\u003e`\n\n- `\u003csign_key\u003e` is the secret string used by the HMAC algorithm to verify the token signature.\n- `\u003ctoken\u003e` is the token returned by the START command.\n- `\u003cpayload_name\u003e` is the payload name that is used to retrieve the payload data.\n\n#### Example\n\n```txt\nSESSIONGATE.PGET 'qwerty' \u003ctoken\u003e 'user'\n```\n\nReturns: a string containing the payload data.\n\n### Delete a session payload\n\nCommand: `SESSIONGATE.PDEL \u003csign_key\u003e \u003ctoken\u003e \u003cpayload_name\u003e`\n\n- `\u003csign_key\u003e` is the secret string used by the HMAC algorithm to verify the token signature.\n- `\u003ctoken\u003e` is the token returned by the START command.\n- `\u003cpayload_name\u003e` is the payload name that is used to identify the payload data being deleted.\n\n#### Example\n\n```txt\nSESSIONGATE.PDEL 'qwerty' \u003ctoken\u003e 'user'\n```\n\nReturns: OK.\n\n### End a session\n\nCommand: `SESSIONGATE.END \u003csign_key\u003e \u003ctoken\u003e`\n\n- `\u003csign_key\u003e` is the secret string used by the HMAC algorithm to verify the token signature.\n- `\u003ctoken\u003e` is the token returned by the START command.\n\n#### Example\n\n```txt\nSESSIONGATE.END 'qwerty' \u003ctoken\u003e\n```\n\nReturns: OK.\n\n## Specific language drivers\n\nHere is a list of drivers implemented in specific languages to ease the use of the SessionGate\nmodule:\n\n### Go\n\nhttps://github.com/f0rmiga/sessiongate-go\n","funding_links":[],"categories":["C"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ff0rmiga%2Fsessiongate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ff0rmiga%2Fsessiongate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ff0rmiga%2Fsessiongate/lists"}