Use nodejs-mobile and bcrypt to generate encryption key, and encrypt db
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import React, { Component } from 'react'
|
||||
import { View, BackHandler } from 'react-native'
|
||||
import nodejs from 'nodejs-mobile-react-native'
|
||||
import Header from './header'
|
||||
import Menu from './menu'
|
||||
import Home from './home'
|
||||
@@ -11,6 +12,7 @@ import Settings from './settings'
|
||||
import Stats from './stats'
|
||||
import {headerTitles as titles} from './labels'
|
||||
import setupNotifications from '../lib/notifications'
|
||||
import { encrypt } from '../db'
|
||||
|
||||
const isSymptomView = name => Object.keys(symptomViews).indexOf(name) > -1
|
||||
|
||||
@@ -22,6 +24,15 @@ export default class App extends Component {
|
||||
}
|
||||
this.backHandler = BackHandler.addEventListener('hardwareBackPress', this.handleBackButtonPress)
|
||||
setupNotifications(this.navigate)
|
||||
nodejs.start('main.js')
|
||||
nodejs.channel.addListener(
|
||||
'message',
|
||||
msg => {
|
||||
msg = JSON.parse(msg)
|
||||
encrypt(msg.message)
|
||||
},
|
||||
this
|
||||
)
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
|
||||
+2
-3
@@ -8,7 +8,7 @@ import {
|
||||
import { LocalDate, ChronoUnit } from 'js-joda'
|
||||
import styles from '../styles/index'
|
||||
import cycleModule from '../lib/cycle'
|
||||
import { encrypt, getOrCreateCycleDay, bleedingDaysSortedByDate, fillWithMucusDummyData, fillWithCervixDummyData, deleteAll } from '../db'
|
||||
import { requestHash, getOrCreateCycleDay, bleedingDaysSortedByDate, fillWithMucusDummyData, fillWithCervixDummyData, deleteAll } from '../db'
|
||||
import {bleedingPrediction as labels} from './labels'
|
||||
|
||||
const getCycleDayNumber = cycleModule().getCycleDayNumber
|
||||
@@ -81,8 +81,7 @@ export default class Home extends Component {
|
||||
<View style={styles.homeButton}>
|
||||
<Button
|
||||
onPress={() => {
|
||||
console.log('pressed')
|
||||
encrypt()
|
||||
requestHash()
|
||||
}}
|
||||
title="encrypt, yo">
|
||||
</Button>
|
||||
|
||||
Reference in New Issue
Block a user