Skip to content

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

Add keychain access protected storage to iOS app (#771)

Leendert de Borstde6a46fb8e5b
diff --git a/mobile-app/app/(tabs)/index.tsx b/mobile-app/app/(tabs)/index.tsx
index 3f6db8c72..8eeb92d70 100644
--- a/mobile-app/app/(tabs)/index.tsx
+++ b/mobile-app/app/(tabs)/index.tsx
@@ -1,10 +1,7 @@
-import { Image, StyleSheet, Platform, Button, View, FlatList, Text } from 'react-native';
+import { Image, StyleSheet, Platform, Button, View, FlatList, Text, SafeAreaView, AppState } from 'react-native';
import { NativeModules } from 'react-native';
-import { useEffect, useState } from 'react';
-import { useFocusEffect } from '@react-navigation/native';
+import { useState, useEffect, useRef } from 'react';
-import { HelloWave } from '@/components/HelloWave';
-import ParallaxScrollView from '@/components/ParallaxScrollView';
import { ThemedText } from '@/components/ThemedText';
import { ThemedView } from '@/components/ThemedView';
@@ -16,8 +13,10 @@ interface Credential {
export default function HomeScreen() {
const [credentials, setCredentials] = useState<Credential[]>([]);
+ const appState = useRef(AppState.currentState);
const fetchCredentials = async () => {
+ console.log('Fetching credentials called');
try {
const result = await NativeModules.CredentialManager.getCredentials();
setCredentials(result);
@@ -27,12 +26,26 @@ export default function HomeScreen() {
};
useEffect(() => {
- fetchCredentials();
+ const subscription = AppState.addEventListener('change', nextAppState => {
+ if (
+ appState.current.match(/inactive|background/) &&
+ nextAppState === 'active'
+ ) {
+ console.log('App has come to the foreground!');
+ fetchCredentials();
+ }
+ appState.current = nextAppState;
+ });
+
+ return () => {
+ subscription.remove();
+ };
}, []);
- useFocusEffect(() => {
+ useEffect(() => {
+ console.log('Fetching credentials in useEffect once on mount');
fetchCredentials();
- });
+ }, []);
const handleInsertEntry = async () => {
// Generate a random credential
@@ -44,10 +57,12 @@ export default function HomeScreen() {
await NativeModules.CredentialManager.addCredential(randomUsername, randomPassword, randomService);
// Add a small delay to ensure the operation is complete
await new Promise(resolve => setTimeout(resolve, 100));
+
+ console.log('Fetching credentials after insert');
fetchCredentials(); // Refresh the list
};
- const handleClearVault = async () => {
+ const handleClearCredentials = async () => {
// Call native module to clear credentials
await NativeModules.CredentialManager.clearCredentials();
setCredentials([]); // Clear the list
@@ -62,60 +77,43 @@ export default function HomeScreen() {
);
return (
- <ParallaxScrollView
- headerBackgroundColor={{ light: '#A1CEDC', dark: '#1D3D47' }}
- headerImage={
- <Image
- source={require('@/assets/images/partial-react-logo.png')}
- style={styles.reactLogo}
- />
- }>
- <ThemedView style={styles.titleContainer}>
- <ThemedText type="title">AliasVault</ThemedText>
- <HelloWave />
+ <SafeAreaView style={styles.container}>
+ <ThemedView style={styles.content}>
+ <ThemedView style={styles.titleContainer}>
+ <ThemedText type="title">AliasVault</ThemedText>
+ </ThemedView>
+ <ThemedView style={styles.stepContainer}>
+ <ThemedText type="subtitle">Credentials</ThemedText>
+ <Button title="Add Random Credential" onPress={handleInsertEntry} />
+ <Button title="Clear Credentials" onPress={handleClearCredentials} />
+ <FlatList
+ data={credentials}
+ renderItem={({ item }) => renderCredential(item)}
+ keyExtractor={(item) => `${item.service}-${item.username}`}
+ />
+ </ThemedView>
</ThemedView>
-
- <ThemedView style={styles.buttonContainer}>
- <Button title="Insert Random Entry" onPress={handleInsertEntry} />
- <View style={styles.buttonSpacer} />
- <Button title="Clear Vault" onPress={handleClearVault} color="red" />
- </ThemedView>
-
- <ThemedView style={styles.credentialsContainer}>
- <ThemedText type="subtitle">Stored Credentials</ThemedText>
- <View style={styles.credentialsList}>
- {credentials.map(renderCredential)}
- </View>
- </ThemedView>
- </ParallaxScrollView>
+ </SafeAreaView>
);
}
const styles = StyleSheet.create({
+ container: {
+ flex: 1,
+ },
+ content: {
+ flex: 1,
+ padding: 16,
+ },
titleContainer: {
flexDirection: 'row',
alignItems: 'center',
gap: 8,
+ marginBottom: 16,
},
- buttonContainer: {
- marginVertical: 16,
- paddingHorizontal: 16,
- },
- buttonSpacer: {
- height: 8,
- },
- credentialsContainer: {
- marginTop: 16,
- paddingHorizontal: 16,
- },
- credentialsList: {
- marginTop: 8,
- },
- credentialItem: {
- padding: 12,
- marginBottom: 8,
- borderRadius: 8,
- backgroundColor: '#f0f0f0',
+ stepContainer: {
+ flex: 1,
+ gap: 8,
},
reactLogo: {
height: 178,
@@ -124,4 +122,9 @@ const styles = StyleSheet.create({
left: 0,
position: 'absolute',
},
+ credentialItem: {
+ padding: 10,
+ marginVertical: 5,
+ borderRadius: 5,
+ },
});
diff --git a/mobile-app/ios/CredentialManager.swift b/mobile-app/ios/CredentialManager.swift
index 00e47b160..209489911 100644
--- a/mobile-app/ios/CredentialManager.swift
+++ b/mobile-app/ios/CredentialManager.swift
@@ -1,5 +1,4 @@
import Foundation
-import aliasvault
import React
@objc(CredentialManager)
@@ -37,4 +36,4 @@ class CredentialManager: NSObject {
static func moduleName() -> String! {
return "CredentialManager"
}
-}
\ No newline at end of file
+}
diff --git a/mobile-app/ios/Podfile b/mobile-app/ios/Podfile
index 60e1e1841..4e6faf9aa 100644
--- a/mobile-app/ios/Podfile
+++ b/mobile-app/ios/Podfile
@@ -15,6 +15,7 @@ prepare_react_native_project!
target 'aliasvault' do
use_expo_modules!
+ pod 'KeychainAccess', '~> 4.2.2'
if ENV['EXPO_USE_COMMUNITY_AUTOLINKING'] == '1'
config_command = ['node', '-e', "process.argv=['', '', 'config'];require('@react-native-community/cli').run()"];
@@ -64,3 +65,7 @@ target 'aliasvault' do
end
end
end
+
+target 'autofill' do
+ pod 'KeychainAccess', '~> 4.2.2'
+end
diff --git a/mobile-app/ios/Podfile.lock b/mobile-app/ios/Podfile.lock
index 9b02806df..1715d0e12 100644
--- a/mobile-app/ios/Podfile.lock
+++ b/mobile-app/ios/Podfile.lock
@@ -271,6 +271,7 @@ PODS:
- hermes-engine (0.76.9):
- hermes-engine/Pre-built (= 0.76.9)
- hermes-engine/Pre-built (0.76.9)
+ - KeychainAccess (4.2.2)
- RCT-Folly (2024.10.14.00):
- boost
- DoubleConversion
@@ -2094,6 +2095,7 @@ DEPENDENCIES:
- fmt (from `../node_modules/react-native/third-party-podspecs/fmt.podspec`)
- glog (from `../node_modules/react-native/third-party-podspecs/glog.podspec`)
- hermes-engine (from `../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec`)
+ - KeychainAccess (~> 4.2.2)
- RCT-Folly (from `../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`)
- RCT-Folly/Fabric (from `../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`)
- RCTDeprecation (from `../node_modules/react-native/ReactApple/Libraries/RCTFoundation/RCTDeprecation`)
@@ -2161,6 +2163,7 @@ DEPENDENCIES:
SPEC REPOS:
trunk:
+ - KeychainAccess
- SocketRocket
EXTERNAL SOURCES:
@@ -2378,6 +2381,7 @@ SPEC CHECKSUMS:
fmt: 01b82d4ca6470831d1cc0852a1af644be019e8f6
glog: 08b301085f15bcbb6ff8632a8ebaf239aae04e6a
hermes-engine: 9e868dc7be781364296d6ee2f56d0c1a9ef0bb11
+ KeychainAccess: c0c4f7f38f6fc7bbe58f5702e25f7bd2f65abf51
RCT-Folly: ea9d9256ba7f9322ef911169a9f696e5857b9e17
RCTDeprecation: ebe712bb05077934b16c6bf25228bdec34b64f83
RCTRequired: ca91e5dd26b64f577b528044c962baf171c6b716
@@ -2442,6 +2446,6 @@ SPEC CHECKSUMS:
SocketRocket: d4aabe649be1e368d1318fdf28a022d714d65748
Yoga: feb4910aba9742cfedc059e2b2902e22ffe9954a
-PODFILE CHECKSUM: df3f49249e1f021de68bce0f8afee0bad1040321
+PODFILE CHECKSUM: 03a78591947e3a6d194308b096b4ee9acd698820
COCOAPODS: 1.16.2
diff --git a/mobile-app/ios/SharedCredentialStore.swift b/mobile-app/ios/SharedCredentialStore.swift
index 95c844f3e..58380c3eb 100644
--- a/mobile-app/ios/SharedCredentialStore.swift
+++ b/mobile-app/ios/SharedCredentialStore.swift
@@ -1,39 +1,120 @@
import Foundation
+import KeychainAccess
+import CryptoKit
-struct Credential: Codable {
- let username: String
- let password: String
- let service: String
+public struct Credential: Codable {
+ public let username: String
+ public let password: String
+ public let service: String
+
+ public init(username: String, password: String, service: String) {
+ self.username = username
+ self.password = password
+ self.service = service
+ }
}
-class SharedCredentialStore {
- static let shared = SharedCredentialStore()
- private let userDefaults: UserDefaults
+public class SharedCredentialStore {
+ public static let shared = SharedCredentialStore()
+ private let encryptionKeyKey = "encryptionKey"
private let credentialsKey = "storedCredentials"
+ private var cachedEncryptionKey: SymmetricKey?
private init() {
- // Use the app group identifier
- userDefaults = UserDefaults(suiteName: "group.net.aliasvault.autofill")!
+
}
- func getAllCredentials() -> [Credential] {
- guard let data = userDefaults.data(forKey: credentialsKey) else { return [] }
- return (try? JSONDecoder().decode([Credential].self, from: data)) ?? []
+ private func getEncryptionKey() throws -> SymmetricKey {
+ print("Getting encryption key")
+
+ if let cached = cachedEncryptionKey {
+ // Verify the cached key is valid by checking its bit length
+ if cached.bitCount == 256 {
+ print("Using cached encryption key")
+ return cached
+ } else {
+ print("Cached key is invalid, clearing cache")
+ cachedEncryptionKey = nil
+ }
+ }
+
+ print("No cached key, accessing keychain")
+ // Create a new keychain instance with authentication required for this specific access
+ let authKeychain = Keychain(service: "net.aliasvault.autofill", accessGroup: "group.net.aliasvault.autofill")
+ .accessibility(.whenPasscodeSetThisDeviceOnly, authenticationPolicy: [.biometryAny])
+ .authenticationPrompt("Authenticate to unlock your vault")
+
+ // Try to get existing key from keychain
+ if let keyData = try? authKeychain.getData(encryptionKeyKey) {
+ print("Found existing key in keychain")
+ let key = SymmetricKey(data: keyData)
+ cachedEncryptionKey = key
+ return key
+ }
+
+ print("Creating new encryption key")
+ // Create new key if none exists
+ let key = SymmetricKey(size: .bits256)
+ try authKeychain.set(key.withUnsafeBytes { Data($0) }, key: encryptionKeyKey)
+ cachedEncryptionKey = key
+ return key
}
- func addCredential(_ credential: Credential) {
+ private func encrypt(_ data: Data) throws -> Data {
+ print("Encrypting data")
+ let key = try getEncryptionKey()
+ let sealedBox = try AES.GCM.seal(data, using: key)
+ return sealedBox.combined ?? Data()
+ }
+
+ private func decrypt(_ data: Data) throws -> Data {
+ print("Decrypting data")
+ let key = try getEncryptionKey()
+ let sealedBox = try AES.GCM.SealedBox(combined: data)
+ return try AES.GCM.open(sealedBox, using: key)
+ }
+
+ public func getAllCredentials() -> [Credential] {
+ print("Getting all credentials")
+ guard let encryptedData = UserDefaults.standard.data(forKey: credentialsKey) else {
+ print("No encrypted data found in UserDefaults")
+ return []
+ }
+ do {
+ let decryptedData = try decrypt(encryptedData)
+ return try JSONDecoder().decode([Credential].self, from: decryptedData)
+ } catch {
+ print("Failed to decrypt credentials: \(error)")
+ return []
+ }
+ }
+
+ public func addCredential(_ credential: Credential) {
+ print("Adding new credential")
var credentials = getAllCredentials()
credentials.append(credential)
- saveCredentials(credentials)
+ do {
+ let data = try JSONEncoder().encode(credentials)
+ let encryptedData = try encrypt(data)
+ UserDefaults.standard.set(encryptedData, forKey: credentialsKey)
+ } catch {
+ print("Failed to save credentials: \(error)")
+ }
}
- func clearAllCredentials() {
- userDefaults.removeObject(forKey: credentialsKey)
+ public func clearAllCredentials() {
+ print("Clearing all credentials")
+ UserDefaults.standard.removeObject(forKey: credentialsKey)
+
+ let authKeychain = Keychain(service: "net.aliasvault.autofill", accessGroup: "group.net.aliasvault.autofill")
+ .accessibility(.whenPasscodeSetThisDeviceOnly, authenticationPolicy: [.biometryAny])
+ .authenticationPrompt("Authenticate to unlock your vault")
+
+ try? authKeychain.removeAll()
}
- private func saveCredentials(_ credentials: [Credential]) {
- if let data = try? JSONEncoder().encode(credentials) {
- userDefaults.set(data, forKey: credentialsKey)
- }
+ public func clearCache() {
+ print("Clearing encryption key cache")
+ cachedEncryptionKey = nil
}
-}
\ No newline at end of file
+}
diff --git a/mobile-app/ios/aliasvault.xcodeproj/project.pbxproj b/mobile-app/ios/aliasvault.xcodeproj/project.pbxproj
index 4ac991dd5..17f08e5d3 100644
--- a/mobile-app/ios/aliasvault.xcodeproj/project.pbxproj
+++ b/mobile-app/ios/aliasvault.xcodeproj/project.pbxproj
@@ -21,6 +21,7 @@
CEE909802DA548C7008D568F /* AuthenticationServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CEE9097F2DA548C7008D568F /* AuthenticationServices.framework */; };
CEE9098B2DA548C7008D568F /* autofill.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = CEE9097E2DA548C7008D568F /* autofill.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
D6E19ADE0A608FA46984C60D /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = BA88D6CB4FD656C7180FE9F7 /* PrivacyInfo.xcprivacy */; };
+ E27FBC0C55B558341BE46CA9 /* libPods-autofill.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8EB908A1F1D5DF89C6E9B015 /* libPods-autofill.a */; };
E8FD7000523F4549908941A2 /* noop-file.swift in Sources */ = {isa = PBXBuildFile; fileRef = 76D5DBE3C1FA4900A7CD27FB /* noop-file.swift */; };
/* End PBXBuildFile section */
@@ -55,10 +56,13 @@
13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = aliasvault/Images.xcassets; sourceTree = "<group>"; };
13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = aliasvault/Info.plist; sourceTree = "<group>"; };
13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = aliasvault/main.m; sourceTree = "<group>"; };
+ 3AF4FFC0208E24B0BC548155 /* Pods-autofill.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-autofill.debug.xcconfig"; path = "Target Support Files/Pods-autofill/Pods-autofill.debug.xcconfig"; sourceTree = "<group>"; };
+ 43471F4D97BB0D62D2B687AD /* Pods-autofill.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-autofill.release.xcconfig"; path = "Target Support Files/Pods-autofill/Pods-autofill.release.xcconfig"; sourceTree = "<group>"; };
58EEBF8E8E6FB1BC6CAF49B5 /* libPods-aliasvault.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-aliasvault.a"; sourceTree = BUILT_PRODUCTS_DIR; };
6C2E3173556A471DD304B334 /* Pods-aliasvault.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-aliasvault.debug.xcconfig"; path = "Target Support Files/Pods-aliasvault/Pods-aliasvault.debug.xcconfig"; sourceTree = "<group>"; };
76D5DBE3C1FA4900A7CD27FB /* noop-file.swift */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.swift; name = "noop-file.swift"; path = "aliasvault/noop-file.swift"; sourceTree = "<group>"; };
7A4D352CD337FB3A3BF06240 /* Pods-aliasvault.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-aliasvault.release.xcconfig"; path = "Target Support Files/Pods-aliasvault/Pods-aliasvault.release.xcconfig"; sourceTree = "<group>"; };
+ 8EB908A1F1D5DF89C6E9B015 /* libPods-autofill.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-autofill.a"; sourceTree = BUILT_PRODUCTS_DIR; };
962DE0FB93C9458BAFEEED60 /* aliasvault-Bridging-Header.h */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.c.h; name = "aliasvault-Bridging-Header.h"; path = "aliasvault/aliasvault-Bridging-Header.h"; sourceTree = "<group>"; };
AA286B85B6C04FC6940260E9 /* SplashScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = SplashScreen.storyboard; path = aliasvault/SplashScreen.storyboard; sourceTree = "<group>"; };
BA88D6CB4FD656C7180FE9F7 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xml; name = PrivacyInfo.xcprivacy; path = aliasvault/PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
@@ -100,6 +104,7 @@
buildActionMask = 2147483647;
files = (
CEE909802DA548C7008D568F /* AuthenticationServices.framework in Frameworks */,
+ E27FBC0C55B558341BE46CA9 /* libPods-autofill.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -132,6 +137,7 @@
ED297162215061F000B7C4FE /* JavaScriptCore.framework */,
58EEBF8E8E6FB1BC6CAF49B5 /* libPods-aliasvault.a */,
CEE9097F2DA548C7008D568F /* AuthenticationServices.framework */,
+ 8EB908A1F1D5DF89C6E9B015 /* libPods-autofill.a */,
);
name = Frameworks;
sourceTree = "<group>";
@@ -190,6 +196,8 @@
children = (
6C2E3173556A471DD304B334 /* Pods-aliasvault.debug.xcconfig */,
7A4D352CD337FB3A3BF06240 /* Pods-aliasvault.release.xcconfig */,
+ 3AF4FFC0208E24B0BC548155 /* Pods-autofill.debug.xcconfig */,
+ 43471F4D97BB0D62D2B687AD /* Pods-autofill.release.xcconfig */,
);
path = Pods;
sourceTree = "<group>";
@@ -233,6 +241,7 @@
isa = PBXNativeTarget;
buildConfigurationList = CEE909902DA548C7008D568F /* Build configuration list for PBXNativeTarget "autofill" */;
buildPhases = (
+ 4C04864D2A53FF778EC8B6B7 /* [CP] Check Pods Manifest.lock */,
CEE9097A2DA548C7008D568F /* Sources */,
CEE9097B2DA548C7008D568F /* Frameworks */,
CEE9097C2DA548C7008D568F /* Resources */,
@@ -245,8 +254,6 @@
CEE909812DA548C7008D568F /* autofill */,
);
name = autofill;
- packageProductDependencies = (
- );
productName = autofill;
productReference = CEE9097E2DA548C7008D568F /* autofill.appex */;
productType = "com.apple.product-type.app-extension";
@@ -346,6 +353,28 @@
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
+ 4C04864D2A53FF778EC8B6B7 /* [CP] Check Pods Manifest.lock */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputFileListPaths = (
+ );
+ inputPaths = (
+ "${PODS_PODFILE_DIR_PATH}/Podfile.lock",
+ "${PODS_ROOT}/Manifest.lock",
+ );
+ name = "[CP] Check Pods Manifest.lock";
+ outputFileListPaths = (
+ );
+ outputPaths = (
+ "$(DERIVED_FILE_DIR)/Pods-autofill-checkManifestLockResult.txt",
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
+ showEnvVarsInLog = 0;
+ };
800E24972A6A228C8D4807E9 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
@@ -649,6 +678,7 @@
};
CEE9098D2DA548C7008D568F /* Debug */ = {
isa = XCBuildConfiguration;
+ baseConfigurationReference = 3AF4FFC0208E24B0BC548155 /* Pods-autofill.debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
CLANG_ANALYZER_NONNULL = YES;
@@ -679,6 +709,7 @@
MARKETING_VERSION = 1.0;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
+ OTHER_SWIFT_FLAGS = "$(inherited) -D EXPO_CONFIGURATION_DEBUG";
PRODUCT_BUNDLE_IDENTIFIER = net.aliasvault.app.autofill;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
@@ -692,6 +723,7 @@
};
CEE9098E2DA548C7008D568F /* Release */ = {
isa = XCBuildConfiguration;
+ baseConfigurationReference = 43471F4D97BB0D62D2B687AD /* Pods-autofill.release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
CLANG_ANALYZER_NONNULL = YES;
@@ -722,6 +754,7 @@
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
MARKETING_VERSION = 1.0;
MTL_FAST_MATH = YES;
+ OTHER_SWIFT_FLAGS = "$(inherited) -D EXPO_CONFIGURATION_RELEASE";
PRODUCT_BUNDLE_IDENTIFIER = net.aliasvault.app.autofill;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
diff --git a/mobile-app/ios/aliasvault/CredentialManager.swift b/mobile-app/ios/aliasvault/CredentialManager.swift
deleted file mode 100644
index b172aa7d5..000000000
--- a/mobile-app/ios/aliasvault/CredentialManager.swift
+++ /dev/null
@@ -1,50 +0,0 @@
-import Foundation
-import aliasvault
-import React
-
-@objc(CredentialManager)
-class CredentialManager: NSObject {
- @objc
- func addCredential(_ username: String, password: String, service: String) {
- let credential = Credential(username: username, password: password, service: service)
- SharedCredentialStore.shared.addCredential(credential)
- }
-
- @objc
- func clearCredentials() {
- SharedCredentialStore.shared.clearAllCredentials()
- }
-
- @objc
- func getCredentials(_ resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
- let credentials = SharedCredentialStore.shared.getAllCredentials()
- let credentialDicts = credentials.map { credential in
- return [
- "username": credential.username,
- "password": credential.password,
- "service": credential.service
- ]
- }
- resolve(credentialDicts)
- }
-
- @objc
- static func requiresMainQueueSetup() -> Bool {
- return false
- }
-
- @objc
- static func moduleName() -> String! {
- return "CredentialManager"
- }
-
- @objc
- func constantsToExport() -> [AnyHashable : Any]! {
- return [:]
- }
-
- @objc
- func methodsToExport() -> [String]! {
- return ["addCredential", "clearCredentials", "getCredentials"]
- }
-}
\ No newline at end of file
diff --git a/mobile-app/ios/aliasvault/Info.plist b/mobile-app/ios/aliasvault/Info.plist
index 17ab0e66f..9ea1048b0 100644
--- a/mobile-app/ios/aliasvault/Info.plist
+++ b/mobile-app/ios/aliasvault/Info.plist
@@ -1,90 +1,92 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
- <dict>
- <key>ASCredentialProviderExtension</key>
- <dict>
- <key>IsEnabled</key>
- <true/>
- </dict>
- <key>CADisableMinimumFrameDurationOnPhone</key>
- <true/>
- <key>CFBundleDevelopmentRegion</key>
- <string>$(DEVELOPMENT_LANGUAGE)</string>
- <key>CFBundleDisplayName</key>
- <string>aliasvault</string>
- <key>CFBundleExecutable</key>
- <string>$(EXECUTABLE_NAME)</string>
- <key>CFBundleIdentifier</key>
- <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
- <key>CFBundleInfoDictionaryVersion</key>
- <string>6.0</string>
- <key>CFBundleName</key>
- <string>$(PRODUCT_NAME)</string>
- <key>CFBundlePackageType</key>
- <string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
- <key>CFBundleShortVersionString</key>
- <string>1.0.0</string>
- <key>CFBundleSignature</key>
- <string>????</string>
- <key>CFBundleURLTypes</key>
- <array>
- <dict>
- <key>CFBundleURLSchemes</key>
- <array>
- <string>aliasvault</string>
- <string>net.aliasvault.app</string>
- </array>
- </dict>
- <dict>
- <key>CFBundleURLSchemes</key>
- <array>
- <string>exp+aliasvault</string>
- </array>
- </dict>
- </array>
- <key>CFBundleVersion</key>
- <string>1</string>
- <key>LSMinimumSystemVersion</key>
- <string>12.0</string>
- <key>LSRequiresIPhoneOS</key>
- <true/>
- <key>NSAppTransportSecurity</key>
- <dict>
- <key>NSAllowsArbitraryLoads</key>
- <false/>
- <key>NSAllowsLocalNetworking</key>
- <true/>
- </dict>
- <key>NSUserActivityTypes</key>
- <array>
- <string>$(PRODUCT_BUNDLE_IDENTIFIER).expo.index_route</string>
- </array>
- <key>UILaunchStoryboardName</key>
- <string>SplashScreen</string>
- <key>UIRequiredDeviceCapabilities</key>
- <array>
- <string>arm64</string>
- </array>
- <key>UIRequiresFullScreen</key>
- <false/>
- <key>UIStatusBarStyle</key>
- <string>UIStatusBarStyleDefault</string>
- <key>UISupportedInterfaceOrientations</key>
- <array>
- <string>UIInterfaceOrientationPortrait</string>
- <string>UIInterfaceOrientationPortraitUpsideDown</string>
- </array>
- <key>UISupportedInterfaceOrientations~ipad</key>
- <array>
- <string>UIInterfaceOrientationPortrait</string>
- <string>UIInterfaceOrientationPortraitUpsideDown</string>
- <string>UIInterfaceOrientationLandscapeLeft</string>
- <string>UIInterfaceOrientationLandscapeRight</string>
- </array>
- <key>UIUserInterfaceStyle</key>
- <string>Automatic</string>
- <key>UIViewControllerBasedStatusBarAppearance</key>
- <false/>
- </dict>
-</plist>
\ No newline at end of file
+<dict>
+ <key>ASCredentialProviderExtension</key>
+ <dict>
+ <key>IsEnabled</key>
+ <true/>
+ </dict>
+ <key>CADisableMinimumFrameDurationOnPhone</key>
+ <true/>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>$(DEVELOPMENT_LANGUAGE)</string>
+ <key>CFBundleDisplayName</key>
+ <string>aliasvault</string>
+ <key>CFBundleExecutable</key>
+ <string>$(EXECUTABLE_NAME)</string>
+ <key>CFBundleIdentifier</key>
+ <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>$(PRODUCT_NAME)</string>
+ <key>CFBundlePackageType</key>
+ <string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0.0</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleURLTypes</key>
+ <array>
+ <dict>
+ <key>CFBundleURLSchemes</key>
+ <array>
+ <string>aliasvault</string>
+ <string>net.aliasvault.app</string>
+ </array>
+ </dict>
+ <dict>
+ <key>CFBundleURLSchemes</key>
+ <array>
+ <string>exp+aliasvault</string>
+ </array>
+ </dict>
+ </array>
+ <key>CFBundleVersion</key>
+ <string>1</string>
+ <key>LSMinimumSystemVersion</key>
+ <string>12.0</string>
+ <key>LSRequiresIPhoneOS</key>
+ <true/>
+ <key>NSAppTransportSecurity</key>
+ <dict>
+ <key>NSAllowsArbitraryLoads</key>
+ <false/>
+ <key>NSAllowsLocalNetworking</key>
+ <true/>
+ </dict>
+ <key>NSUserActivityTypes</key>
+ <array>
+ <string>$(PRODUCT_BUNDLE_IDENTIFIER).expo.index_route</string>
+ </array>
+ <key>UILaunchStoryboardName</key>
+ <string>SplashScreen</string>
+ <key>UIRequiredDeviceCapabilities</key>
+ <array>
+ <string>arm64</string>
+ </array>
+ <key>UIRequiresFullScreen</key>
+ <false/>
+ <key>UIStatusBarStyle</key>
+ <string>UIStatusBarStyleDefault</string>
+ <key>UISupportedInterfaceOrientations</key>
+ <array>
+ <string>UIInterfaceOrientationPortrait</string>
+ <string>UIInterfaceOrientationPortraitUpsideDown</string>
+ </array>
+ <key>UISupportedInterfaceOrientations~ipad</key>
+ <array>
+ <string>UIInterfaceOrientationPortrait</string>
+ <string>UIInterfaceOrientationPortraitUpsideDown</string>
+ <string>UIInterfaceOrientationLandscapeLeft</string>
+ <string>UIInterfaceOrientationLandscapeRight</string>
+ </array>
+ <key>UIUserInterfaceStyle</key>
+ <string>Automatic</string>
+ <key>UIViewControllerBasedStatusBarAppearance</key>
+ <false/>
+ <key>NSFaceIDUsageDescription</key>
+ <string>AliasVault uses Face ID to store and retrieve your credentials securely on your device.</string>
+</dict>
+</plist>
diff --git a/mobile-app/ios/aliasvault/SharedCredentialStore.swift b/mobile-app/ios/aliasvault/SharedCredentialStore.swift
deleted file mode 100644
index c3e842e2c..000000000
--- a/mobile-app/ios/aliasvault/SharedCredentialStore.swift
+++ /dev/null
@@ -1,45 +0,0 @@
-import Foundation
-
-public struct Credential: Codable {
- public let username: String
- public let password: String
- public let service: String
-
- public init(username: String, password: String, service: String) {
- self.username = username
- self.password = password
- self.service = service
- }
-}
-
-public class SharedCredentialStore {
- public static let shared = SharedCredentialStore()
- private let userDefaults: UserDefaults
- private let credentialsKey = "storedCredentials"
-
- private init() {
- // Use the app group identifier
- userDefaults = UserDefaults(suiteName: "group.net.aliasvault.autofill")!
- }
-
- public func getAllCredentials() -> [Credential] {
- guard let data = userDefaults.data(forKey: credentialsKey) else { return [] }
- return (try? JSONDecoder().decode([Credential].self, from: data)) ?? []
- }
-
- public func addCredential(_ credential: Credential) {
- var credentials = getAllCredentials()
- credentials.append(credential)
- saveCredentials(credentials)
- }
-
- public func clearAllCredentials() {
- userDefaults.removeObject(forKey: credentialsKey)
- }
-
- private func saveCredentials(_ credentials: [Credential]) {
- if let data = try? JSONEncoder().encode(credentials) {
- userDefaults.set(data, forKey: credentialsKey)
- }
- }
-}
\ No newline at end of file