LanceGin / Jsotp
Licence: mit
Javascript One-Time Password module.
Stars: β 71
Programming Languages
javascript
184084 projects - #8 most used programming language
Projects that are alternatives of or similar to Jsotp
hotp-php
HMAC Based One Time Passwords in PHP. RFC4226 and RFC6238 compliant.
Stars: β 51 (-28.17%)
Mutual labels: otp, totp, hotp
Otphp
π A PHP library for generating one time passwords according to RFC 4226 (HOTP) and the RFC 6238 (TOTP)
Stars: β 857 (+1107.04%)
Mutual labels: otp, totp, hotp
Aegis
A free, secure and open source app for Android to manage your 2-step verification tokens.
Stars: β 2,692 (+3691.55%)
Mutual labels: otp, totp, hotp
rx-otp
HMAC-based (HOTP) and Time-based (TOTP) One-Time Password manager. Works with Google Authenticator for Two-Factor Authentication.
Stars: β 79 (+11.27%)
Mutual labels: otp, totp, hotp
2FAuth
A Web app to manage your Two-Factor Authentication (2FA) accounts and generate their security codes
Stars: β 664 (+835.21%)
Mutual labels: otp, totp, hotp
OneTime
iOS, watchOS, & macOS One-Time Password client
Stars: β 14 (-80.28%)
Mutual labels: otp, totp, hotp
Multiotp
multiOTP open source strong two factor authentication PHP library, OATH certified, with TOTP, HOTP, Mobile-OTP, YubiKey, SMS, QRcode provisioning, etc.
Stars: β 173 (+143.66%)
Mutual labels: otp, totp, hotp
Onetimepassword
π A small library for generating TOTP and HOTP one-time passwords on iOS.
Stars: β 243 (+242.25%)
Mutual labels: otp, totp, hotp
Freeotpplus
Enhanced fork of FreeOTP-Android providing a feature-rich 2FA authenticator
Stars: β 223 (+214.08%)
Mutual labels: otp, totp, hotp
multiOTPCredentialProvider
multiOTP Credential Provider is a V2 Credential Provider for Windows 7/8/8.1/10/2012(R2)/2016 with options like RDP only and UPN name support
Stars: β 121 (+70.42%)
Mutual labels: otp, totp, hotp
Glewlwyd
Single Sign On server, OAuth2, Openid Connect, multiple factor authentication with, HOTP/TOTP, FIDO2, TLS Certificates, etc. extensible via plugins
Stars: β 292 (+311.27%)
Mutual labels: otp, totp, hotp
Otpauth
One Time Password (HOTP/TOTP) library for Node.js, Deno and browsers.
Stars: β 135 (+90.14%)
Mutual labels: otp, totp, hotp
Otpclient
Highly secure and easy to use OTP client written in C/GTK that supports both TOTP and HOTP
Stars: β 206 (+190.14%)
Mutual labels: otp, totp, hotp
otp-java
A small and easy-to-use one-time password generator library for Java according to RFC 4226 (HOTP) and RFC 6238 (TOTP).
Stars: β 107 (+50.7%)
Mutual labels: otp, totp, hotp
Andotp
Open source two-factor authentication for Android
Stars: β 3,326 (+4584.51%)
Mutual labels: otp, totp, hotp
Mintotp
Minimal TOTP generator in 20 lines of Python
Stars: β 678 (+854.93%)
Mutual labels: totp, hotp
apache 2fa
Apache two-factor (2FA) authentication with Google Authenticator based on Time-based One-Time Password (TOTP) or HMAC-based one-time password (HOTP) Algorithms.
Stars: β 63 (-11.27%)
Mutual labels: totp, hotp
jsotp
jsotp
is a node module to generate and verify one-time passwords that were used to implement 2FA and MFA authentication method in web applications and other login-required systems.
The module was implement based on RFC4226 (HOTP: An HMAC-Based One-Time Password Algorithm) and RFC6238 (TOTP: Time-Based One-Time Password Algorithm)
Example
Feature
- Generate random base32 encoded string
- Generate a
otpauth url
with the b32 encoded string - Create a HOTP object with verification
- Verify a HOTP token
- Create a TOTP object with verification
- Verify a TOTP token
Installation
npm install jsotp
Module
All modules support:
const jsotp = require('jsotp');
Usage
Time-based OTPs
// import
const jsotp = require('jsotp');
// Create TOTP object
const totp = jsotp.TOTP('BASE32ENCODEDSECRET');
totp.now(); // => 432143
// Verify for current time
totp.verify(432143); // => true
// Verify after 30s
totp.verify(432143); // => false
Counter-based OTPs
// import
const jsotp = require('jsotp');
// Create HOTP object
const hotp = jsotp.HOTP('BASE32ENCODEDSECRET');
hotp.at(0); // => 432143
hotp.at(1); // => 231434
hotp.at(2132); // => 242432
// Verify with a counter
hotp.verify(242432, 2132); // => true
hotp.verify(242432, 2133); // => false
Generate random base32 encoded secret
// import
const jsotp = require('jsotp');
// Generate
const b32_secret = jsotp.Base32.random_gen();
Api
jsotp.Base32.random_gen(length)
β’param: length
type: int
default: 16
return: String
desc: the length of random base32 encoded string.
jsotp.TOTP(secret)
β’param: secret
type: string
return: TOTP
desc: generate TOTP instance.
jsotp.TOTP.now()
β’return: String
desc: get the one-time password with current time.
jsotp.TOTP.verify(totp)
β’param: totp
type: string
return: Boolean
desc: verify the totp code.
jsotp.TOTP.url_gen(issuer)
β’param: issuer
type: string
return: string
desc: generate url with TOTP instance
jsotp.HOTP(secret)
β’param: secret
type: string
return: HOTP
desc: generate HOTP instance.
jsotp.HOTP.at(counter)
β’param: counter
type: int
return: String
desc: generate one-time password with counter.
jsotp.HOTP.verify(hotp, count)
β’param: hotp
type: string
param: count
type: int
return: Boolean
desc: verify the hotp code.
jsotp.HOTP.url_gen(issuer)
β’param: issuer
type: string
return: string
desc: generate url with HOTP instance
Contribute
- Clone repo and install dependencies
git clone [email protected]:LanceGin/jsotp.git
npm install
- Contribute the code in
src/
, and run command below to build the es6 code to es2015. That will create a local directory namedlib/
.
npm run build
- Unit test
npm test
δΈζζζ‘£
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].