{"id":14483067,"url":"https://github.com/michelp/pgjwt","last_synced_at":"2025-10-09T04:32:23.072Z","repository":{"id":46112873,"uuid":"56994503","full_name":"michelp/pgjwt","owner":"michelp","description":"PostgreSQL implementation of JWT (JSON Web Tokens)","archived":false,"fork":false,"pushed_at":"2023-03-02T19:32:23.000Z","size":29,"stargazers_count":422,"open_issues_count":9,"forks_count":70,"subscribers_count":21,"default_branch":"master","last_synced_at":"2025-10-09T04:32:05.058Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PLpgSQL","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/michelp.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}},"created_at":"2016-04-24T21:11:12.000Z","updated_at":"2025-09-26T23:45:19.000Z","dependencies_parsed_at":"2024-01-17T08:43:41.677Z","dependency_job_id":"2ba1f18c-efcc-40fa-8c99-f1bb69424679","html_url":"https://github.com/michelp/pgjwt","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/michelp/pgjwt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michelp%2Fpgjwt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michelp%2Fpgjwt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michelp%2Fpgjwt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michelp%2Fpgjwt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/michelp","download_url":"https://codeload.github.com/michelp/pgjwt/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michelp%2Fpgjwt/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279000704,"owners_count":26082921,"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","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"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":[],"created_at":"2024-09-03T00:01:28.372Z","updated_at":"2025-10-09T04:32:23.053Z","avatar_url":"https://github.com/michelp.png","language":"PLpgSQL","funding_links":[],"categories":["PLpgSQL"],"sub_categories":[],"readme":"# pgjwt\nPostgreSQL implementation of [JSON Web Tokens](https://jwt.io/)\n\n## Dependencies\n\nThis code requires the pgcrypto extension, included in most\ndistribution's \"postgresql-contrib\" package.  The tests require the\npgtap extension to run.\n\n## Install\n\nYou will require sudo privledges and the postgres development\nlibraries for your operating system in most cases.  For ubuntu on\npostgres 9.5 for example, you can install them with:\n\n    sudo apt-get install postgresql-server-dev-9.5\n\nClone the repository and then run:\n\n    'make install'\n\nThis creates a new extension that can be installed with 'CREATE\nEXTENSION pgjwt;'\n\nTo run the tests install pgtap and run 'pg_prove test/test.sql'.\nAnother approach is to use the docker based test runner, but running\n'./test.sh'.  This will require you have docker installed.\n\n## Usage\n\nCreate a token.  The first argument must be valid json, the second argument any text:\n\n    =\u003e select sign('{\"sub\":\"1234567890\",\"name\":\"John Doe\",\"admin\":true}', 'secret');\n                                                                            sign\n    -------------------------------------------------------------------------------------------------------------------------------------------------------\n     eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.TJVA95OrM7E2cBab30RMHrHDcEfxjoYZgeFONFh7HgQ\n\nVerify a token:\n\n    =\u003e select * from verify('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.TJVA95OrM7E2cBab30RMHrHDcEfxjoYZgeFONFh7HgQ', 'secret');\n               header            |                       payload                       | valid\n    -----------------------------+-----------------------------------------------------+-------\n     {\"alg\":\"HS256\",\"typ\":\"JWT\"} | {\"sub\":\"1234567890\",\"name\":\"John Doe\",\"admin\":true} | t\n\nAlgorithm\n---------\n\nsign() and verify() take an optional algorithm argument that can be\n'HS256', 'HS384' or 'HS512'.  The default is 'HS256':\n\n    =\u003e select sign('{\"sub\":\"1234567890\",\"name\":\"John Doe\",\"admin\":true}', 'secret', 'HS384'),\n\n\n## TODO\n\n* public/private keys when pgcrypto gets *_verify() functions\n\n* SET ROLE and key lookup helper functions\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichelp%2Fpgjwt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmichelp%2Fpgjwt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichelp%2Fpgjwt/lists"}