{"id":27446906,"url":"https://github.com/aegisjsproject/otp","last_synced_at":"2025-09-06T17:34:14.552Z","repository":{"id":287949390,"uuid":"966292451","full_name":"AegisJSProject/otp","owner":"AegisJSProject","description":"An OTP library written using the `crypto` API","archived":false,"fork":false,"pushed_at":"2025-08-30T16:18:46.000Z","size":442,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-30T18:21:45.086Z","etag":null,"topics":["crypto","node","npm","otp","totp"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@aegisjsproject/otp","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/AegisJSProject.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"shgysk8zer0","liberapay":"shgysk8zer0"}},"created_at":"2025-04-14T17:43:02.000Z","updated_at":"2025-08-30T16:18:48.000Z","dependencies_parsed_at":"2025-07-05T03:12:41.893Z","dependency_job_id":"0fdf8722-5700-47d7-a56c-3783fef687f8","html_url":"https://github.com/AegisJSProject/otp","commit_stats":null,"previous_names":["aegisjsproject/otp"],"tags_count":2,"template":false,"template_full_name":"shgysk8zer0/npm-template","purl":"pkg:github/AegisJSProject/otp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AegisJSProject%2Fotp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AegisJSProject%2Fotp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AegisJSProject%2Fotp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AegisJSProject%2Fotp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AegisJSProject","download_url":"https://codeload.github.com/AegisJSProject/otp/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AegisJSProject%2Fotp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273936089,"owners_count":25194100,"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-09-06T02:00:13.247Z","response_time":2576,"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":["crypto","node","npm","otp","totp"],"created_at":"2025-04-15T05:59:20.838Z","updated_at":"2025-09-06T17:34:14.517Z","avatar_url":"https://github.com/AegisJSProject.png","language":"JavaScript","funding_links":["https://github.com/sponsors/shgysk8zer0","https://liberapay.com/shgysk8zer0","https://liberapay.com/shgysk8zer0/donate"],"categories":[],"sub_categories":[],"readme":"# `@aegisjsproject/otp`\n\nAn OTP library written using the `crypto` API\n\n[![CodeQL](https://github.com/Aegisjsproject/otp/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/Aegisjsproject/otp/actions/workflows/codeql-analysis.yml)\n![Node CI](https://github.com/Aegisjsproject/otp/workflows/Node%20CI/badge.svg)\n![Lint Code Base](https://github.com/Aegisjsproject/otp/workflows/Lint%20Code%20Base/badge.svg)\n\n[![GitHub license](https://img.shields.io/github/license/Aegisjsproject/otp.svg)](https://github.com/Aegisjsproject/otp/blob/master/LICENSE)\n[![GitHub last commit](https://img.shields.io/github/last-commit/Aegisjsproject/otp.svg)](https://github.com/Aegisjsproject/otp/commits/master)\n[![GitHub release](https://img.shields.io/github/release/Aegisjsproject/otp?logo=github)](https://github.com/Aegisjsproject/otp/releases)\n[![GitHub Sponsors](https://img.shields.io/github/sponsors/shgysk8zer0?logo=github)](https://github.com/sponsors/shgysk8zer0)\n\n[![npm](https://img.shields.io/npm/v/@aegisjsproject/otp)](https://www.npmjs.com/package/@aegisjsproject/otp)\n![node-current](https://img.shields.io/node/v/@aegisjsproject/otp)\n![npm bundle size gzipped](https://img.shields.io/bundlephobia/minzip/@aegisjsproject/otp)\n[![npm](https://img.shields.io/npm/dw/@aegisjsproject/otp?logo=npm)](https://www.npmjs.com/package/@aegisjsproject/otp)\n\n[![GitHub followers](https://img.shields.io/github/followers/AegisJSProject.svg?style=social)](https://github.com/AegisJSProject)\n![GitHub forks](https://img.shields.io/github/forks/Aegisjsproject/otp.svg?style=social)\n![GitHub stars](https://img.shields.io/github/stars/Aegisjsproject/otp.svg?style=social)\n[![Twitter Follow](https://img.shields.io/twitter/follow/shgysk8zer0.svg?style=social)](https://twitter.com/shgysk8zer0)\n\n[![Donate using Liberapay](https://img.shields.io/liberapay/receives/shgysk8zer0.svg?logo=liberapay)](https://liberapay.com/shgysk8zer0/donate \"Donate using Liberapay\")\n- - -\n\n- [Code of Conduct](./.github/CODE_OF_CONDUCT.md)\n- [Contributing](./.github/CONTRIBUTING.md)\n\u003c!-- - [Security Policy](./.github/SECURITY.md) --\u003e\n\n## Features\n\n* Implements RFC 6238 for TOTP generation and verification.\n* Uses the standard `Web Crypto API` for secure HMAC operations.\n* Supports SHA-1, SHA-256, and SHA-512 algorithms.\n* Provides Base32 encoding/decoding (RFC 4648 compatible).\n* Generates and parses `otpauth://totp/` URIs for easy provisioning with authenticator apps.\n* Cryptographically secure secret generation.\n* Configurable token length, time period, and time skew tolerance.\n* Pure ES Module, no external runtime dependencies for core crypto.\n\n## Installation\n\n### Using npm (for Node.js, Bundlers)\n\nInstall the package using your preferred package manager:\n\n```bash\n# Using npm\nnpm install @aegisjsproject/otp\n\n# Using yarn\nyarn add @aegisjsproject/otp\n\n# Using pnpm\npnpm add @aegisjsproject/otp\n\n# Using Git submodules\ngit submodule add https://github.com/Aegisjsproject/otp.git path/to/destination\n```\n\n### Using a CDN with [Importmap](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/script/type/importmap)\n\n```html\n\u003cscript type=\"importmap\"\u003e\n  {\n    \"imports\": {\n      \"@aegisjsproject/otp\": \"https://unpkg.com/@aegisjsproject/otp[@vx.y.z]/otp.min.js\",\n      \"@aegisjsproject/otp/\": \"https://unpkg.com/@aegisjsproject/otp[@vx.y.z]/\"\n    }\n  }\n\u003c/script\u003e\n```\n\n## Usage Example\n\n```js\nimport {\n    generateSecret,\n    secretToKey,\n    createOTPAuthURI,\n    generateTOTP,\n    verifyTOTP,\n    parseOTPAuthURI,\n    // other exports if needed...\n} from '@aegisjsproject/otp';\n\n// Generate the random bytes\nconst secret = generateSecret();\n\n// Create a secret key from those random bytes\nconst key = await secretToKey(secret);\n\n// Generate an `otpauth:` URI to QR encode (QR encoding not provided)\nconst uri = createOTPAuthURI({ label: 'Acme:user@example.com', issuer: 'Acme', secret });\n\n// Verify a user-provided TOTP code\nconst valid = await verifyTOTP(totpCode, key);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faegisjsproject%2Fotp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faegisjsproject%2Fotp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faegisjsproject%2Fotp/lists"}