fix(GODT-2387): Ensure vault can be unlocked after factory reset

When performing a factory reset, we don't want to wipe all keychain
entries. The only keychain entry should be the vault's passphrase,
and we need this to be able to decrypt the vault at next startup
(to avoid it being reported as corrupt).
This commit is contained in:
James Houlahan
2023-02-22 13:39:59 +01:00
parent 8534da98ea
commit e9f20aee7a
7 changed files with 68 additions and 50 deletions

View File

@ -217,14 +217,13 @@ func (l *Locations) getUpdatesPath() string {
}
// Clear removes everything except the lock and update files.
func (l *Locations) Clear() error {
func (l *Locations) Clear(except ...string) error {
return files.Remove(
l.userConfig,
l.userData,
l.userCache,
).Except(
l.GetGuiLockFile(),
l.getUpdatesPath(),
append(except, l.GetGuiLockFile(), l.getUpdatesPath())...,
).Do()
}