{"id":28089508,"url":"https://github.com/haikelfazzani/otp","last_synced_at":"2025-05-13T12:59:14.853Z","repository":{"id":241568934,"uuid":"804820092","full_name":"haikelfazzani/otp","owner":"haikelfazzani","description":"🔐 Zero dependencies Deno/Bun/Node/Browser module for TOTP and HOTP generator based on RFC 6238 and RFC 4226 🗝️","archived":false,"fork":false,"pushed_at":"2024-08-14T12:44:17.000Z","size":32,"stargazers_count":5,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-24T22:58:42.252Z","etag":null,"topics":["2fa","browser","bun","cryptography","deno","hotp","nodejs","one-time-password","otp","rfc-6238","rfc4226","security","totp","web-crypto","web-cryptography-api"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/one-time-pass","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/haikelfazzani.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":"2024-05-23T10:34:41.000Z","updated_at":"2024-09-28T21:49:57.000Z","dependencies_parsed_at":null,"dependency_job_id":"68436e0f-8ab7-449f-b517-6e1b1ca2fe7c","html_url":"https://github.com/haikelfazzani/otp","commit_stats":null,"previous_names":["haikelfazzani/otp"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haikelfazzani%2Fotp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haikelfazzani%2Fotp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haikelfazzani%2Fotp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haikelfazzani%2Fotp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/haikelfazzani","download_url":"https://codeload.github.com/haikelfazzani/otp/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253948396,"owners_count":21988953,"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":["2fa","browser","bun","cryptography","deno","hotp","nodejs","one-time-password","otp","rfc-6238","rfc4226","security","totp","web-crypto","web-cryptography-api"],"created_at":"2025-05-13T12:59:14.191Z","updated_at":"2025-05-13T12:59:14.833Z","avatar_url":"https://github.com/haikelfazzani.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# one-time password (OTP) generator\n\n🔐 Deno/Bun/Node/Browser module for TOTP and HOTP generator based on\nRFC 6238 and RFC 4226 🗝️\n\n- Zero dependencies: Works seamlessly across different environments without requiring additional libraries.\n- Supports TOTP and HOTP: Generate both time-based and counter-based one-time passwords\n\n\u003cdiv align=\"center\" style=\"width:100%; text-align:center; margin-bottom:20px;\"\u003e\n  \u003cimg src=\"https://badgen.net/bundlephobia/minzip/one-time-pass\" alt=\"one-time-pass\" /\u003e\n  \u003cimg src=\"https://badgen.net/bundlephobia/dependency-count/one-time-pass\" alt=\"one-time-pass\" /\u003e\n  \u003cimg src=\"https://badgen.net/npm/v/one-time-pass\" alt=\"one-time-pass\" /\u003e\n  \u003cimg src=\"https://badgen.net/npm/dt/one-time-pass\" alt=\"one-time-pass\" /\u003e\n  \u003cimg src=\"https://data.jsdelivr.com/v1/package/npm/one-time-pass/badge\" alt=\"one-time-pass\"/\u003e\n\u003c/div\u003e\n\nTry it out on JSFiddle: [Live Demo](https://jsfiddle.net/HaikelFazzani/e5dz6g2x/2/)\n\n# Install\n\n```\nnpm i one-time-pass\n```\n\n# Usage\n\n## Import\n\n```js\nimport { generateTOTP } from \"one-time-pass\";\n// Deno \nimport { generateTOTP } from \"npm:one-time-pass\";\n// Nodejs\nconst { generateTOTP } = require(\"one-time-pass\");\n\n// Or include it via CDN\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/one-time-pass/dist/index.umd.js\"\u003e\u003c/script\u003e\n\nwindow.otp.generateTOTP(\"key\");\n```\n\n## Examples\n\n**generate TOTP**\n\n```js\nimport { generateTOTP } from \"one-time-pass\";\n\n(async () =\u003e {\n\n  const defaultOptions = {\n    hash: 'SHA-1',\n    timeStep: 30, // epoch interval\n    digits: 6,\n    timestamp: Date.now()\n  }\n\n  const code = await generateTOTP(\"key\", defaultOptions?);\n  console.log(code);\n})();\n```\n\n**generate HOTP**\n\n```js\nimport { generateHOTP } from \"one-time-pass\";\n\n(async () =\u003e {\n  const counter = 14653;\n  const hash = \"SHA-1\";\n  const digits = 6;\n\n  const code = await generateHOTP(\"secretKey\", counter, hash, digits);\n  console.log(code);\n})();\n```\n\n## Ressouces\n\n- [rfc6238](https://datatracker.ietf.org/doc/html/rfc6238)\n- [rfc4226](https://datatracker.ietf.org/doc/html/rfc4226)\n\n### Notes\n\n- We welcome pull requests! Feel free to contribute to this project.\n\n### Author\n\n- [Haikel Fazzani](https://github.com/haikelfazzani)\n\n# License\n\nGNU GENERAL PUBLIC LICENSE V3\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhaikelfazzani%2Fotp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhaikelfazzani%2Fotp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhaikelfazzani%2Fotp/lists"}