0.1.2 • Published 2 years ago
@trans-stat/node-mfa v0.1.2
@trans-stat/node-mfa
A simple node.js wrapper for the iValt biometric authentication API
installation
Before installing, you will need to configure npm to point the @trans-stat scope to the GitHub Packages registry.
With the CLI
npm config set @trans-stat:registry https://npm.pkg.github.comWith .npmrc
@trans-stat:registry=https://npm.pkg.github.comAfter configuring the registry settings, install normally
npm
npm install @trans-stat/node-mfayarn
yarn add @trans-stat/node-mfaUsage
iValt API Wrapper
- Make sure you have downloaded the iValt app on your mobile phone and followed the onboarding process there.
- Add a
.envfile with your iValt API key
IVALT_API_KEY=YOUR_API_KEY_HERE- Import the
IValtClientclass and instantiate it with your api key.
import { IValtClient } from '@trans-stat/node-mfa/ivalt';
import process from 'node:process';
const ivaltClient = new IValtClient(process.env.IVALT_API_KEY);- Use the
IValtClientto make calls to the iValt API. This can be easily integrated in your preferred node.js framework. - To send an authentication request, call the
biometricAuthRequestmethod and pass the phone number of the user being authenticated.
ivaltClient.biometricAuthRequest('+1234567890');- To check the status of the request, call the
biometricAuthResultmethod and pass the same phone number that was passed to the previous requst.
ivaltClient.biometricAuthResult('+1234567890');NOTE: In order to reduce network traffic between the client and server it is recommended that you implement the calls to both these methods in the same endpoint that gets exposed to the client. This way your client only needs to send a post request to a single endpoint and expect the result of the
biometricAuthResultrequest after the user has authenticated on their device.