
Generate TOTP
This is a npm package for time-based One-time Password is a computer algorithm that generates a one-time password which uses the current time as a source of uniqueness. An extension of the HMAC-based One-time Password algorithm, it has been adopted as Internet Engineering Task Force standard RFC 6238.
- Installation
npm i gen-totp
// or
yarn add gen-totp
- Usage
const genTOTP = require('gen-totp')
const otp = genTOTP('test-key')
// that will return otp with length 6 numbers
const genTOTP = require('gen-totp')
const otp = genTOTP('test-key', { digits: 4 })
// that will return otp with length 4 numbers
Options
genTOTP take two parameters
keythis is a string that contains numbers, characters,_and-optionsthis an Objectdigitsthis is the number of digits will returnperiodthis is the time to generate new otp after it (this by seconds)algorithmthis is algorithm to pure hash numbersthe complete Secure Hash Standard (SHA) family (SHA-1, SHA-224/256/384/512, SHA3-224/256/384/512, SHAKE128/256, cSHAKE128/256, and KMAC128/256) with HMAC. jssha
Related articles
Encrypt By RSA Algorithm
RSA is a public-key cryptosystem that is widely used for secure data transmission. It is also one of the oldest. The acronym RSA comes from the surnames of Ron Rivest.
De Duplicated
This is package for deleting the duplicated elements in array, there are contain two methods, first method called simpleArray, this method deduplicated the…
Error Handler E2
[](https://travis-ci.org/miladezzat/error-handler-e2) [](https://badge.fury.io/js/error-handler-e2)