README
eknot
eknot is a Node.js library to generate totp codes with a single API.
Usage
npm i -D eknot
Example Usage
import {generateTotpFromFile} from 'eknot'
import * as path from 'path'
const example = async (account: string) => {
const projectBaseFolder = path.join(__dirname, '../')
const imagesFolder = path.join(projectBaseFolder, 'examples/images')
const totp = await generateTotpFromFile(`${imagesFolder}/${account}.png`)
console.log(`Account: ${account} - ${totp}`)
}
example('example1') // Account: example1 - 034624
example('example2') // Account: example2 - 084841
Description
This repository is a clone of the popular authy application used to generate 2FA codes.
This project uses:
Setup
Make sure you have Node.js installed on your machine
Development
Installation
- Clone this repository
git clone git@github.com:thomaschaplin/eknot.git
- Change directory
cd eknot
- Install the dependencies
npm install
- Transpile the code
npm run build
ornpm run watch
Tests
- Run the tests
npm test
- Run the tests with coverage
npm test:coverage
Image by mohamed Hassan from Pixabay