{"id":16471811,"url":"https://github.com/samayun/auth-helper","last_synced_at":"2025-10-12T10:44:31.189Z","repository":{"id":57287699,"uuid":"389642959","full_name":"samayun/auth-helper","owner":"samayun","description":"collection of authentication related helper function","archived":false,"fork":false,"pushed_at":"2021-07-26T15:11:57.000Z","size":22,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-28T10:09:06.692Z","etag":null,"topics":["authentication","authentication-backend","bcryptjs","json-web-token","jwt-authentication"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/jwt-auth-helper","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/samayun.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-07-26T13:29:54.000Z","updated_at":"2022-02-03T09:05:37.000Z","dependencies_parsed_at":"2022-09-16T07:01:44.012Z","dependency_job_id":null,"html_url":"https://github.com/samayun/auth-helper","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/samayun/auth-helper","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samayun%2Fauth-helper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samayun%2Fauth-helper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samayun%2Fauth-helper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samayun%2Fauth-helper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/samayun","download_url":"https://codeload.github.com/samayun/auth-helper/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samayun%2Fauth-helper/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279011056,"owners_count":26084865,"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-12T02:00:06.719Z","response_time":53,"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","authentication-backend","bcryptjs","json-web-token","jwt-authentication"],"created_at":"2024-10-11T12:14:47.224Z","updated_at":"2025-10-12T10:44:31.164Z","avatar_url":"https://github.com/samayun.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# jwt-auth-helper\n\ncollection of authentication related helper function\n\n## Installation\nInstallation is as simple as any other `npm` package:\n\n```\n$ npm install jwt-auth-helper\n```\n\n## Usage\n* hash \u0026 compare password\n* generate \u0026 verify token\n\n\n### Hash data\n\n```js\nconst { BCrypt } = require('jwt-auth-helper');\n\nasync function signup() {\n    const hashedPassword = await BCrypt.makeHash(\"password\");\n    console.log(hashedPassword);\n}\n\nsignup();\n\n```\n\n### compare hashed data\n\n```js\nconst { BCrypt } = require('jwt-auth-helper');\n\nasync function login() {\n    const isMatched = await BCrypt.compareHash(\"password\", \"$2b$10$P6fFTv5nUlIS57E8Yb8qiOk72FdoVgYmfewEcEGUddrgGwXIg5QfO\");\n    console.log(isMatched);\n}\n\nlogin();\n\n```\n\n### Generate encoded data\n\n```js\nconst { JWT } = require('jwt-auth-helper');\n\nconst jwt = new JWT(process.env.SECRET || \"JWT_SECRET_KEY\");\n\nasync function ResponseAuthTokenFromUser() {\n    const authenticateUser = {\n        id: 1,\n        name: \"Samayun Chowdhury\",\n        role: \"ADMIN\",\n        password: null\n    }\n    const access_token = jwt.generateJWTToken(authenticateUser, '5m');\n    console.log(access_token);\n}\n\nResponseAuthTokenFromUser();\n\n```\n\n### decode encoded data\n\n```js\nconst { JWT } = require('jwt-auth-helper');\n\nconst jwt = new JWT(process.env.SECRET || \"JWT_SECRET_KEY\");\n\nasync function verify() {\n    const decodedToken = jwt.verifyToken(\"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwibmFtZSI6IlNhbWF5dW4gQ2hvd2RodXJ5Iiwicm9sZSI6IkFETUlOIiwicGFzc3dvcmQiOm51bGwsImlhdCI6MTYyNzMxMDM4MywiZXhwIjoxNjI3MzEwNjgzfQ.cSrzBWDNzQMWFLdXct-7io_YWKfzz98xmiH76hxQZHY\");\n    console.log(`decodedToken`, decodedToken);\n}\n\nverify();\n\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamayun%2Fauth-helper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsamayun%2Fauth-helper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamayun%2Fauth-helper/lists"}