{"id":19610615,"url":"https://github.com/justinsisley/tokenpress","last_synced_at":"2026-05-11T12:36:18.489Z","repository":{"id":57377756,"uuid":"87609302","full_name":"justinsisley/tokenpress","owner":"justinsisley","description":"A JWT utility belt for JavaScript applications","archived":false,"fork":false,"pushed_at":"2020-01-04T04:43:30.000Z","size":33,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-10-27T05:51:42.067Z","etag":null,"topics":["authentication","javascript","jwt","nodejs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/justinsisley.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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-08T05:00:48.000Z","updated_at":"2020-01-04T04:43:28.000Z","dependencies_parsed_at":"2022-09-26T16:41:53.501Z","dependency_job_id":null,"html_url":"https://github.com/justinsisley/tokenpress","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/justinsisley/tokenpress","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justinsisley%2Ftokenpress","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justinsisley%2Ftokenpress/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justinsisley%2Ftokenpress/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justinsisley%2Ftokenpress/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/justinsisley","download_url":"https://codeload.github.com/justinsisley/tokenpress/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justinsisley%2Ftokenpress/sbom","scorecard":{"id":544166,"data":{"date":"2025-08-11","repo":{"name":"github.com/justinsisley/tokenpress","commit":"2973a37c110ed63651a5cbd498818f51a004fe95"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-20T09:01:11.848Z","repository_id":57377756,"created_at":"2025-08-20T09:01:11.848Z","updated_at":"2025-08-20T09:01:11.848Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32894945,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-10T13:40:02.631Z","status":"online","status_checked_at":"2026-05-11T02:00:05.975Z","response_time":120,"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":["authentication","javascript","jwt","nodejs"],"created_at":"2024-11-11T10:31:09.857Z","updated_at":"2026-05-11T12:36:18.472Z","avatar_url":"https://github.com/justinsisley.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg alt=\"tokenpress\" src=\"https://image.flaticon.com/icons/svg/929/929429.svg\" width=\"120\"\u003e\n\u003c/p\u003e\n\n\u003ch3 align=\"center\"\u003e\n  tokenpress\n\u003c/h3\u003e\n\n\u003cp align=\"center\"\u003e\n  A JWT utility belt for JavaScript applications\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/justinsisley/tokenpress/blob/master/CHANGELOG.md\"\u003e\u003cimg src=\"https://img.shields.io/github/release/justinsisley/tokenpress.svg?style=for-the-badge\" alt=\"GitHub release\" /\u003e\u003c/a\u003e \u003ca href=\"https://circleci.com/gh/justinsisley/tokenpress\"\u003e\u003cimg src=\"https://img.shields.io/circleci/project/github/justinsisley/tokenpress.svg?style=for-the-badge\" alt=\"CircleCI\" /\u003e\u003c/a\u003e \u003ca href=\"https://github.com/justinsisley/tokenpress/blob/master/LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/github/license/justinsisley/tokenpress.svg?style=for-the-badge\" alt=\"license\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n---\n\n# Table of Contents\n\n- [Features](#features)\n- [Documentation](#documentation)\n  - [Installation](#installation)\n  - [Node.js](#nodejs)\n  - [Browser](#browser)\n  - [Contributing](#contributing)\n    - [Linting](#linting)\n    - [Testing](#testing)\n- [Releases](https://github.com/justinsisley/tokenpress/blob/master/CHANGELOG.md)\n- [Credits](#credits)\n\n# Features\n\n- __Convenient, universal utilities for handling JWTs__\n- __JWTs generated by [node-jsonwebtoken](https://github.com/auth0/node-jsonwebtoken)__\n- __Runs on Node.js v8+__\n\n# Documentation\n\n## Installation\n\n```bash\nnpm install tokenpress\n```\n\n## Node.js\n\nConfigure tokenpress before using it:\n\n```javascript\nconst tokenpress = require('tokenpress');\n\ntokenpress.configure({\n  // Required: string or buffer containing the secret for HMAC algorithms\n  secret: 'CHANGE_THIS_SECRET',\n  // Required: string describing a time span zeit/ms. Eg: 60, \"2 days\", \"10h\", \"7d\"\n  expiresIn: '30 days',\n  // Optional: Minimum and maximum token lengths for getURLSafeToken utility\n  minTokenLength: 30,\n  maxTokenLength: 50,\n});\n```\n\nSign a token:\n\n```javascript\nconst tokenpress = require('tokenpress');\n\nconst token = tokenpress.jwt.sign({\n  username: 'clever_username_ftw',\n  role: 'USER',\n});\n```\n\nVerify a token using JWKS:\n\n```javascript\nconst tokenpress = require('tokenpress');\n\ntokenpress.configure({\n  algorithms: ['RS256'],\n  audience: 'my audience',\n  issuer: `https://my-app.com/`,\n  jwksUri: `https://my-app.com/jwks.json`,\n});\n\nconst someToken = 'blah.blah.blah';\ntokenpress.jwt.verifyWithJWKS(someToken).then((decodedJWT) =\u003e {\n  console.log(decodedJWT)\n});\n```\n\nUse tokenpress middleware to require authentication for a route:\n\n```javascript\nconst tokenpress = require('tokenpress');\nconst { requireAuth } = tokenpress.middleware;\n\nrouter.get('/user/account', requireAuth, (req, res) =\u003e {\n  // req.jwt contains the decoded JWT\n  const { username, role } = req.jwt;\n\n  res.json({ username, role });\n});\n```\n\n\u003e Note: If the authentication check fails, a 401 (unauthorized) response will be sent as JSON. The response will contain an `error` property that will equal either `EXPIRED_TOKEN` or `INVALID_TOKEN`. `INVALID_TOKEN` can be caused by any of the conditions listed in the [jsonwebtoken docs](https://github.com/auth0/node-jsonwebtoken#jsonwebtokenerror).\n\nGenerate a random, variable-length, hexadecimal string using the crypto.randomBytes function. The minumum length defaults to 30, and the maximum length defaults to 50.\n\n```javascript\nconst tokenpress = require('tokenpress');\n\nconst randomToken = tokenpress.utils.getURLSafeToken();\n```\n\n## Browser\n\nOptionally configure whether to use sessionStorage as opposed to localStorage for storing tokens on the client. By default, localStorage will be used.\n\n```javascript\nimport tokenpress from 'tokenpress/browser';\n\ntokenpress.configure({\n  useSessionStorage: true,\n});\n```\n\nOptionally configure the key used when saving to localStorage or sessionStorage. Defaults to `token`.\n\n```javascript\nimport tokenpress from 'tokenpress/browser';\n\ntokenpress.configure({\n  storageKey: 'custom-token-name',\n});\n```\n\nSave a token to localStorage/sessionStorage:\n\n```javascript\nimport tokenpress from 'tokenpress/browser';\n\nmockFunctionToGetTokenFromServer().then((token) =\u003e {\n  tokenpress.save(token)\n});\n```\n\nRetrieve a token from localStorage/sessionStorage:\n\n```javascript\nimport tokenpress from 'tokenpress/browser';\n\nconst token = tokenpress.get();\n```\n\nDelete a token from localStorage/sessionStorage:\n\n```javascript\nimport tokenpress from 'tokenpress/browser';\n\ntokenpress.delete();\n```\n\nDetermine if a token is expired:\n\n```javascript\nimport tokenpress from 'tokenpress/browser';\n\n// Will fetch token from localStorage/sessionStorage by default\nconst isTokenExpired = tokenpress.isExpired();\nconsole.log(isTokenExpired); // true or false\n\n// Or, check a token you've previously retrieved\nconst token = tokenpress.get();\nconst isMyOtherTokenExpired = tokenpress.isExpired(token);\nconsole.log(isMyOtherTokenExpired); // true or false\n```\n\n# Contributing\n\n## Linting\n\nRun ESLint with `npm run lint`.\n\n## Testing\n\nRun unit tests with `npm test`.\n\n# Credits\n\u003cdiv\u003eIcon made by \u003ca href=\"http://www.freepik.com\" title=\"Freepik\"\u003eFreepik\u003c/a\u003e from \u003ca href=\"https://www.flaticon.com/\" title=\"Flaticon\"\u003ewww.flaticon.com\u003c/a\u003e is licensed by \u003ca href=\"http://creativecommons.org/licenses/by/3.0/\" title=\"Creative Commons BY 3.0\" target=\"_blank\"\u003eCC 3.0 BY\u003c/a\u003e\u003c/div\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjustinsisley%2Ftokenpress","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjustinsisley%2Ftokenpress","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjustinsisley%2Ftokenpress/lists"}