automatic-otp
otp generator and validator
Last updated 7 months ago by funbioyede .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install automatic-otp 
SYNC missed versions from official npm registry.

Build Status

Automatic-OTP ????

This is a simple package that generates and validates OTPs (One Time Passwords).

Installation

npm i automatic-otp

Usage

const OTP = require('automatic-otp');

const otp = new OTP();

otp.generate(length,options)

  • length (optional | default = 6) : length of password.
  • options - optional
  1. digits (Default: true) true value includes digits in OTP
  2. alphabet (Default: true) true value includes alphabeth in OTP
  3. alphabetToUpperCase (Default: true) true value includes alphabethToUpperCase in OTP
  4. specialCharacters (Default: true) true value includes specialCharacters in OTP

Sample

Generate Sample

const OTP = require('automatic-otp');

const otp = new OTP();

otp.generate(10,{digits:true,specialCharacters:true,alphabet:true})


This will generate a ten digit OTP, that includes special characters and alphabet. And the success response will be:


{
token: 'dwe7XW&RF&',
status: true,
message: 'OTP generated'
}

Validate


const OTP = require('automatic-otp');

const otp = new OTP();

otp.validate(token)

Responses

  1. Successful Validation

{
"status":true,
"message":"OTP is valid"
}

  1. Does not exist. If null

{
"status":false,
"message":"OTP does not exit"
}

3 .Invalid. Does not match


{
"status":false,
"message":"OTP is not valid"
}

Current Tags

  • 1.0.4                                ...           latest (7 months ago)

4 Versions

  • 1.0.4                                ...           7 months ago
  • 1.0.3                                ...           7 months ago
  • 1.0.2                                ...           7 months ago
  • 1.0.0                                ...           7 months ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (3)
Dev Dependencies (3)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |