mirror of
https://github.com/balzack/databag.git
synced 2025-03-13 00:50:03 +00:00
added forget seal option to mobile app
This commit is contained in:
parent
c0942cb4ab
commit
b17781539f
@ -380,11 +380,16 @@ export function ProfileBody({ navigation }) {
|
||||
</TouchableOpacity>
|
||||
{ state.canSaveSeal && (
|
||||
<>
|
||||
{ state.sealMode !== 'unlocking' && (
|
||||
{ state.sealMode !== 'unlocking' && state.sealMode !== 'unlocked' && (
|
||||
<TouchableOpacity style={styles.save} onPress={saveSeal}>
|
||||
<Text style={styles.saveText}>Save</Text>
|
||||
</TouchableOpacity>
|
||||
)}
|
||||
{ state.sealMode === 'unlocked' && (
|
||||
<TouchableOpacity style={styles.save} onPress={saveSeal}>
|
||||
<Text style={styles.saveText}>Forget</Text>
|
||||
</TouchableOpacity>
|
||||
)}
|
||||
{ state.sealMode === 'unlocking' && (
|
||||
<TouchableOpacity style={styles.save} onPress={saveSeal}>
|
||||
<Text style={styles.saveText}>Unlock</Text>
|
||||
|
@ -175,6 +175,10 @@ export function useProfileBody() {
|
||||
await account.actions.unlockAccountSeal(sealKey);
|
||||
};
|
||||
|
||||
const sealForget = async () => {
|
||||
await account.actions.unlockAccountSeal({});
|
||||
}
|
||||
|
||||
const sealUpdate = async () => {
|
||||
// generate key to encrypt private key
|
||||
const salt = CryptoJS.lib.WordArray.random(128 / 8);
|
||||
@ -199,6 +203,9 @@ export function useProfileBody() {
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (state.sealMode === 'unlocked') {
|
||||
return updateState({ canSaveSeal: true });
|
||||
}
|
||||
if (state.sealMode === 'unlocking' && state.sealUnlock != null && state.sealUnlock !== '') {
|
||||
return updateState({ canSaveSeal: true });
|
||||
}
|
||||
@ -265,6 +272,9 @@ export function useProfileBody() {
|
||||
else if (state.sealMode === 'unlocking') {
|
||||
await sealUnlock();
|
||||
}
|
||||
else if (state.sealMode === 'unlocked') {
|
||||
await sealForget();
|
||||
}
|
||||
else if (state.sealMode === 'updating') {
|
||||
await sealUpdate();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user