Use nodejs-mobile and bcrypt to generate encryption key, and encrypt db

This commit is contained in:
Julia Friesel
2018-09-09 17:15:31 +02:00
parent b7470151b4
commit 4839f95312
12 changed files with 417 additions and 5 deletions
+11
View File
@@ -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() {