Add an action to derive the encryption key.
parent
232ea823d0
commit
2608a354ea
|
@ -31,6 +31,13 @@ export const { fetchCredentials, logout } = createActions({
|
|||
LOGOUT: () => undefined,
|
||||
});
|
||||
|
||||
// FIXME: This is duplicating behaviour from the fetchCredentials above
|
||||
export const { deriveKey } = createActions({
|
||||
DERIVE_KEY: (username: string, encryptionPassword: string) => {
|
||||
return EteSync.deriveKey(username, encryptionPassword);
|
||||
},
|
||||
});
|
||||
|
||||
export const { fetchJournals } = createActions({
|
||||
FETCH_JOURNALS: (etesync: CredentialsData) => {
|
||||
const creds = etesync.credentials;
|
||||
|
|
|
@ -90,6 +90,9 @@ const encryptionKeyReducer = handleActions(
|
|||
return {key: action.payload.encryptionKey};
|
||||
}
|
||||
},
|
||||
[actions.deriveKey.toString()]: (state: {key: string | null}, action: any) => (
|
||||
{key: action.payload}
|
||||
),
|
||||
[actions.logout.toString()]: (state: {key: string | null}, action: any) => {
|
||||
return {out: true, key: null};
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue