Skip to content

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

Fix linting (#771)

Leendert de Borst18e6698f7d36
diff --git a/apps/browser-extension/eslint.config.js b/apps/browser-extension/eslint.config.js
index 7a8149fd1..e70e1e909 100644
--- a/apps/browser-extension/eslint.config.js
+++ b/apps/browser-extension/eslint.config.js
@@ -12,6 +12,7 @@ export default [
ignores: [
"dist/**",
"node_modules/**",
+ "src/utils/shared/**",
]
},
js.configs.recommended,
diff --git a/apps/browser-extension/src/entrypoints/popup/components/CredentialCard.tsx b/apps/browser-extension/src/entrypoints/popup/components/CredentialCard.tsx
index 424992f2f..9de40c4e4 100644
--- a/apps/browser-extension/src/entrypoints/popup/components/CredentialCard.tsx
+++ b/apps/browser-extension/src/entrypoints/popup/components/CredentialCard.tsx
@@ -7,9 +7,21 @@ type CredentialCardProps = {
credential: Credential;
};
+/**
+ * CredentialCard component
+ *
+ * This component displays a credential card with a service name, username, and email.
+ * It allows the user to navigate to the credential details page when clicked.
+ *
+ */
const CredentialCard: React.FC<CredentialCardProps> = ({ credential }) => {
const navigate = useNavigate();
+ /**
+ * Get the display text for the credential
+ * @param cred - The credential to get the display text for
+ * @returns The display text for the credential
+ */
const getDisplayText = (cred: Credential): string => {
// Show username if available
if (cred.Username) {
diff --git a/apps/browser-extension/src/entrypoints/popup/pages/CredentialsList.tsx b/apps/browser-extension/src/entrypoints/popup/pages/CredentialsList.tsx
index be3308d3f..bec26d617 100644
--- a/apps/browser-extension/src/entrypoints/popup/pages/CredentialsList.tsx
+++ b/apps/browser-extension/src/entrypoints/popup/pages/CredentialsList.tsx
@@ -1,7 +1,6 @@
import React, { useState, useEffect, useCallback } from 'react';
import { useDb } from '../context/DbContext';
import { Credential } from '../../../utils/types/Credential';
-import { useNavigate } from 'react-router-dom';
import { useLoading } from '../context/LoadingContext';
import { useWebApi } from '../context/WebApiContext';
import { VaultResponse } from '../../../utils/types/webapi/VaultResponse';
@@ -19,31 +18,8 @@ const CredentialsList: React.FC = () => {
const webApi = useWebApi();
const [credentials, setCredentials] = useState<Credential[]>([]);
const [searchTerm, setSearchTerm] = useState('');
- const navigate = useNavigate();
const { showLoading, hideLoading, setIsInitialLoading } = useLoading();
- /**
- * Get the display text for a credential, showing username by default,
- * falling back to email only if username is null/undefined
- */
- const getCredentialDisplayText = (cred: Credential): string => {
- const username = cred.Username ?? '';
-
- // Show username if available.
- if (username.length > 0) {
- return username;
- }
-
- // Show email if username is not available.
- const email = cred.Alias?.Email ?? '';
- if (email.length > 0) {
- return email;
- }
-
- // Show empty string if neither username nor email is available.
- return '';
- };
-
/**
* Loading state with minimum duration for more fluid UX.
*/
@@ -92,10 +68,12 @@ const CredentialsList: React.FC = () => {
// Initialize the SQLite context again with the newly retrieved decrypted blob)
try {
await dbContext.initializeDatabase(vaultResponseJson, passwordHashBase64);
- } catch (err) {
- // If error occurs during database initialization, it most likely has to do with decryption that
- // failed. This is most likely due to the user changing their password.
- // So we logout the user here to force them to re-authenticate.
+ } catch {
+ /**
+ * If error occurs during database initialization, it most likely has to do with decryption that
+ * failed. This is most likely due to the user changing their password.
+ * So we logout the user here to force them to re-authenticate.
+ */
await webApi.logout('Vault could not be decrypted, please re-authenticate.');
}
} catch (err) {
diff --git a/apps/browser-extension/src/utils/EncryptionUtility.ts b/apps/browser-extension/src/utils/EncryptionUtility.ts
index f68e0a513..49fdb4bb9 100644
--- a/apps/browser-extension/src/utils/EncryptionUtility.ts
+++ b/apps/browser-extension/src/utils/EncryptionUtility.ts
@@ -122,8 +122,10 @@ export class EncryptionUtility {
* Generates a new RSA key pair for asymmetric encryption
*/
public static async generateRsaKeyPair(): Promise<{ publicKey: string, privateKey: string }> {
- // TODO: ensure the key pair is generated in the correct format where private key is in expected
- // JWK format that the WASM app already outputs.
+ /**
+ * TODO: ensure the key pair is generated in the correct format where private key is in expected
+ * JWK format that the WASM app already outputs.
+ */
const keyPair = await crypto.subtle.generateKey(
{
name: "RSA-OAEP",