Skip to content

Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.

Remove obsolete vault status checks (#1274)

Leendert de Borst2e4caf82616f
diff --git a/apps/browser-extension/src/entrypoints/popup/hooks/useVaultMutate.ts b/apps/browser-extension/src/entrypoints/popup/hooks/useVaultMutate.ts
index 08363b73b..209f8a427 100644
--- a/apps/browser-extension/src/entrypoints/popup/hooks/useVaultMutate.ts
+++ b/apps/browser-extension/src/entrypoints/popup/hooks/useVaultMutate.ts
@@ -130,27 +130,11 @@ export function useVaultMutate() : {
* Handle error during vault sync.
*/
onError: (error) => {
- /**
- *Toast.show({
- *type: 'error',
- *text1: 'Failed to sync vault',
- *text2: error,
- *position: 'bottom'
- *});
- */
options.onError?.(new Error(error));
}
});
} catch (error) {
console.error('Error during vault mutation:', error);
- /*
- * Toast.show({
- *type: 'error',
- *text1: 'Operation failed',
- *text2: error instanceof Error ? error.message : 'Unknown error',
- *position: 'bottom'
- *});
- */
options.onError?.(error instanceof Error ? error : new Error('Unknown error'));
} finally {
setIsLoading(false);
diff --git a/apps/browser-extension/src/entrypoints/popup/hooks/useVaultSync.ts b/apps/browser-extension/src/entrypoints/popup/hooks/useVaultSync.ts
index b20ac5432..4d4804afc 100644
--- a/apps/browser-extension/src/entrypoints/popup/hooks/useVaultSync.ts
+++ b/apps/browser-extension/src/entrypoints/popup/hooks/useVaultSync.ts
@@ -110,23 +110,6 @@ export const useVaultSync = () : {
onStatus?.(t('common.syncingUpdatedVault'));
const vaultResponseJson = await withMinimumDelay(() => webApi.get<VaultResponse>('Vault'), 1000, enableDelay);
- const vaultError = webApi.validateVaultResponse(vaultResponseJson as VaultResponse, t);
- if (vaultError) {
- // Only logout if it's an authentication error, not a network error
- if (vaultError.includes('authentication') || vaultError.includes('unauthorized')) {
- await authContext.logout(vaultError);
- return false;
- }
-
- /*
- * TODO: browser extension does not support offline mode yet.
- * For other errors, go into offline mode
- * authContext.setOfflineMode(true);
- */
-
- return false;
- }
-
try {
// Get encryption key from background worker
const encryptionKey = await sendMessage('GET_ENCRYPTION_KEY', {}, 'background') as string;
diff --git a/apps/browser-extension/src/entrypoints/popup/pages/auth/Login.tsx b/apps/browser-extension/src/entrypoints/popup/pages/auth/Login.tsx
index 861c6a81e..9fa3985ca 100644
--- a/apps/browser-extension/src/entrypoints/popup/pages/auth/Login.tsx
+++ b/apps/browser-extension/src/entrypoints/popup/pages/auth/Login.tsx
@@ -65,13 +65,6 @@ const Login: React.FC = () => {
'Authorization': `Bearer ${token}`
} });
- const vaultError = webApi.validateVaultResponse(vaultResponseJson, t);
- if (vaultError) {
- setError(vaultError);
- hideLoading();
- return;
- }
-
// All is good. Store auth info which is required to make requests to the web API.
await authContext.setAuthTokens(username, token, refreshToken);
diff --git a/apps/browser-extension/src/entrypoints/popup/pages/auth/Unlock.tsx b/apps/browser-extension/src/entrypoints/popup/pages/auth/Unlock.tsx
index 59ae9213f..18c3ec0d3 100644
--- a/apps/browser-extension/src/entrypoints/popup/pages/auth/Unlock.tsx
+++ b/apps/browser-extension/src/entrypoints/popup/pages/auth/Unlock.tsx
@@ -99,13 +99,6 @@ const Unlock: React.FC = () => {
// Make API call to get latest vault
const vaultResponseJson = await webApi.get<VaultResponse>('Vault');
- const vaultError = webApi.validateVaultResponse(vaultResponseJson, t);
- if (vaultError) {
- setError(t('common.apiErrors.' + vaultError));
- hideLoading();
- return;
- }
-
// Get the derived key as base64 string required for decryption.
const passwordHashBase64 = Buffer.from(passwordHash).toString('base64');
diff --git a/apps/browser-extension/src/utils/WebApiService.ts b/apps/browser-extension/src/utils/WebApiService.ts
index 2b3375576..11d441725 100644
--- a/apps/browser-extension/src/utils/WebApiService.ts
+++ b/apps/browser-extension/src/utils/WebApiService.ts
@@ -273,26 +273,6 @@ export class WebApiService {
return null;
}
- /**
- * Validates the vault response and returns an error message if validation fails
- */
- public validateVaultResponse(vaultResponseJson: VaultResponse, t: TFunction): string | null {
- /**
- * Status 0 = OK, vault is ready.
- * Status 1 = Merge required, which only the web client supports.
- */
- if (vaultResponseJson.status === 1) {
- // Note: vault merge is no longer allowed by the API as of 0.20.0, updates with the same revision number are rejected. So this check can be removed later.
- return t('errors.VaultOutdated');
- }
-
- if (vaultResponseJson.status === 2) {
- return t('errors.VaultOutdated');
- }
-
- return null;
- }
-
/**
* Get the current access token from storage.
*/