Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.
Linting refactor misc utilities (#771)
Leendert de Borst3429c34eb426
diff --git a/apps/browser-extension/src/utils/EncryptionUtility.ts b/apps/browser-extension/src/utils/EncryptionUtility.tsindex 24539fe9d..9906a8347 100644--- a/apps/browser-extension/src/utils/EncryptionUtility.ts+++ b/apps/browser-extension/src/utils/EncryptionUtility.ts@@ -194,7 +194,6 @@ export class EncryptionUtility {const plaintextBuffer = await crypto.subtle.decrypt({name: "RSA-OAEP",- hash: "SHA-256",},privateKeyObj,cipherBuffer@@ -203,7 +202,7 @@ export class EncryptionUtility {return new Uint8Array(plaintextBuffer);} catch (error) {console.error('RSA decryption failed:', error);- throw new Error(`Failed to decrypt: ${error.message}`);+ throw new Error(`Failed to decrypt: ${error instanceof Error ? error.message : 'Unknown error'}`);}}diff --git a/apps/mobile-app/.eslintrc.js b/apps/mobile-app/.eslintrc.jsindex ddf37ed27..1c2e5269e 100644--- a/apps/mobile-app/.eslintrc.js+++ b/apps/mobile-app/.eslintrc.js@@ -1,6 +1,6 @@module.exports = {root: true,- ignorePatterns: ["dist/**", "node_modules/**", "utils/shared/**"],+ ignorePatterns: ["dist/**", "node_modules/**", "utils/shared/**", "expo-env.d.ts", "*.js"],parser: "@typescript-eslint/parser",parserOptions: {ecmaFeatures: { jsx: true },diff --git a/apps/mobile-app/app/(tabs)/credentials/[id].tsx b/apps/mobile-app/app/(tabs)/credentials/[id].tsxindex fedf57a07..06ecbc22a 100644--- a/apps/mobile-app/app/(tabs)/credentials/[id].tsx+++ b/apps/mobile-app/app/(tabs)/credentials/[id].tsx@@ -10,11 +10,11 @@ import { ThemedScrollView } from '@/components/themed/ThemedScrollView';import { CredentialIcon } from '@/components/credentials/CredentialIcon';import { useDb } from '@/context/DbContext';import { Credential } from '@/utils/types/Credential';-import { LoginCredentials } from '@/components/credentialDetails/LoginCredentials';-import { AliasDetails } from '@/components/credentialDetails/AliasDetails';-import { NotesSection } from '@/components/credentialDetails/NotesSection';-import { EmailPreview } from '@/components/credentialDetails/EmailPreview';-import { TotpSection } from '@/components/credentialDetails/TotpSection';+import { LoginCredentials } from '@/components/credentials/details/LoginCredentials';+import { AliasDetails } from '@/components/credentials/details/AliasDetails';+import { NotesSection } from '@/components/credentials/details/NotesSection';+import { EmailPreview } from '@/components/credentials/details/EmailPreview';+import { TotpSection } from '@/components/credentials/details/TotpSection';import { useColors } from '@/hooks/useColorScheme';import emitter from '@/utils/EventEmitter';@@ -107,10 +107,7 @@ export default function CredentialDetailsScreen() : React.ReactNode {}return (- <ThemedScrollView style={styles.container}- contentContainerStyle={styles.contentContainer}- scrollIndicatorInsets={{ bottom: 40 }}- >+ <ThemedScrollView><ThemedView style={styles.header}><CredentialIcon logo={credential.Logo} style={styles.logo} /><View style={styles.headerText}>@@ -136,12 +133,6 @@ export default function CredentialDetailsScreen() : React.ReactNode {}const styles = StyleSheet.create({- container: {- flex: 1,- },- contentContainer: {- paddingBottom: 40,- },header: {alignItems: 'center',flexDirection: 'row',diff --git a/apps/mobile-app/app/(tabs)/credentials/add-edit.tsx b/apps/mobile-app/app/(tabs)/credentials/add-edit.tsxindex 3789e66a9..2faaa9c4b 100644--- a/apps/mobile-app/app/(tabs)/credentials/add-edit.tsx+++ b/apps/mobile-app/app/(tabs)/credentials/add-edit.tsx@@ -1,4 +1,4 @@-import { StyleSheet, View, TouchableOpacity, ScrollView, Alert, Keyboard } from 'react-native';+import { StyleSheet, View, TouchableOpacity, Alert, Keyboard, ScrollView } from 'react-native';import { useState, useEffect, useRef, useCallback } from 'react';import { useLocalSearchParams, useNavigation, useRouter } from 'expo-router';import MaterialIcons from '@expo/vector-icons/MaterialIcons';@@ -34,11 +34,12 @@ export default function AddEditCredentialScreen() : React.ReactNode {const colors = useColors();const dbContext = useDb();const [mode, setMode] = useState<CredentialMode>('random');- const { executeVaultMutation, isLoading, syncStatus } = useVaultMutate();+ const { executeVaultMutation, syncStatus } = useVaultMutate();const navigation = useNavigation();const webApi = useWebApi();const [isPasswordVisible, setIsPasswordVisible] = useState(false);const serviceNameRef = useRef<ValidatedFormFieldRef>(null);+ const [isLoading, setIsLoading] = useState(false);const { control, handleSubmit, setValue, watch } = useForm<Credential>({resolver: yupResolver(credentialSchema) as Resolver<Credential>,@@ -54,7 +55,7 @@ export default function AddEditCredentialScreen() : React.ReactNode {LastName: "",NickName: "",BirthDate: "",- Gender: "",+ Gender: undefined,Email: ""}}@@ -183,6 +184,8 @@ export default function AddEditCredentialScreen() : React.ReactNode {const onSubmit = useCallback(async (data: Credential) : Promise<void> => {Keyboard.dismiss();+ setIsLoading(true);+// If we're creating a new credential and mode is random, generate random valuesif (!isEditMode && mode === 'random') {await generateRandomAlias();@@ -258,6 +261,8 @@ export default function AddEditCredentialScreen() : React.ReactNode {position: 'bottom'});}, 200);++ setIsLoading(false);}}, [isEditMode, id, serviceUrl, router, executeVaultMutation, dbContext.sqliteClient, mode, generateRandomAlias, webApi]);@@ -494,7 +499,8 @@ export default function AddEditCredentialScreen() : React.ReactNode {)}<ThemedSafeAreaView style={styles.container}><ThemedView style={styles.content}>- <ScrollView>+ <ScrollView+ >{!isEditMode && (<View style={styles.modeSelector}><TouchableOpacitydiff --git a/apps/mobile-app/app/(tabs)/settings/auto-lock.tsx b/apps/mobile-app/app/(tabs)/settings/auto-lock.tsxindex 0009501a6..302037b79 100644--- a/apps/mobile-app/app/(tabs)/settings/auto-lock.tsx+++ b/apps/mobile-app/app/(tabs)/settings/auto-lock.tsx@@ -1,4 +1,4 @@-import { StyleSheet, View, TouchableOpacity, ScrollView } from 'react-native';+import { StyleSheet, View, TouchableOpacity } from 'react-native';import { Ionicons } from '@expo/vector-icons';import { useEffect, useState } from 'react';@@ -6,6 +6,7 @@ import { ThemedText } from '@/components/themed/ThemedText';import { ThemedView } from '@/components/themed/ThemedView';import { useColors } from '@/hooks/useColorScheme';import { useAuth } from '@/context/AuthContext';+import { ThemedScrollView } from '@/components/themed/ThemedScrollView';/*** Auto-lock screen.@@ -65,12 +66,6 @@ export default function AutoLockScreen() : React.ReactNode {flex: 1,fontSize: 16,},- scrollContent: {- paddingBottom: 40,- },- scrollView: {- flex: 1,- },selectedIcon: {color: colors.primary,marginLeft: 8,@@ -79,10 +74,7 @@ export default function AutoLockScreen() : React.ReactNode {return (<ThemedView style={styles.container}>- <ScrollView- style={styles.scrollView}- contentContainerStyle={styles.scrollContent}- >+ <ThemedScrollView><View style={styles.header}><ThemedText style={styles.headerText}>Choose how long the app can stay in the background before requiring re-authentication. You'll need to use Face ID or enter your password to unlock the vault again.@@ -103,7 +95,7 @@ export default function AutoLockScreen() : React.ReactNode {)}</TouchableOpacity>))}- </ScrollView>+ </ThemedScrollView></ThemedView>);}\ No newline at end of filediff --git a/apps/mobile-app/app/(tabs)/settings/ios-autofill.tsx b/apps/mobile-app/app/(tabs)/settings/ios-autofill.tsxindex e1f453f1c..c301114b7 100644--- a/apps/mobile-app/app/(tabs)/settings/ios-autofill.tsx+++ b/apps/mobile-app/app/(tabs)/settings/ios-autofill.tsx@@ -1,10 +1,11 @@-import { StyleSheet, View, TouchableOpacity, ScrollView, Linking } from 'react-native';+import { StyleSheet, View, TouchableOpacity, Linking } from 'react-native';import { router } from 'expo-router';import { ThemedText } from '@/components/themed/ThemedText';import { ThemedView } from '@/components/themed/ThemedView';import { useColors } from '@/hooks/useColorScheme';import { useAuth } from '@/context/AuthContext';+import { ThemedScrollView } from '@/components/themed/ThemedScrollView';/*** iOS autofill screen.@@ -71,12 +72,6 @@ export default function IosAutofillScreen() : React.ReactNode {fontWeight: '600',marginBottom: 8,},- scrollContent: {- paddingBottom: 40,- },- scrollView: {- flex: 1,- },secondaryButton: {alignItems: 'center',backgroundColor: colors.accentBackground,@@ -99,10 +94,7 @@ export default function IosAutofillScreen() : React.ReactNode {return (<ThemedView style={styles.container}>- <ScrollView- style={styles.scrollView}- contentContainerStyle={styles.scrollContent}- >+ <ThemedScrollView><View style={styles.header}><ThemedText style={styles.headerText}>You can configure AliasVault to provide native password autofill functionality in iOS. Follow the instructions below to enable it.@@ -150,7 +142,7 @@ export default function IosAutofillScreen() : React.ReactNode {Note: You'll need to authenticate with Face ID/Touch ID or your device passcode when using autofill.</ThemedText></View>- </ScrollView>+ </ThemedScrollView></ThemedView>);}\ No newline at end of filediff --git a/apps/mobile-app/app/(tabs)/settings/vault-unlock.tsx b/apps/mobile-app/app/(tabs)/settings/vault-unlock.tsxindex 219e34a00..18e4f2eb1 100644--- a/apps/mobile-app/app/(tabs)/settings/vault-unlock.tsx+++ b/apps/mobile-app/app/(tabs)/settings/vault-unlock.tsx@@ -1,4 +1,4 @@-import { StyleSheet, View, ScrollView, Alert, Platform, Linking, Switch, TouchableOpacity } from 'react-native';+import { StyleSheet, View, Alert, Platform, Linking, Switch, TouchableOpacity } from 'react-native';import * as LocalAuthentication from 'expo-local-authentication';import { useState, useEffect, useCallback } from 'react';@@ -6,6 +6,7 @@ import { ThemedText } from '@/components/themed/ThemedText';import { ThemedSafeAreaView } from '@/components/themed/ThemedSafeAreaView';import { useColors } from '@/hooks/useColorScheme';import { AuthMethod, useAuth } from '@/context/AuthContext';+import { ThemedScrollView } from '@/components/themed/ThemedScrollView';/*** Vault unlock settings screen.@@ -147,20 +148,11 @@ export default function VaultUnlockSettingsScreen() : React.ReactNode {color: colors.text,fontSize: 16,},- scrollContent: {- paddingBottom: 40,- },- scrollView: {- flex: 1,- },});return (<ThemedSafeAreaView style={styles.container}>- <ScrollView- style={styles.scrollView}- contentContainerStyle={styles.scrollContent}- >+ <ThemedScrollView><View style={styles.header}><ThemedText style={styles.headerText}>Choose how you want to unlock your vault.@@ -206,7 +198,7 @@ export default function VaultUnlockSettingsScreen() : React.ReactNode {</ThemedText></View></View>- </ScrollView>+ </ThemedScrollView></ThemedSafeAreaView>);}\ No newline at end of filediff --git a/apps/mobile-app/components/Toast.tsx b/apps/mobile-app/components/Toast.tsxindex f630673a8..b9fa1b2a2 100644--- a/apps/mobile-app/components/Toast.tsx+++ b/apps/mobile-app/components/Toast.tsx@@ -1,36 +1,65 @@-import { View, Text } from 'react-native';+import { View, Text, StyleSheet } from 'react-native';import Toast from 'react-native-toast-message';type ToastProps = {- text1: string;+ text1?: string;text2?: string;};+const primaryColor = '#f97316';+const errorColor = '#dc2626';+const infoColor = '#3b82f6';+const shadowColor = '#000';+const textColor = '#fff';++const styles = StyleSheet.create({+ text1: {+ color: textColor,+ fontSize: 14,+ fontWeight: '500',+ },+ text2: {+ color: textColor,+ fontSize: 12,+ marginTop: 4,+ },+ toast: {+ backgroundColor: primaryColor,+ borderRadius: 8,+ elevation: 5,+ marginBottom: 70,+ marginHorizontal: 16,+ marginTop: 20,+ padding: 12,+ shadowColor: shadowColor,+ shadowOffset: {+ width: 0,+ height: 2,+ },+ shadowOpacity: 0.25,+ shadowRadius: 3.84,+ },+ toastError: {+ backgroundColor: errorColor,+ },+ toastInfo: {+ backgroundColor: infoColor,+ },+ toastSuccess: {+ backgroundColor: primaryColor,+ },+});+export const toastConfig = {/*** Success toast.*/success: (props: ToastProps): React.ReactNode => (<View- style={{- backgroundColor: '#f97316', // AliasVault orange- padding: 12,- borderRadius: 8,- marginHorizontal: 16,- marginBottom: 70,- marginTop: 20,- shadowColor: '#000',- shadowOffset: {- width: 0,- height: 2,- },- shadowOpacity: 0.25,- shadowRadius: 3.84,- elevation: 5,- }}+ style={[styles.toast, styles.toastSuccess]}>- <Text style={{ color: 'white', fontSize: 14, fontWeight: '500' }}>- {props.text1}+ <Text style={styles.text1}>+ {props.text1 ?? ''}</Text></View>),@@ -39,29 +68,14 @@ export const toastConfig = {*/error: (props: ToastProps): React.ReactNode => (<View- style={{- backgroundColor: '#dc2626', // Red- padding: 12,- borderRadius: 8,- marginHorizontal: 16,- marginBottom: 70,- marginTop: 30,- shadowColor: '#000',- shadowOffset: {- width: 0,- height: 2,- },- shadowOpacity: 0.25,- shadowRadius: 3.84,- elevation: 5,- }}+ style={[styles.toast, styles.toastError]}>- <Text style={{ color: 'white', fontSize: 14, fontWeight: '500' }}>- {props.text1}+ <Text style={styles.text1}>+ {props.text1 ?? ''}</Text>{props.text2 && (- <Text style={{ color: 'white', fontSize: 12, marginTop: 4 }}>- {props.text2}+ <Text style={styles.text2}>+ {props.text2 ?? ''}</Text>)}</View>@@ -71,25 +85,10 @@ export const toastConfig = {*/info: (props: ToastProps): React.ReactNode => (<View- style={{- backgroundColor: '#3b82f6', // Blue- padding: 12,- borderRadius: 8,- marginHorizontal: 16,- marginBottom: 70,- marginTop: 30,- shadowColor: '#000',- shadowOffset: {- width: 0,- height: 2,- },- shadowOpacity: 0.25,- shadowRadius: 3.84,- elevation: 5,- }}+ style={[styles.toast, styles.toastInfo]}>- <Text style={{ color: 'white', fontSize: 14, fontWeight: '500' }}>- {props.text1}+ <Text style={styles.text1}>+ {props.text1 ?? ''}</Text></View>),diff --git a/apps/mobile-app/components/credentials/CredentialIcon.tsx b/apps/mobile-app/components/credentials/CredentialIcon.tsxindex de674cd01..f744b5a3a 100644--- a/apps/mobile-app/components/credentials/CredentialIcon.tsx+++ b/apps/mobile-app/components/credentials/CredentialIcon.tsx@@ -63,7 +63,12 @@ export function CredentialIcon({ logo, style }: CredentialIconProps) : React.Reaheight={Number(style?.height ?? styles.logo.height)}style={{borderRadius: styles.logo.borderRadius,- ...(style as ImageStyle),+ width: Number(style?.width ?? styles.logo.width),+ height: Number(style?.height ?? styles.logo.height),+ marginLeft: Number(style?.marginLeft ?? 0),+ marginRight: Number(style?.marginRight ?? 0),+ marginTop: Number(style?.marginTop ?? 0),+ marginBottom: Number(style?.marginBottom ?? 0),}}/>);diff --git a/apps/mobile-app/components/form/ValidatedFormField.tsx b/apps/mobile-app/components/form/ValidatedFormField.tsxindex 81b273430..302ca5785 100644--- a/apps/mobile-app/components/form/ValidatedFormField.tsx+++ b/apps/mobile-app/components/form/ValidatedFormField.tsx@@ -7,11 +7,11 @@ import { ThemedText } from '@/components/themed/ThemedText';import { useColors } from '@/hooks/useColorScheme';type FormFieldButton = {- icon: string;+ icon: keyof typeof MaterialIcons.glyphMap;onPress: () => void;}-type ValidatedFormFieldRef = {+export type ValidatedFormFieldRef = {focus: () => void;selectAll: () => void;}@@ -27,7 +27,7 @@ type ValidatedFormFieldProps<T extends FieldValues> = Omit<TextInputProps, 'valu/*** Validated form field component.*/-export const ValidatedFormField = forwardRef<ValidatedFormFieldRef, ValidatedFormFieldProps<any>>(({+const ValidatedFormFieldComponent = forwardRef<ValidatedFormFieldRef, ValidatedFormFieldProps<FieldValues>>(({label,name,control,@@ -44,7 +44,6 @@ export const ValidatedFormField = forwardRef<ValidatedFormFieldRef, ValidatedFor* Focus the input.*/focus: (): void => {- console.log(inputRef.current);inputRef.current?.focus();},/**@@ -55,17 +54,16 @@ export const ValidatedFormField = forwardRef<ValidatedFormFieldRef, ValidatedFor}}));+ const colorRed = 'red';+const styles = StyleSheet.create({button: {borderLeftColor: colors.accentBorder,borderLeftWidth: 1,padding: 10,},- container: {- marginBottom: 16,- },errorText: {- color: 'red',+ color: colorRed,fontSize: 12,marginTop: 4,},@@ -84,7 +82,7 @@ export const ValidatedFormField = forwardRef<ValidatedFormFieldRef, ValidatedForflexDirection: 'row',},inputError: {- borderColor: 'red',+ borderColor: colorRed,},inputGroup: {marginBottom: 6,@@ -95,7 +93,7 @@ export const ValidatedFormField = forwardRef<ValidatedFormFieldRef, ValidatedFormarginBottom: 4,},requiredIndicator: {- color: 'red',+ color: colorRed,marginLeft: 4,},});@@ -128,7 +126,7 @@ export const ValidatedFormField = forwardRef<ValidatedFormFieldRef, ValidatedForonPress={button.onPress}underlayColor={colors.accentBackground}>- <MaterialIcons name={button.icon as any} size={20} color={colors.primary} />+ <MaterialIcons name={button.icon} size={20} color={colors.primary} /></TouchableHighlight>))}</View>@@ -138,4 +136,8 @@ export const ValidatedFormField = forwardRef<ValidatedFormFieldRef, ValidatedFor}}/>);-});\ No newline at end of file+});++ValidatedFormFieldComponent.displayName = 'ValidatedFormField';++export const ValidatedFormField = ValidatedFormFieldComponent as <T extends FieldValues>(props: ValidatedFormFieldProps<T> & { ref?: React.Ref<ValidatedFormFieldRef> }) => JSX.Element;\ No newline at end of filediff --git a/apps/mobile-app/components/themed/ThemedScrollView.tsx b/apps/mobile-app/components/themed/ThemedScrollView.tsxindex 552f19f54..302418d81 100644--- a/apps/mobile-app/components/themed/ThemedScrollView.tsx+++ b/apps/mobile-app/components/themed/ThemedScrollView.tsx@@ -5,6 +5,8 @@ type ThemedScrollViewProps = {lightColor?: string;darkColor?: string;children?: React.ReactNode;+ contentContainerStyle?: StyleProp<ViewStyle>;+ scrollIndicatorInsets?: { top?: number; bottom?: number };};/**@@ -14,6 +16,8 @@ export function ThemedScrollView({ style, lightColor, darkColor, ...otherProps }return (<ScrollViewstyle={[styles.container, style]}+ contentContainerStyle={[styles.contentContainer]}+ scrollIndicatorInsets={styles.scrollIndicatorInsets}{...otherProps}/>);@@ -24,4 +28,10 @@ const styles = StyleSheet.create({flex: 1,marginBottom: 80,},-});+ contentContainer: {+ paddingBottom: 40,+ },+ scrollIndicatorInsets: {+ bottom: 40,+ },+});\ No newline at end of filediff --git a/apps/mobile-app/hooks/useVaultMutate.ts b/apps/mobile-app/hooks/useVaultMutate.tsindex 5f330e284..c7fd21011 100644--- a/apps/mobile-app/hooks/useVaultMutate.ts+++ b/apps/mobile-app/hooks/useVaultMutate.ts@@ -26,7 +26,7 @@ export function useVaultMutate() : {syncStatus: string;} {const [isLoading, setIsLoading] = useState(false);- const [syncStatus, setSyncStatus] = useState('');+ const [syncStatus, setSyncStatus] = useState('Syncing vault');const authContext = useAuth();const dbContext = useDb();const webApi = useWebApi();@@ -39,7 +39,7 @@ export function useVaultMutate() : {operation: () => Promise<void>,options: VaultMutationOptions) : Promise<void> => {- setSyncStatus('Saving changes to vault...');+ setSyncStatus('Saving changes to vault');// Execute the provided operation (e.g. create/update/delete credential)await operation();@@ -53,7 +53,7 @@ export function useVaultMutate() : {throw new Error('Failed to get encrypted database');}- setSyncStatus('Uploading vault to server...');+ setSyncStatus('Uploading vault to server');// Get email addresses from credentialsconst credentials = await dbContext.sqliteClient!.getAllCredentials();@@ -103,7 +103,7 @@ export function useVaultMutate() : {) => {try {setIsLoading(true);- setSyncStatus('Checking for vault updates...');+ setSyncStatus('Checking for vault updates');await syncVault({/**diff --git a/apps/mobile-app/scripts/reset-project.js b/apps/mobile-app/scripts/reset-project.jsdeleted file mode 100755index 51dff15ac..000000000--- a/apps/mobile-app/scripts/reset-project.js+++ /dev/null@@ -1,112 +0,0 @@-#!/usr/bin/env node--/**- * This script is used to reset the project to a blank state.- * It deletes or moves the /app, /components, /hooks, /scripts, and /constants directories to /app-example based on user input and creates a new /app directory with an index.tsx and _layout.tsx file.- * You can remove the `reset-project` script from package.json and safely delete this file after running it.- */--const fs = require("fs");-const path = require("path");-const readline = require("readline");--const root = process.cwd();-const oldDirs = ["app", "components", "hooks", "constants", "scripts"];-const exampleDir = "app-example";-const newAppDir = "app";-const exampleDirPath = path.join(root, exampleDir);--const indexContent = `import { Text, View } from "react-native";--export default function Index() {- return (- <View- style={{- flex: 1,- justifyContent: "center",- alignItems: "center",- }}- >- <Text>Edit app/index.tsx to edit this screen.</Text>- </View>- );-}-`;--const layoutContent = `import { Stack } from "expo-router";--export default function RootLayout() {- return <Stack />;-}-`;--const rl = readline.createInterface({- input: process.stdin,- output: process.stdout,-});--const moveDirectories = async (userInput) => {- try {- if (userInput === "y") {- // Create the app-example directory- await fs.promises.mkdir(exampleDirPath, { recursive: true });- console.log(`📁 /${exampleDir} directory created.`);- }-- // Move old directories to new app-example directory or delete them- for (const dir of oldDirs) {- const oldDirPath = path.join(root, dir);- if (fs.existsSync(oldDirPath)) {- if (userInput === "y") {- const newDirPath = path.join(root, exampleDir, dir);- await fs.promises.rename(oldDirPath, newDirPath);- console.log(`➡️ /${dir} moved to /${exampleDir}/${dir}.`);- } else {- await fs.promises.rm(oldDirPath, { recursive: true, force: true });- console.log(`❌ /${dir} deleted.`);- }- } else {- console.log(`➡️ /${dir} does not exist, skipping.`);- }- }-- // Create new /app directory- const newAppDirPath = path.join(root, newAppDir);- await fs.promises.mkdir(newAppDirPath, { recursive: true });- console.log("\n📁 New /app directory created.");-- // Create index.tsx- const indexPath = path.join(newAppDirPath, "index.tsx");- await fs.promises.writeFile(indexPath, indexContent);- console.log("📄 app/index.tsx created.");-- // Create _layout.tsx- const layoutPath = path.join(newAppDirPath, "_layout.tsx");- await fs.promises.writeFile(layoutPath, layoutContent);- console.log("📄 app/_layout.tsx created.");-- console.log("\n✅ Project reset complete. Next steps:");- console.log(- `1. Run \`npx expo start\` to start a development server.\n2. Edit app/index.tsx to edit the main screen.${- userInput === "y"- ? `\n3. Delete the /${exampleDir} directory when you're done referencing it.`- : ""- }`- );- } catch (error) {- console.error(`❌ Error during script execution: ${error.message}`);- }-};--rl.question(- "Do you want to move existing files to /app-example instead of deleting them? (Y/n): ",- (answer) => {- const userInput = answer.trim().toLowerCase() || "y";- if (userInput === "y" || userInput === "n") {- moveDirectories(userInput).finally(() => rl.close());- } else {- console.log("❌ Invalid input. Please enter 'Y' or 'N'.");- rl.close();- }- }-);diff --git a/apps/mobile-app/specs/NativeVaultManager.ts b/apps/mobile-app/specs/NativeVaultManager.tsindex 1e71c610b..71d6ff17f 100644--- a/apps/mobile-app/specs/NativeVaultManager.ts+++ b/apps/mobile-app/specs/NativeVaultManager.ts@@ -1,8 +1,6 @@import type { TurboModule } from 'react-native';import { TurboModuleRegistry } from 'react-native';-import { VaultMetadata } from '@/utils/types/messaging/VaultMetadata';-// eslint-disable-next-line @typescript-eslint/naming-conventionexport interface Spec extends TurboModule {// Basic credential operations@@ -12,7 +10,7 @@ export interface Spec extends TurboModule {// Vault state managementhasStoredVault(): Promise<boolean>;isVaultUnlocked(): Promise<boolean>;- getVaultMetadata(): Promise<VaultMetadata>;+ getVaultMetadata(): Promise<string>;unlockVault(): Promise<boolean>;// Database operations@@ -25,8 +23,8 @@ export interface Spec extends TurboModule {setCurrentVaultRevisionNumber(revisionNumber: number): Promise<void>;// SQL operations- executeQuery(query: string, params: string[]): Promise<string[]>;- executeUpdate(query: string, params: string[]): Promise<number>;+ executeQuery(query: string, params: (string | number | null)[]): Promise<string[]>;+ executeUpdate(query: string, params:(string | number | null)[]): Promise<number>;beginTransaction(): Promise<void>;commitTransaction(): Promise<void>;rollbackTransaction(): Promise<void>;diff --git a/apps/mobile-app/types/react-native-argon2.d.ts b/apps/mobile-app/types/react-native-argon2.d.tsindex bfdd0084a..7e47a6a53 100644--- a/apps/mobile-app/types/react-native-argon2.d.ts+++ b/apps/mobile-app/types/react-native-argon2.d.ts@@ -1,4 +1,5 @@declare module 'react-native-argon2' {+ // eslint-disable-next-line @typescript-eslint/naming-conventioninterface Argon2Options {iterations?: number;memory?: number;@@ -7,6 +8,7 @@ declare module 'react-native-argon2' {mode?: 'argon2i' | 'argon2d' | 'argon2id';}+ // eslint-disable-next-line @typescript-eslint/naming-conventioninterface Argon2Result {encodedHash: string;rawHash: string;diff --git a/apps/mobile-app/utils/EncryptionUtility.tsx b/apps/mobile-app/utils/EncryptionUtility.tsxindex 244248922..9ff500957 100644--- a/apps/mobile-app/utils/EncryptionUtility.tsx+++ b/apps/mobile-app/utils/EncryptionUtility.tsx@@ -1,9 +1,11 @@+import { Buffer } from 'buffer';+import argon2 from 'react-native-argon2';import AesGcmCrypto from 'react-native-aes-gcm-crypto';+import { Email } from './types/webapi/Email';import { EncryptionKey } from './types/EncryptionKey';import { MailboxEmail } from './types/webapi/MailboxEmail';-import { Buffer } from 'buffer';/*** Utility class for encryption operations including:@@ -110,8 +112,10 @@ class EncryptionUtility {* Generates a new RSA key pair for asymmetric encryption*/public static async generateRsaKeyPair(): Promise<{ publicKey: string, privateKey: string }> {- // TODO: this method is currently unused. When we enable the app to actually generate keys, check if the key pair is- // generated in the correct format where private key is in expected JWK format that the WASM app already outputs.+ /*+ * TODO: this method is currently unused. When we enable the app to actually generate keys, check if 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",@@ -179,7 +183,6 @@ class EncryptionUtility {const plaintextBuffer = await crypto.subtle.decrypt({name: "RSA-OAEP",- hash: "SHA-256",},privateKeyObj,cipherBuffer@@ -188,7 +191,7 @@ class EncryptionUtility {return new Uint8Array(plaintextBuffer);} catch (error) {console.error('RSA decryption failed:', error);- throw new Error(`Failed to decrypt: ${error.message}`);+ throw new Error(`Failed to decrypt: ${error instanceof Error ? error.message : 'Unknown error'}`);}}diff --git a/apps/mobile-app/utils/SqliteClient.tsx b/apps/mobile-app/utils/SqliteClient.tsxindex 3e7e271a5..111e3c047 100644--- a/apps/mobile-app/utils/SqliteClient.tsx+++ b/apps/mobile-app/utils/SqliteClient.tsx@@ -1,11 +1,9 @@-import { NativeModules } from 'react-native';-import { Credential } from './types/Credential';-import { EncryptionKey } from './types/EncryptionKey';-import { TotpCode } from './types/TotpCode';-import { PasswordSettings } from './types/PasswordSettings';-import { VaultMetadata } from './types/messaging/VaultMetadata';-import NativeVaultManager from '../specs/NativeVaultManager';-+import NativeVaultManager from '@/specs/NativeVaultManager';+import { Credential } from '@/utils/types/Credential';+import { EncryptionKey } from '@/utils/types/EncryptionKey';+import { TotpCode } from '@/utils/types/TotpCode';+import { PasswordSettings } from '@/utils/types/PasswordSettings';+import { VaultMetadata } from '@/utils/types/messaging/VaultMetadata';type SQLiteBindValue = string | number | null | Uint8Array;@@ -16,7 +14,7 @@ class SqliteClient {/*** Store the encrypted database via the native code implementation.*/- async storeEncryptedDatabase(base64EncryptedDb: string): Promise<void> {+ public async storeEncryptedDatabase(base64EncryptedDb: string): Promise<void> {try {await NativeVaultManager.storeDatabase(base64EncryptedDb);} catch (error) {@@ -32,7 +30,7 @@ class SqliteClient {* - public and private email domains* - vault revision number*/- async storeMetadata(metadata: string): Promise<void> {+ public async storeMetadata(metadata: string): Promise<void> {try {await NativeVaultManager.storeMetadata(metadata);} catch (error) {@@ -55,7 +53,7 @@ class SqliteClient {try {return JSON.parse(metadataJson) as VaultMetadata;- } catch (parseError) {+ } catch {throw new Error('Failed to parse vault metadata from native storage');}} catch (error) {@@ -64,7 +62,7 @@ class SqliteClient {}}- /**+ /*** Get the default email domain from the vault metadata.* Returns the first valid private domain if available, otherwise the first valid public domain.* Returns null if no valid domains are found.@@ -78,7 +76,9 @@ class SqliteClient {const { privateEmailDomains, publicEmailDomains } = metadata;- // Check if a domain is valid (not empty, not 'DISABLED.TLD', and exists in either private or public domains)+ /**+ * Check if a domain is valid (not empty, not 'DISABLED.TLD', and exists in either private or public domains)+ */const isValidDomain = (domain: string): boolean => {return Boolean(domain &&domain !== 'DISABLED.TLD' &&@@ -129,12 +129,16 @@ class SqliteClient {*/public async executeQuery<T>(query: string, params: SQLiteBindValue[] = []): Promise<T[]> {try {- // Convert any Uint8Array parameters to base64 strings as the Native wrapper- // communication requires everything to be a string.+ /*+ * Convert any Uint8Array parameters to base64 strings as the Native wrapper+ * communication requires everything to be a string.+ */const convertedParams = params.map(param => {if (param instanceof Uint8Array) {- // We prefix the base64 string with "av-base64:" to indicate that it is a base64 encoded Uint8Array.- // So the receiving end knows that it should convert this value back to a Uint8Array before using it in the query.+ /*+ * We prefix the base64 string with "av-base64:" to indicate that it is a base64 encoded Uint8Array.+ * So the receiving end knows that it should convert this value back to a Uint8Array before using it in the query.+ */return 'av-base64-to-blob:' + Buffer.from(param).toString('base64');}return param;@@ -153,12 +157,16 @@ class SqliteClient {*/public async executeUpdate(query: string, params: SQLiteBindValue[] = []): Promise<number> {try {- // Convert any Uint8Array parameters to base64 strings as the Native wrapper- // communication requires everything to be a string.+ /*+ * Convert any Uint8Array parameters to base64 strings as the Native wrapper+ * communication requires everything to be a string.+ */const convertedParams = params.map(param => {if (param instanceof Uint8Array) {- // We prefix the base64 string with "av-base64-to-blob:" to indicate that it is a base64 encoded Uint8Array.- // So the receiving end knows that it should convert this value back to a Uint8Array before using it in the query.+ /*+ * We prefix the base64 string with "av-base64-to-blob:" to indicate that it is a base64 encoded Uint8Array.+ * So the receiving end knows that it should convert this value back to a Uint8Array before using it in the query.+ */return 'av-base64-to-blob:' + Buffer.from(param).toString('base64');}return param;@@ -215,6 +223,7 @@ class SqliteClient {}// Convert the first row to a Credential object+ // eslint-disable-next-line @typescript-eslint/no-explicit-anyconst row = results[0] as any;return {Id: row.Id,@@ -263,6 +272,7 @@ class SqliteClient {WHERE c.IsDeleted = 0ORDER BY c.CreatedAt DESC`;+ // eslint-disable-next-line @typescript-eslint/no-explicit-anyconst results = await this.executeQuery<any>(query);return results.map((row) => ({@@ -294,9 +304,9 @@ class SqliteClient {await NativeVaultManager.beginTransaction();const currentDateTime = new Date().toISOString()- .replace('T', ' ')- .replace('Z', '')- .substring(0, 23);+ .replace('T', ' ')+ .replace('Z', '')+ .substring(0, 23);// Update the credential, alias, and service to be deletedconst query = `@@ -353,6 +363,7 @@ class SqliteClient {const results = await this.executeQuery(query);+ // eslint-disable-next-line @typescript-eslint/no-explicit-anyreturn results.map((row: any) => row.Email);}@@ -510,18 +521,6 @@ class SqliteClient {}await NativeVaultManager.commitTransaction();- console.log('Credential created successfully');- console.log('Credential ID:', credentialId);-- // Can we do select query here to check if the credential was created?- const credential2 = await this.getCredentialById(credentialId);- if (!credential2) {- console.log('Credential could not be retrieved after creation??');- }- else {- console.log('Credential retrieved successfully?');- }-return credentialId;} catch (error) {@@ -654,6 +653,7 @@ class SqliteClient {}// Convert the first row to a Credential object+ // eslint-disable-next-line @typescript-eslint/no-explicit-anyconst row = results[0] as any;return {Id: row.Id,diff --git a/apps/mobile-app/utils/SrpUtility.tsx b/apps/mobile-app/utils/SrpUtility.tsxindex 904a6806f..f854072c7 100644--- a/apps/mobile-app/utils/SrpUtility.tsx+++ b/apps/mobile-app/utils/SrpUtility.tsx@@ -1,14 +1,21 @@import srp from 'secure-remote-password/client';+import { WebApiService } from '@/utils/WebApiService';import { LoginResponse } from '@/utils/types/webapi/Login';import { ApiAuthError } from '@/utils/types/errors/ApiAuthError';import { ValidateLoginRequest2Fa, ValidateLoginResponse } from '@/utils/types/webapi/ValidateLogin';import BadRequestResponse from '@/utils/types/webapi/BadRequestResponse';+/**+ * Utility class for SRP login and validation operations.+ */export class SrpUtility {private webApiService: WebApiService;- constructor(webApiService: WebApiService) {+ /**+ * Constructor+ */+ public constructor(webApiService: WebApiService) {this.webApiService = webApiService;}diff --git a/apps/mobile-app/utils/WebApiService.ts b/apps/mobile-app/utils/WebApiService.tsindex 0a504909c..531048fd4 100644--- a/apps/mobile-app/utils/WebApiService.ts+++ b/apps/mobile-app/utils/WebApiService.ts@@ -1,8 +1,9 @@-import { AppInfo } from "./AppInfo";-import { StatusResponse } from "./types/webapi/StatusResponse";-import { VaultResponse } from "./types/webapi/VaultResponse";import AsyncStorage from '@react-native-async-storage/async-storage';+import { AppInfo } from '@/utils/AppInfo';+import { StatusResponse } from '@/utils/types/webapi/StatusResponse';+import { VaultResponse } from '@/utils/types/webapi/VaultResponse';+type RequestInit = globalThis.RequestInit;/**diff --git a/apps/mobile-app/utils/types/Credential.ts b/apps/mobile-app/utils/types/Credential.tsindex 4d0a2d5ed..21ac52bdc 100644--- a/apps/mobile-app/utils/types/Credential.ts+++ b/apps/mobile-app/utils/types/Credential.ts@@ -1,4 +1,4 @@-import { Gender } from "../generators/Identity/types/Gender";+import { Gender } from "@/utils/shared/identity-generator";/*** Credential SQLite database type.diff --git a/apps/mobile-app/utils/validationSchema.ts b/apps/mobile-app/utils/validationSchema.tsindex fa85616cb..f7aa72bcf 100644--- a/apps/mobile-app/utils/validationSchema.ts+++ b/apps/mobile-app/utils/validationSchema.ts@@ -12,16 +12,18 @@ export const credentialSchema = Yup.object().shape({LastName: Yup.string().nullable().notRequired(),NickName: Yup.string().nullable().notRequired(),BirthDate: Yup.string()- .nullable()- .notRequired()- .test(- 'is-valid-date-format',- 'Date must be in YYYY-MM-DD format',- value => {- if (!value) return true; // allow empty- return /^\d{4}-\d{2}-\d{2}$/.test(value);- },- ),+ .nullable()+ .notRequired()+ .test(+ 'is-valid-date-format',+ 'Date must be in YYYY-MM-DD format',+ value => {+ if (!value) {+ return true;+ } // allow empty+ return /^\d{4}-\d{2}-\d{2}$/.test(value);+ },+ ),Gender: Yup.string().nullable().notRequired(),Email: Yup.string().email('Invalid email format').nullable().notRequired()}),