{"id":28122432,"url":"https://github.com/eggjs-community/egg-otp","last_synced_at":"2025-05-14T08:13:52.823Z","repository":{"id":57220659,"uuid":"122952809","full_name":"eggjs-community/egg-otp","owner":"eggjs-community","description":"One time password plugin for eggjs.","archived":false,"fork":false,"pushed_at":"2019-03-10T03:51:43.000Z","size":95,"stargazers_count":5,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-01T01:17:39.695Z","etag":null,"topics":["egg-otp","egg-plugin","eggjs","hotp","totp"],"latest_commit_sha":null,"homepage":null,"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/eggjs-community.png","metadata":{"files":{"readme":"README.md","changelog":"History.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":"2018-02-26T10:22:00.000Z","updated_at":"2023-03-10T12:00:08.000Z","dependencies_parsed_at":"2022-08-29T04:01:33.644Z","dependency_job_id":null,"html_url":"https://github.com/eggjs-community/egg-otp","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggjs-community%2Fegg-otp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggjs-community%2Fegg-otp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggjs-community%2Fegg-otp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggjs-community%2Fegg-otp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eggjs-community","download_url":"https://codeload.github.com/eggjs-community/egg-otp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254101547,"owners_count":22014909,"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":["egg-otp","egg-plugin","eggjs","hotp","totp"],"created_at":"2025-05-14T08:13:37.709Z","updated_at":"2025-05-14T08:13:52.818Z","avatar_url":"https://github.com/eggjs-community.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# egg-otp\n\n[![NPM version][npm-image]][npm-url]\n[![build status][travis-image]][travis-url]\n[![npm download][download-image]][download-url]\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Feggjs-community%2Fegg-otp.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Feggjs-community%2Fegg-otp?ref=badge_shield)\n\n[npm-image]: https://img.shields.io/npm/v/egg-otp.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/egg-otp\n[travis-image]: https://img.shields.io/travis/eggjs-community/egg-otp.svg?style=flat-square\n[travis-url]: https://travis-ci.org/eggjs-community/egg-otp\n[download-image]: https://img.shields.io/npm/dm/egg-otp.svg?style=flat-square\n[download-url]: https://npmjs.org/package/egg-otp\n\nOne time password plugin for eggjs.\n\n## Install\n\n```bash\n$ npm i egg-otp --save\n```\n\n## Usage\n\n```js\n// {app_root}/config/plugin.js\nexports.otp = {\n  enable: true,\n  package: 'egg-otp',\n};\n// {app_root}/controller/home.js\nconst key = ctx.otp.generateOtpKey();\nconst token = ctx.otp.hotp.gen(key, {counter: 0});\nctx.otp.hotp.verify(token, key, {counter: 0, window: 10});\n```\nyou can see [lib/hotp.js](lib/hotp.js) AND [lib/totp.js](lib/totp.js) for more option.\n\n## Configuration\n\nsee [config/config.default.js](config/config.default.js) for more detail.\n\n## License\n\n[MIT](LICENSE)\n\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Feggjs-community%2Fegg-otp.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Feggjs-community%2Fegg-otp?ref=badge_large)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feggjs-community%2Fegg-otp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feggjs-community%2Fegg-otp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feggjs-community%2Fegg-otp/lists"}