1.4.4 • Published 1 year ago

otp-sender v1.4.4

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

otp-sender

This package provides an OTP (One-Time-Password) authentication system. It can be used to send otp to particular email and verify this otp.

Installation

Run the command below in the terminal

  npm install otp-sender

Importing the package

import otpSender from 'otp-sender'

Sending otp

Sends otp if email format is correct. Returns an json object that contains succes and token fields. If format is incorrect or another error occures, this exception can be handleded by "catch" keyword.

ParameterTypeDescription
emailstringRequired. Email you want to send otp.

var verification_token
otpSender.sendOtp(<email>).then((res)=>{
    token=res.token
    }).catch(err=>{console.log(err)})

Verifying otp

Verifies the otp if the paramaters' formats are correct. Returns a json object including declaring success if otp matches. If format is incorrect, otp does not match or another error occures, this exception can be handleded by "catch" keyword.

ParameterTypeDescription
emailstringRequired. Email we want to verify
otpstringRequired. Otp sent to this email
verification_keystringRequired. Verification key sent by sendOtp method
otpSender.verifyOtp({
  email:<email>,
  otp:<otp>,
  verification_key:<verification_key>,
  }).then((res)=>{
    token=res.token
    }).catch(err=>{console.log(err)})
1.4.4

1 year ago

1.4.3

1 year ago

1.4.2

1 year ago

1.4.1

1 year ago

1.4.0

1 year ago

1.3.0

1 year ago

1.2.1

1 year ago

1.2.0

1 year ago

1.1.9

1 year ago

1.1.8

1 year ago

1.1.7

1 year ago

1.1.6

1 year ago

1.1.5

1 year ago

1.1.4

1 year ago

1.1.3

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago