Socket
Book a DemoInstallSign in
Socket

node-otp

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-otp

Node.js One-Time Password

1.2.3
latest
Source
npmnpm
Version published
Weekly downloads
730
49.28%
Maintainers
1
Weekly downloads
 
Created
Source

Node OTP

Travis NPMV

Node.js One-Time Password library

Features

  • Zero Dependency
  • TypeScript Definitions
  • RFC4226 (HMAC One-Time Password)
  • RFC6238 (Time-Based One-Time Password)

Installation

yarn add node-otp

or

npm install --save node-otp

Examples

const { hotp } = require('node-otp')

hotp({
  secret: '12345678901234567890',
})
const { totp } = require('node-otp')

totp({
  secret: '12345678901234567890',
})

APIs

hotp: (parameters: Parameters) => string

Parameters

secret: string | Buffer

movingFactor?: number

Default value of movingFactor is 0

codeDigits?: number

Default value of codeDigits is 6

addChecksum?: boolean

Default value of addChecksum is false

truncationOffset?: number

Default value of truncationOffset is -1

hmacAlgorithm?: 'sha1' | 'sha256' | 'sha512'

Default value of hmacAlgorithm is sha1

totp: (parameters: Parameters) => string

Parameters

secret: string | Buffer

step?: number

Default value of step is 30

time?: number

Default value of time is 6

initialTime?: number

Default value of initialTime is 0

codeDigits?: number

Default value of codeDigits is 6

hmacAlgorithm?: 'sha1' | 'sha256' | 'sha512'

Default value of hmacAlgorithm is sha256

Keywords

otp

FAQs

Package last updated on 11 Apr 2021

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.