{"id":22819481,"url":"https://github.com/bdfoster/nomatic-jwt","last_synced_at":"2025-03-30T23:13:42.568Z","repository":{"id":52045191,"uuid":"105216610","full_name":"bdfoster/nomatic-jwt","owner":"bdfoster","description":"An opinionated library for encoding, decoding, and verifying JSON Web Tokens (JWTs)","archived":false,"fork":false,"pushed_at":"2023-10-26T00:26:58.000Z","size":170,"stargazers_count":2,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-18T10:11:53.658Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://bdfoster.github.io/nomatic-jwt","language":"TypeScript","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/bdfoster.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-09-29T01:38:47.000Z","updated_at":"2018-06-08T12:32:51.000Z","dependencies_parsed_at":"2025-02-06T04:37:46.619Z","dependency_job_id":"1d4aeacf-0135-4f2f-ba88-5065ac3c8523","html_url":"https://github.com/bdfoster/nomatic-jwt","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bdfoster%2Fnomatic-jwt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bdfoster%2Fnomatic-jwt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bdfoster%2Fnomatic-jwt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bdfoster%2Fnomatic-jwt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bdfoster","download_url":"https://codeload.github.com/bdfoster/nomatic-jwt/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246390872,"owners_count":20769478,"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":[],"created_at":"2024-12-12T15:12:30.199Z","updated_at":"2025-03-30T23:13:42.536Z","avatar_url":"https://github.com/bdfoster.png","language":"TypeScript","funding_links":[],"categories":["库和框架"],"sub_categories":["TypeScript/JavaScript"],"readme":"# nomatic-jwt\n\n[![Greenkeeper badge](https://badges.greenkeeper.io/bdfoster/nomatic-jwt.svg)](https://greenkeeper.io/)\n[![Semantic Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)\n[![GitHub release](https://img.shields.io/github/release/bdfoster/nomatic-jwt.svg)](https://github.com/bdfoster/nomatic-jwt/releases)\n[![npm](https://img.shields.io/npm/v/nomatic-jwt.svg)](https://www.npmjs.com/package/nomatic-jwt)\n[![Build Status](https://travis-ci.org/bdfoster/nomatic-jwt.svg?branch=greenkeeper%2Finitial)](https://travis-ci.org/bdfoster/nomatic-jwt)\n[![Coverage Status](https://coveralls.io/repos/github/bdfoster/nomatic-jwt/badge.svg)](https://coveralls.io/github/bdfoster/nomatic-jwt)\n[![Known Vulnerabilities](https://snyk.io/test/github/bdfoster/nomatic-jwt/badge.svg)](https://snyk.io/test/github/bdfoster/nomatic-jwt)\n[![dependencies Status](https://david-dm.org/bdfoster/nomatic-jwt/status.svg)](https://david-dm.org/bdfoster/nomatic-jwt)\n[![devDependencies Status](https://david-dm.org/bdfoster/nomatic-jwt/dev-status.svg)](https://david-dm.org/bdfoster/nomatic-jwt?type=dev)\n[![License](https://img.shields.io/github/license/bdfoster/nomatic-jwt.svg)](https://github.com/bdfoster/nomatic-jwt/blob/master/LICENSE)\n\nAn opinionated library for encoding, decoding, and verifying JSON Web Tokens (JWTs), heavily inspired by \n[node-jwt-simple](https://github.com/hokaccha/node-jwt-simple).\n\n### Installation\nYou can install from [npm](https://npmjs.com/nomatic-jwt) by doing:\n```bash\nnpm i --save nomatic-jwt\n```\n\n### Basic Usage\n```javascript\nconst JWT = require('nomatic-jwt').JWT;\n\nconst jwt = new JWT({\n    algorithm: 'HS256', // \"HS256\" | \"HS384\" | \"HS512\" | \"RS256\" | \"RS384\" | \"RS512\"\n    expiresIn: 60 * 60, // 1hr\n    key: 'somethingMoreSecureThanThis', // Valid only with HMAC-SHA algorithms\n    timeOffset: 60, // allowable wiggle room for expiration (`exp`) and not valid before (`nbf`) claims\n    validate: true // If false, won't validate when decoding\n});\n\n// Encode\nconst token = jwt.encode({\n    sub: 'user/12345678',\n    roles: ['manager']\n});\n/* eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9\n * .eyJzdWIiOiJ1c2VyLzEyMzQ1Njc4Iiwicm9sZXMiOlsibWFuYWdlciJdLCJleHAiOjE1MDY4Nzk1ODAsIm5iZiI6MTUwNjg3NTk4MCwiaWF0IjoxNTA\n * 2ODc1OTgwfQ\n * .FjHYltcA1Natf6Iu72HyGxkk4GX2phMRG3yNW65_IsQ'\n */\n\n\n// Decode\nconst decoded = jwt.decode(token);\n\n```\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbdfoster%2Fnomatic-jwt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbdfoster%2Fnomatic-jwt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbdfoster%2Fnomatic-jwt/lists"}