Pull password settings apart into individual components

This commit is contained in:
Julia Friesel
2018-09-15 11:22:00 +02:00
parent 80f08c0642
commit 8ed26f3e59
12 changed files with 392 additions and 27 deletions
+3 -6
View File
@@ -11,7 +11,6 @@ import {
longAndComplicatedCycleWithCervix,
cycleWithTempAndNoCervixShift
} from './fixtures'
import { saveEncryptionFlag } from '../local-storage'
import dbSchema from './schema'
let db
@@ -154,9 +153,9 @@ export function tryToImportWithoutDelete(cycleDays) {
})
}
export function requestHash(pw) {
nodejs.channel.send(JSON.stringify({
type: 'request-SHA512',
export function requestHash(type, pw) {
nodejs.channel.post('request-SHA512', JSON.stringify({
type: type,
message: pw
}))
}
@@ -190,7 +189,6 @@ export async function changeEncryptionAndRestartApp(hash) {
db.close()
await fs.unlink(defaultPath)
await fs.moveFile(copyPath, defaultPath)
await saveEncryptionFlag(key ? true : false)
restart.Restart()
}
@@ -198,7 +196,6 @@ export async function deleteDbAndOpenNew() {
const exists = await fs.exists(Realm.defaultPath)
if (exists) await fs.unlink(Realm.defaultPath)
await openDb({ persistConnection: true })
await saveEncryptionFlag(false)
}
function hashToInt8Array(hash) {