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))
}
+11
View File
@@ -0,0 +1,11 @@
{
"requires": true,
"lockfileVersion": 1,
"dependencies": {
"bcryptjs": {
"version": "2.4.3",
"resolved": "https://registry.npmjs.org/bcryptjs/-/bcryptjs-2.4.3.tgz",
"integrity": "sha1-mrVie5PmBiH/fNrF2pczAn3x0Ms="
}
}
}
@@ -0,0 +1,6 @@
{
"dependencies": {
"bcryptjs": "^2.4.3"
},
"main": "main.js"
}