Otpauth

One Time Password (HOTP/TOTP) library for Node.js, Deno, Bun and browsers.
Alternatives To Otpauth
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Node Argon21,67327329020 days ago69September 01, 202319mitJavaScript
Node.js bindings for Argon2 hashing algorithm
Node Login1,492
2 years ago8otherJavaScript
A template for quickly building login systems on top of Node.js & MongoDB
Node Keytar1,332801488a year ago78February 17, 202276mitC++
Native Password Node Module
Owid Grapher1,213
20 hours ago182mitTypeScript
A platform for creating interactive data visualizations
Todos Express Password824
16 days ago8unlicenseJavaScript
Todo app using Express and Passport for sign in with username and password.
Otpauth66411214 days ago89November 10, 20221mitJavaScript
One Time Password (HOTP/TOTP) library for Node.js, Deno, Bun and browsers.
Flat Server580
9 days ago14mitTypeScript
A Node.js server for the Agora Flat open source classroom.
Wifi Password56811112 years ago14June 21, 20178mitJavaScript
Get current wifi password
Pup558
9 months ago11JavaScript
The Ultimate Boilerplate for Products.
Upash470145 years ago12March 05, 20187mitJavaScript
🔒Unified API for password hashing algorithms
Alternatives To Otpauth
Select To Compare


Alternative Project Comparisons
Readme

Last version npm downloads

OTPAuth

One Time Password (HOTP/TOTP) library for Node.js, Deno, Bun and browsers.

Usage

Node.js

import * as OTPAuth from "otpauth";

// Create a new TOTP object.
let totp = new OTPAuth.TOTP({
  issuer: "ACME",
  label: "AzureDiamond",
  algorithm: "SHA1",
  digits: 6,
  period: 30,
  secret: "NB2W45DFOIZA", // or 'OTPAuth.Secret.fromBase32("NB2W45DFOIZA")'
});

// Generate a token (returns the current token as a string).
let token = totp.generate();

// Validate a token (returns the token delta or null if it is not found in the search window, in which case it should be considered invalid).
let delta = totp.validate({ token, window: 1 });

// Convert to Google Authenticator key URI:
// otpauth://totp/ACME:AzureDiamond?issuer=ACME&secret=NB2W45DFOIZA&algorithm=SHA1&digits=6&period=30
let uri = totp.toString(); // or 'OTPAuth.URI.stringify(totp)'

// Convert from Google Authenticator key URI.
totp = OTPAuth.URI.parse(uri);

Deno

import * as OTPAuth from "https://deno.land/x/otpauth@VERSION/dist/otpauth.esm.js"

// Same as above.

Bun

import * as OTPAuth from "otpauth";

// Same as above.

Browsers

<script src="https://cdnjs.cloudflare.com/ajax/libs/otpauth/VERSION/otpauth.umd.min.js"></script>
<script>
  // Same as above.
</script>

Documentation

See the documentation page.

https://hectorm.github.io/otpauth/

Supported hashing algorithms

In Node.js, the same algorithms as Crypto.createHmac function are supported, since it is used internally. In Deno, Bun and browsers, the SHA1, SHA224, SHA256, SHA384, SHA512, SHA3-224, SHA3-256, SHA3-384 and SHA3-512 algorithms are supported by using the jsSHA library.

License

MIT License © Héctor Molinero Fernández.

Popular Password Projects
Popular Nodejs Projects
Popular Security Categories
Related Searches

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Javascript
Node
Algorithms
Security
Auth
Password
Authenticator
Two Factor Authentication
Two Factor
Totp
Hotp