Skip to content

Commit

Permalink
fix(restore): correctly insert credentials first time
Browse files Browse the repository at this point in the history
  • Loading branch information
matsjj committed Oct 14, 2020
1 parent 99dd61b commit 7b50aa8
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,18 @@ import * as KV from '../../../types/KVStoreEntry'
export default ({ api, networks } = {}) => {

const createWalletCredentials = function * (kv) {
const { guid, password, sharedKey } = kv.value

const guidT = yield select(selectors.wallet.getGuid)
const passwordT = yield select(selectors.wallet.getMainPassword)
const sharedKeyT = yield select(selectors.wallet.getSharedKey)

if(guid !== guidT || password !== passwordT || sharedKey !== sharedKeyT) {
const newkv = set(KVStoreEntry.value, { guid: guidT, password: passwordT, sharedKey: sharedKeyT }, kv)
const newkv = set(KVStoreEntry.value, { guid: guidT, password: passwordT, sharedKey: sharedKeyT }, kv)
// Only update the value in metadata if it's out-of-sync with the actual credentials
// or when we haven't written it yet
if(kv.value) {
const { guid, password, sharedKey } = kv.value
if(guid !== guidT || password !== passwordT || sharedKey !== sharedKeyT) {
yield put(A.createMetadataWalletCredentials(newkv))
}
} else {
yield put(A.createMetadataWalletCredentials(newkv))
}
}
Expand Down

0 comments on commit 7b50aa8

Please sign in to comment.