0.1.2 • Published 4 years ago
react-native-simple-totp v0.1.2
react-native-simple-totp
Getting started
$ npm install react-native-simple-totp --save
Mostly automatic installation
$ react-native link react-native-simple-totp
Manual installation
iOS
- In XCode, in the project navigator, right click
Libraries
➜Add Files to [your project's name]
- Go to
node_modules
➜react-native-simple-totp
and addRNTotplibe.xcodeproj
- In XCode, in the project navigator, select your project. Add
libRNTotplibe.a
to your project'sBuild Phases
➜Link Binary With Libraries
- Run your project (
Cmd+R
)<
Android
- Open up
android/app/src/main/java/[...]/MainActivity.java
- Add
import com.reactlibrary.RNTotplibePackage;
to the imports at the top of the file - Add
new RNTotplibePackage()
to the list returned by thegetPackages()
method
- Append the following lines to
android/settings.gradle
:include ':react-native-simple-totp' project(':react-native-simple-totp').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-simple-totp/android')
- Insert the following lines inside the dependencies block in
android/app/build.gradle
:implementation project(':react-native-simple-totp')
Usage
import RNTotplibe from 'react-native-simple-totp';
const semilla = '2fa5fadoirute94594iruty3087e3adb4c' //clave
const tiempo = '90' // tiempo
const fecha = '2190-04-28 13:08:22' //fecha
const res = await totp.getTOTP(semilla, tiempo, fecha)
// TODO: What to do with the module?
RNTotplibe;