{"repo":"PlanetHoster/time2fa","free":true,"listed":false,"github":"https://github.com/PlanetHoster/time2fa","clone":"git clone https://github.com/PlanetHoster/time2fa.git","description":"A comprehensive Node.js package that simplifies the implementation of One-Time Password (OTP).","language":"TypeScript","stars":149,"topics":["2fa","otp","qrcode","totp","two-factor-authentication","authentication","password","authy","google-authenticator","two-factor"],"license":"MIT","category":"auth-billing-email","readme_excerpt":"A comprehensive Node.js package that simplifies the implementation of One-Time Password (OTP) authentication using HMAC-based One-Time Password (HOTP) and Time-based One-Time Password (TOTP) algorithms. Features - Support both HOTP and TOTP algorithms - Easy-to-use API for generating and verifying OTPs - Customizable OTP length, counters and time window - Supports various hashing algorithms (SHA-1, SHA-256, SHA-512) - Compatible with popular OTP generators like Google Authenticator and Authy Installation Install the package using NPM: Usage/Examples TOTP Generate key Validate passcode Generate passcodes QRCode generation You must use an external library. For the example below we use qrcode. HOTP Generate Passcode Validate passcode Helpers generateConfig() Generate default configuration generateSecret() Only support base32 at the moment generateUrl() generateBackupCodes() Backup code should only be used once Documentation Functions Helpers generateConfig(config?: TotpConfig): ValidTotpConfig generateSecret(secretSize: number = DEFAULT TOTP SECRET SIZE): string generateBackupCodes(numCodes = 10, codeLength = DEFAULT TOTP DIGITS): string[] generateUrl(options: UrlOptions, config: ValidTotpConfig): string Totp Totp.generateKey(options: TotpOptions, config?: TotpConfig): GenerateKey Totp.generatePasscodes(options: TotpCode, config: ValidTotpConfig): string[] Totp.validate(options: TotpValidateOptions, config?: TotpConfig): boolean Hotp Hotp.generatePasscode(options: HotpCode, conf","default_branch":null,"files":null,"tree":[],"storefront":"/r/PlanetHoster","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/PlanetHoster/time2fa/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}