Introduce password prompt page and save encryption flag

This commit is contained in:
Julia Friesel
2018-09-11 18:06:54 +02:00
parent 3e3cef8769
commit 3d61459f30
4 changed files with 90 additions and 13 deletions
+8 -1
View File
@@ -5,11 +5,18 @@ const bcryptjs = require('bcryptjs')
rnBridge.channel.on('message', (msg) => {
msg = JSON.parse(msg)
if (msg.type === 'request-hash') {
if (msg.type === 'request-password-hash') {
const hash = bcryptjs.hashSync(msg.message, 10)
rnBridge.channel.send(JSON.stringify({
type: 'hash',
message: hash
}))
} else if (msg.type === 'request-SHA512') {
// do the thing
} else if (msg.type === 'check-password') {
rnBridge.channel.send(JSON.stringify({
type: 'password-check-result',
message: bcryptjs.compareSync(msg.message.password, msg.message.hash)
}))
}
})