All Projects β†’ LanceGin β†’ Jsotp

LanceGin / Jsotp

Licence: mit
Javascript One-Time Password module.

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
crotp
CrOTP - One Time Passwords for Crystal
Stars: ✭ 62 (-12.68%)
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
php-totp
HOTP and TOTP token generation
Stars: ✭ 33 (-53.52%)
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
Oathgen
A command line HOTP and TOTP client
Stars: ✭ 48 (-32.39%)
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 named lib/.
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].