Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.
Add credentials detail page (#771)
Leendert de Borst5ae6e069ab7f
diff --git a/mobile-app/app/(tabs)/(credentials)/[id].tsx b/mobile-app/app/(tabs)/(credentials)/[id].tsxnew file mode 100644index 000000000..0207a737a--- /dev/null+++ b/mobile-app/app/(tabs)/(credentials)/[id].tsx@@ -0,0 +1,263 @@+import { useLocalSearchParams } from 'expo-router';+import { useEffect, useState } from 'react';+import { ActivityIndicator, View, Text, TouchableOpacity, Image, ScrollView, useColorScheme, StyleSheet } from 'react-native';+import * as Clipboard from 'expo-clipboard';+import { ThemedText } from '@/components/ThemedText';+import { ThemedView } from '@/components/ThemedView';+import { useDb } from '@/context/DbContext';+import { Credential } from '@/utils/types/Credential';+import SqliteClient from '@/utils/SqliteClient';++interface FormInputCopyToClipboardProps {+ label: string;+ value: string | undefined;+ type?: 'text' | 'password';+}++const FormInputCopyToClipboard: React.FC<FormInputCopyToClipboardProps> = ({+ label,+ value,+ type = 'text',+}) => {+ const [isPasswordVisible, setIsPasswordVisible] = useState(false);+ const colorScheme = useColorScheme();+ const isDarkMode = colorScheme === 'dark';++ const copyToClipboard = async () => {+ if (value) {+ await Clipboard.setStringAsync(value);+ }+ };++ const displayValue = type === 'password' && !isPasswordVisible+ ? '••••••••'+ : value;++ return (+ <TouchableOpacity+ onPress={copyToClipboard}+ style={[+ styles.inputContainer,+ {+ backgroundColor: isDarkMode ? '#1f2937' : '#f3f4f6',+ borderColor: isDarkMode ? '#374151' : '#d1d5db',+ },+ ]}+ >+ <View style={styles.inputContent}>+ <View>+ <Text style={[styles.label, { color: isDarkMode ? '#9ca3af' : '#6b7280' }]}>+ {label}+ </Text>+ <Text style={[styles.value, { color: isDarkMode ? '#f3f4f6' : '#1f2937' }]}>+ {displayValue}+ </Text>+ </View>+ <View style={styles.actions}>+ {type === 'password' && (+ <TouchableOpacity+ onPress={() => setIsPasswordVisible(!isPasswordVisible)}+ style={styles.iconButton}+ >+ <Text style={styles.iconText}>+ {isPasswordVisible ? '👁️' : '👁️🗨️'}+ </Text>+ </TouchableOpacity>+ )}+ <TouchableOpacity style={styles.iconButton}>+ <Text style={styles.iconText}>📋</Text>+ </TouchableOpacity>+ </View>+ </View>+ </TouchableOpacity>+ );+};++export default function CredentialDetailsScreen() {+ const { id } = useLocalSearchParams();+ const [credential, setCredential] = useState<Credential | null>(null);+ const [isLoading, setIsLoading] = useState(true);+ const dbContext = useDb();+ const colorScheme = useColorScheme();+ const isDarkMode = colorScheme === 'dark';++ useEffect(() => {+ const loadCredential = async () => {+ if (!dbContext.dbAvailable || !id) return;++ try {+ const cred = await dbContext.sqliteClient!.getCredentialById(id as string);+ setCredential(cred);+ } catch (err) {+ console.error('Error loading credential:', err);+ } finally {+ setIsLoading(false);+ }+ };++ loadCredential();+ }, [id, dbContext.dbAvailable]);++ if (isLoading) {+ return (+ <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>+ <ActivityIndicator size="large" color="#f97316" />+ </View>+ );+ }++ if (!credential) {+ return null;+ }++ const email = credential.Alias?.Email?.trim();+ const username = credential.Username?.trim();+ const password = credential.Password?.trim();+ const hasName = Boolean(credential.Alias?.FirstName?.trim() || credential.Alias?.LastName?.trim());+ const fullName = [credential.Alias?.FirstName, credential.Alias?.LastName].filter(Boolean).join(' ');++ return (+ <ScrollView style={styles.container}>+ <ThemedView style={styles.header}>+ {credential.Logo && (+ <Image+ source={{ uri: SqliteClient.imgSrcFromBytes(credential.Logo) }}+ style={styles.logo}+ />+ )}+ <View style={styles.headerText}>+ <ThemedText type="title" style={styles.serviceName}>+ {credential.ServiceName}+ </ThemedText>+ {credential.ServiceUrl && (+ <Text style={[styles.serviceUrl, { color: isDarkMode ? '#60a5fa' : '#2563eb' }]}>+ {credential.ServiceUrl}+ </Text>+ )}+ </View>+ </ThemedView>++ <ThemedView style={styles.section}>+ <ThemedText type="subtitle">Login Credentials</ThemedText>+ {email && (+ <FormInputCopyToClipboard+ label="Email"+ value={email}+ />+ )}+ {username && (+ <FormInputCopyToClipboard+ label="Username"+ value={username}+ />+ )}+ {password && (+ <FormInputCopyToClipboard+ label="Password"+ value={password}+ type="password"+ />+ )}+ </ThemedView>++ {(hasName || credential.Alias?.NickName) && (+ <ThemedView style={styles.section}>+ <ThemedText type="subtitle">Alias</ThemedText>+ {hasName && (+ <FormInputCopyToClipboard+ label="Full Name"+ value={fullName}+ />+ )}+ {credential.Alias?.NickName && (+ <FormInputCopyToClipboard+ label="Nickname"+ value={credential.Alias.NickName}+ />+ )}+ </ThemedView>+ )}++ {credential.Notes && (+ <ThemedView style={styles.section}>+ <ThemedText type="subtitle">Notes</ThemedText>+ <View style={[styles.notesContainer, {+ backgroundColor: isDarkMode ? '#1f2937' : '#f3f4f6',+ borderColor: isDarkMode ? '#374151' : '#d1d5db',+ }]}>+ <Text style={[styles.notes, { color: isDarkMode ? '#f3f4f6' : '#1f2937' }]}>+ {credential.Notes}+ </Text>+ </View>+ </ThemedView>+ )}+ </ScrollView>+ );+}++const styles = StyleSheet.create({+ container: {+ flex: 1,+ },+ header: {+ flexDirection: 'row',+ alignItems: 'center',+ padding: 16,+ gap: 12,+ },+ headerText: {+ flex: 1,+ },+ logo: {+ width: 48,+ height: 48,+ borderRadius: 8,+ },+ serviceName: {+ fontSize: 24,+ fontWeight: 'bold',+ },+ serviceUrl: {+ fontSize: 14,+ },+ section: {+ padding: 16,+ gap: 12,+ },+ inputContainer: {+ borderRadius: 8,+ borderWidth: 1,+ marginVertical: 4,+ },+ inputContent: {+ flexDirection: 'row',+ justifyContent: 'space-between',+ alignItems: 'center',+ padding: 12,+ },+ label: {+ fontSize: 12,+ marginBottom: 4,+ },+ value: {+ fontSize: 16,+ },+ actions: {+ flexDirection: 'row',+ gap: 8,+ },+ iconButton: {+ padding: 8,+ },+ iconText: {+ fontSize: 16,+ },+ notesContainer: {+ padding: 12,+ borderRadius: 8,+ borderWidth: 1,+ },+ notes: {+ fontSize: 14,+ },+});\ No newline at end of filediff --git a/mobile-app/app/(tabs)/(credentials)/_layout.tsx b/mobile-app/app/(tabs)/(credentials)/_layout.tsxnew file mode 100644index 000000000..1e452cac6--- /dev/null+++ b/mobile-app/app/(tabs)/(credentials)/_layout.tsx@@ -0,0 +1,21 @@+import { Stack } from 'expo-router';++export default function CredentialsLayout() {+ return (+ <Stack>+ <Stack.Screen+ name="index"+ options={{+ headerShown: false,+ }}+ />+ <Stack.Screen+ name="[id]"+ options={{+ title: 'Credential Details',+ headerShown: true,+ }}+ />+ </Stack>+ );+}\ No newline at end of filediff --git a/mobile-app/app/(tabs)/index.tsx b/mobile-app/app/(tabs)/(credentials)/index.tsxsimilarity index 69%rename from mobile-app/app/(tabs)/index.tsxrename to mobile-app/app/(tabs)/(credentials)/index.tsxindex 2b2917508..4bac6570f 100644--- a/mobile-app/app/(tabs)/index.tsx+++ b/mobile-app/app/(tabs)/(credentials)/index.tsx@@ -1,5 +1,6 @@-import { StyleSheet, View, Text, SafeAreaView, FlatList, ActivityIndicator, useColorScheme } from 'react-native';+import { StyleSheet, View, Text, SafeAreaView, FlatList, ActivityIndicator, useColorScheme, TouchableOpacity } from 'react-native';import { useState, useEffect } from 'react';+import { router, Stack } from 'expo-router';import { ThemedText } from '@/components/ThemedText';import { ThemedView } from '@/components/ThemedView';@@ -36,6 +37,11 @@ export default function CredentialsScreen() {const isAuthenticated = authContext.isLoggedIn;const isDatabaseAvailable = dbContext.dbAvailable;+ const navigateToCredential = (credentialId: string) => {+ console.log('Navigating to credential:', credentialId);+ router.push(`/(tabs)/(credentials)/${credentialId}`);+ };+useEffect(() => {if (!isAuthenticated || !isDatabaseAvailable) {return;@@ -45,7 +51,6 @@ export default function CredentialsScreen() {setIsLoadingCredentials(true);try {const credentialsList = await dbContext.sqliteClient!.getAllCredentials();- console.log('credentialsList', credentialsList);setCredentialsList(credentialsList);} catch (err) {console.error('Error loading credentials:', err);@@ -58,10 +63,11 @@ export default function CredentialsScreen() {return (<SafeAreaView style={styles.container}>+ <Stack.Screen options={{ title: "Credentials" }} />+ <ThemedView style={styles.titleContainer}>+ <ThemedText type="title">Credentials</ThemedText>+ </ThemedView><ThemedView style={styles.content}>- <ThemedView style={styles.titleContainer}>- <ThemedText type="title">Credentials</ThemedText>- </ThemedView><ThemedView style={styles.stepContainer}>{isLoadingCredentials ? (<ActivityIndicator size="large" color="#f97316" />@@ -70,14 +76,29 @@ export default function CredentialsScreen() {data={credentialsList}keyExtractor={(item) => item.Id}renderItem={({ item }) => (- <View style={[styles.credentialItem, dynamicStyles.credentialItem]}>- <Text style={[styles.serviceName, dynamicStyles.serviceName]}>{item.ServiceName ?? 'Unknown Service'}</Text>- {item.Username && <Text style={[styles.credentialText, dynamicStyles.credentialText]}>Username: {item.Username}</Text>}- {item.Alias?.Email && <Text style={[styles.credentialText, dynamicStyles.credentialText]}>Email: {item.Alias.Email}</Text>}- </View>+ <TouchableOpacity+ onPress={() => navigateToCredential(item.Id)}+ style={[styles.credentialItem, dynamicStyles.credentialItem]}+ >+ <Text style={[styles.serviceName, dynamicStyles.serviceName]}>+ {item.ServiceName ?? 'Unknown Service'}+ </Text>+ {item.Username && (+ <Text style={[styles.credentialText, dynamicStyles.credentialText]}>+ Username: {item.Username}+ </Text>+ )}+ {item.Alias?.Email && (+ <Text style={[styles.credentialText, dynamicStyles.credentialText]}>+ Email: {item.Alias.Email}+ </Text>+ )}+ </TouchableOpacity>)}ListEmptyComponent={- <Text style={[styles.emptyText, dynamicStyles.emptyText]}>No credentials found</Text>+ <Text style={[styles.emptyText, dynamicStyles.emptyText]}>+ No credentials found+ </Text>}/>)}diff --git a/mobile-app/app/(tabs)/_layout.tsx b/mobile-app/app/(tabs)/_layout.tsxindex 9a453c8b9..97e3df440 100644--- a/mobile-app/app/(tabs)/_layout.tsx+++ b/mobile-app/app/(tabs)/_layout.tsx@@ -51,17 +51,17 @@ export default function TabLayout() {}),}}><Tabs.Screen- name="index"+ name="(credentials)"options={{title: 'Credentials',tabBarIcon: ({ color }) => <IconSymbol size={28} name="key.fill" color={color} />,}}/><Tabs.Screen- name="explore"+ name="emails"options={{- title: 'Explore',- tabBarIcon: ({ color }) => <IconSymbol size={28} name="paperplane.fill" color={color} />,+ title: 'Emails',+ tabBarIcon: ({ color }) => <IconSymbol size={28} name="envelope.fill" color={color} />,}}/><Tabs.Screendiff --git a/mobile-app/app/(tabs)/explore.tsx b/mobile-app/app/(tabs)/emails.tsxsimilarity index 100%rename from mobile-app/app/(tabs)/explore.tsxrename to mobile-app/app/(tabs)/emails.tsxdiff --git a/mobile-app/ios/CredentialManager/SharedCredentialStore.swift b/mobile-app/ios/CredentialManager/SharedCredentialStore.swiftindex f20e185c0..43dac693d 100644--- a/mobile-app/ios/CredentialManager/SharedCredentialStore.swift+++ b/mobile-app/ios/CredentialManager/SharedCredentialStore.swift@@ -255,7 +255,7 @@ class SharedCredentialStore {let statement = try db.prepare(query)var results: [[String: Any]] = []- for row in statement {+ for row in try statement.run(params) {var rowDict: [String: Any] = [:]for (index, column) in statement.columnNames.enumerated() {rowDict[column] = row[index]diff --git a/mobile-app/ios/Podfile.lock b/mobile-app/ios/Podfile.lockindex 709bf396b..5aa921bcf 100644--- a/mobile-app/ios/Podfile.lock+++ b/mobile-app/ios/Podfile.lock@@ -220,6 +220,8 @@ PODS:- ExpoModulesCore- ExpoBlur (14.0.3):- ExpoModulesCore+ - ExpoClipboard (7.0.1):+ - ExpoModulesCore- ExpoFileSystem (18.0.12):- ExpoModulesCore- ExpoFont (13.0.4):@@ -2112,6 +2114,7 @@ DEPENDENCIES:- expo-dev-menu-interface (from `../node_modules/expo-dev-menu-interface/ios`)- ExpoAsset (from `../node_modules/expo-asset/ios`)- ExpoBlur (from `../node_modules/expo-blur/ios`)+ - ExpoClipboard (from `../node_modules/expo-clipboard/ios`)- ExpoFileSystem (from `../node_modules/expo-file-system/ios`)- ExpoFont (from `../node_modules/expo-font/ios`)- ExpoHaptics (from `../node_modules/expo-haptics/ios`)@@ -2233,6 +2236,8 @@ EXTERNAL SOURCES::path: "../node_modules/expo-asset/ios"ExpoBlur::path: "../node_modules/expo-blur/ios"+ ExpoClipboard:+ :path: "../node_modules/expo-clipboard/ios"ExpoFileSystem::path: "../node_modules/expo-file-system/ios"ExpoFont:@@ -2417,6 +2422,7 @@ SPEC CHECKSUMS:expo-dev-menu-interface: 00dc42302a72722fdecec3fa048de84a9133bcc4ExpoAsset: 48386d40d53a8c1738929b3ed509bcad595b5516ExpoBlur: 392c1207f71d0ecf22371621c1fbd44ba84d9742+ ExpoClipboard: 44fd1c8959ee8f6175d059dc011b154c9709a969ExpoFileSystem: 42d363d3b96f9afab980dcef60d5657a4443c655ExpoFont: f354e926f8feae5e831ec8087f36652b44a0b188ExpoHaptics: 8d199b2f33245ea85289ff6c954c7ee7c00a5b5ddiff --git a/mobile-app/package-lock.json b/mobile-app/package-lock.jsonindex e4eefc340..c0c1bb3d1 100644--- a/mobile-app/package-lock.json+++ b/mobile-app/package-lock.json@@ -14,6 +14,7 @@"@react-navigation/native": "^7.0.14","expo": "~52.0.43","expo-blur": "~14.0.3",+ "expo-clipboard": "^7.0.1","expo-constants": "~17.0.8","expo-dev-client": "~5.0.19","expo-font": "~13.0.4",@@ -6750,6 +6751,17 @@"react-native": "*"}},+ "node_modules/expo-clipboard": {+ "version": "7.0.1",+ "resolved": "https://registry.npmjs.org/expo-clipboard/-/expo-clipboard-7.0.1.tgz",+ "integrity": "sha512-rqYk0+WoqitPcPKxmMxSpLonX1E5Ije3LBYfnYMbH3xU5Gr8EAH9QnOWOi4BgahUPvcot6nbFEnx+DqARrmxKQ==",+ "license": "MIT",+ "peerDependencies": {+ "expo": "*",+ "react": "*",+ "react-native": "*"+ }+ },"node_modules/expo-constants": {"version": "17.0.8","resolved": "https://registry.npmjs.org/expo-constants/-/expo-constants-17.0.8.tgz",diff --git a/mobile-app/package.json b/mobile-app/package.jsonindex 066ea6355..ca906a715 100644--- a/mobile-app/package.json+++ b/mobile-app/package.json@@ -21,6 +21,7 @@"@react-navigation/native": "^7.0.14","expo": "~52.0.43","expo-blur": "~14.0.3",+ "expo-clipboard": "^7.0.1","expo-constants": "~17.0.8","expo-dev-client": "~5.0.19","expo-font": "~13.0.4",diff --git a/mobile-app/utils/SqliteClient.tsx b/mobile-app/utils/SqliteClient.tsxindex 5bef43ea9..0fe1499dc 100644--- a/mobile-app/utils/SqliteClient.tsx+++ b/mobile-app/utils/SqliteClient.tsx@@ -106,9 +106,12 @@ class SqliteClient {const results = await this.executeQuery(query, [credentialId]);if (results.length === 0) {+ console.log('No results found for credential:', credentialId);return null;}+ console.log('Results found for credential:', results);+// Convert the first row to a Credential objectconst row = results[0] as any;return {