Code Monkey home page Code Monkey logo

node-otp's Introduction

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

node-otp's People

Contributors

alessiodionisi avatar dependabot[bot] avatar greenkeeper[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

clix-dev-llc

node-otp's Issues

tutorial

is there ant tutorial for this package ๐Ÿค”
it would be great if you make a YouTube tutorial ๐Ÿ’ฏ

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.