Socket
Socket
Sign inDemoInstall

notp

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

notp

Node One Time Password library, supports HOTP, TOTP and works with Google Authenticator


Version published
Weekly downloads
127K
increased by3.14%
Maintainers
1
Weekly downloads
 
Created

What is notp?

The 'notp' npm package is a Node.js library for generating and verifying one-time passwords (OTPs) using the TOTP (Time-based One-Time Password) and HOTP (HMAC-based One-Time Password) algorithms. It is commonly used for implementing two-factor authentication (2FA) in applications.

What are notp's main functionalities?

Generate TOTP

This feature allows you to generate a Time-based One-Time Password (TOTP) using a secret key. The generated TOTP can be used for time-based authentication.

const notp = require('notp');
const key = 'mysecretkey';
const totp = notp.totp.gen(key);
console.log(totp);

Verify TOTP

This feature allows you to verify a given TOTP against a secret key. It returns an object indicating whether the verification was successful.

const notp = require('notp');
const key = 'mysecretkey';
const token = '123456';
const verified = notp.totp.verify(token, key);
console.log(verified);

Generate HOTP

This feature allows you to generate an HMAC-based One-Time Password (HOTP) using a secret key and a counter. The generated HOTP can be used for counter-based authentication.

const notp = require('notp');
const key = 'mysecretkey';
const counter = 1;
const hotp = notp.hotp.gen(key, counter);
console.log(hotp);

Verify HOTP

This feature allows you to verify a given HOTP against a secret key and a counter. It returns an object indicating whether the verification was successful.

const notp = require('notp');
const key = 'mysecretkey';
const token = '123456';
const counter = 1;
const verified = notp.hotp.verify(token, key, counter);
console.log(verified);

Other packages similar to notp

FAQs

Package last updated on 14 Oct 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc