{"id":31665291,"url":"https://github.com/navbytes/totp-turbo","last_synced_at":"2026-05-09T03:31:31.623Z","repository":{"id":314302019,"uuid":"1054959032","full_name":"navbytes/totp-turbo","owner":"navbytes","description":"High-performance TypeScript library for generating TOTP tokens using Rust backend","archived":false,"fork":false,"pushed_at":"2025-09-11T15:50:11.000Z","size":207,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-07T21:54:14.657Z","etag":null,"topics":["2fa","authentication","otp","rust","security","totp","typescript","wasm"],"latest_commit_sha":null,"homepage":"https://navbytes.github.io/totp-turbo","language":"Rust","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/navbytes.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-11T15:06:36.000Z","updated_at":"2025-09-11T15:50:14.000Z","dependencies_parsed_at":"2025-09-11T18:43:31.607Z","dependency_job_id":"93a5bd8b-047d-4756-88d8-9703bb261206","html_url":"https://github.com/navbytes/totp-turbo","commit_stats":null,"previous_names":["navbytes/totp-turbo"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/navbytes/totp-turbo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/navbytes%2Ftotp-turbo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/navbytes%2Ftotp-turbo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/navbytes%2Ftotp-turbo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/navbytes%2Ftotp-turbo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/navbytes","download_url":"https://codeload.github.com/navbytes/totp-turbo/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/navbytes%2Ftotp-turbo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32805880,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-08T08:22:46.396Z","status":"online","status_checked_at":"2026-05-09T02:00:06.633Z","response_time":123,"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":["2fa","authentication","otp","rust","security","totp","typescript","wasm"],"created_at":"2025-10-07T21:53:54.776Z","updated_at":"2026-05-09T03:31:31.617Z","avatar_url":"https://github.com/navbytes.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# totp-turbo\n\nA high-performance TypeScript library for generating Time-based One-Time Passwords (TOTP) using a Rust backend for cryptographic operations.\n\n## Features\n\n- 🚀 **High Performance**: Rust-powered cryptographic operations via WebAssembly\n- 🔒 **Secure**: RFC 6238 compliant TOTP implementation\n- 📱 **Cross-platform**: Works in browsers and Node.js\n- 🎯 **Type-safe**: Full TypeScript support with comprehensive type definitions\n- ⚡ **Fast**: Sub-millisecond token generation\n- 🔧 **Flexible**: Multiple algorithms (SHA1, SHA256, SHA512) and configurations\n\n## Installation\n\n```bash\nnpm install totp-turbo\n```\n\n## Quick Start\n\n### Object-based API (Recommended for repeated use)\n```typescript\nimport { TotpGenerator } from 'totp-turbo';\n\n// Create a generator with your secret and configuration\nconst totp = new TotpGenerator({\n  secret: 'JBSWY3DPEHPK3PXP',\n  digits: 6,\n  period: 30,\n  algorithm: 'SHA1'\n});\n\n// Generate tokens anytime\nconst token = totp.generate();\nconsole.log(`Current TOTP: ${token}`);\n\n// Verify tokens\nconst isValid = totp.verify('123456');\nconsole.log(`Token valid: ${isValid}`);\n```\n\n### Direct static methods (For one-off generation)\n```typescript\nimport { Totp } from 'totp-turbo';\n\n// Generate directly from secret\nconst token = Totp.generate('JBSWY3DPEHPK3PXP');\nconsole.log(`Current TOTP: ${token}`);\n\n// With custom options\nconst customToken = Totp.generate('JBSWY3DPEHPK3PXP', {\n  digits: 8,\n  algorithm: 'SHA512',\n  period: 60\n});\n```\n\n## Configuration Options\n\n```typescript\ninterface TotpConfig {\n  secret: string;                    // Base32 encoded secret\n  digits?: number;                   // Token length 4-8 digits (default: 6)\n  period?: number;                   // Time step in seconds (default: 30)\n  algorithm?: 'SHA1' | 'SHA256' | 'SHA512'; // Hash algorithm (default: SHA1)\n  skew?: number;                     // Clock skew tolerance (default: 1)\n  explicitZeroPad?: boolean;         // Explicitly pad with zeros (default: true)\n  timestamp?: number;                // Custom timestamp in milliseconds (default: current time)\n}\n```\n\n## API Reference\n\n### TotpGenerator Class\n\n```typescript\nclass TotpGenerator {\n  constructor(config: TotpConfig);\n  \n  // Instance methods\n  generate(): string;\n  generateAt(timestamp: number): string;\n  verify(token: string): boolean;\n  verifyWithSkew(token: string, skew: number): boolean;\n  generateUri(issuer: string, accountName: string): string;\n  \n  // Static utilities\n  static generateSecret(): string;\n  static parseUri(uri: string): TotpConfig;\n}\n```\n\n### Totp Static Class\n\n```typescript\nclass Totp {\n  // Direct generation methods\n  static generate(secret: string, options?: Partial\u003cTotpConfig\u003e): string;\n  static generateAt(secret: string, timestamp: number, options?: Partial\u003cTotpConfig\u003e): string;\n  static verify(secret: string, token: string, options?: Partial\u003cTotpConfig\u003e): boolean;\n  static verifyWithSkew(secret: string, token: string, skew: number, options?: Partial\u003cTotpConfig\u003e): boolean;\n  \n  // Utility methods\n  static generateSecret(): string;\n  static parseUri(uri: string): TotpConfig;\n  static createUri(secret: string, issuer: string, accountName: string, options?: Partial\u003cTotpConfig\u003e): string;\n}\n```\n\n## Examples\n\n### Google Authenticator Compatibility\n```typescript\n// Generate a secret\nconst secret = TotpGenerator.generateSecret();\n\n// Create QR code URI\nconst uri = totp.generateUri('MyApp', 'user@example.com');\nconsole.log(uri); // otpauth://totp/MyApp:user@example.com?secret=...\n```\n\n### Different Algorithms and Periods\n```typescript\n// SHA-512 with 8 digits\nconst token = Totp.generate('JBSWY3DPEHPK3PXP', {\n  algorithm: 'SHA512',\n  digits: 8\n});\n\n// 60-second period\nconst token60s = Totp.generate('JBSWY3DPEHPK3PXP', {\n  period: 60\n});\n\n// Token for specific timestamp\nconst historicalToken = Totp.generate('JBSWY3DPEHPK3PXP', {\n  timestamp: 1465324707000\n});\n```\n\n## Performance\n\n- Token generation: \u003c 1ms\n- WASM module size: \u003c 50KB gzipped\n- Memory usage: \u003c 1MB runtime footprint\n\n## Browser Compatibility\n\n- Chrome 67+\n- Firefox 61+\n- Safari 11+\n- Node.js 12+\n\n## License\n\nMIT License\n\n## Contributing\n\nWe welcome contributions! Please see our contributing guidelines for details.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnavbytes%2Ftotp-turbo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnavbytes%2Ftotp-turbo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnavbytes%2Ftotp-turbo/lists"}