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
+17
View File
@@ -0,0 +1,17 @@
const rnBridge = require('rn-bridge')
try {
const bcryptjs = require('bcryptjs')
rnBridge.channel.on('message', (msg) => {
msg = JSON.parse(msg)
if (msg.type === 'request-hash') {
const hash = bcryptjs.hashSync(msg.message, 10)
rnBridge.channel.send(JSON.stringify({
type: 'hash',
message: hash
}))
}
})
} catch (err) {
rnBridge.channel.send(JSON.stringify(err.message))
}