Skip to content

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

Cleanup (#2159)

Leendert de Borstcf8a90b6eef5
diff --git a/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/nativevaultmanager/NativeVaultManager.kt b/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/nativevaultmanager/NativeVaultManager.kt
index 116d7fcdc..4b3820960 100644
--- a/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/nativevaultmanager/NativeVaultManager.kt
+++ b/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/nativevaultmanager/NativeVaultManager.kt
@@ -25,7 +25,6 @@ import kotlinx.coroutines.withContext
import net.aliasvault.app.qrscanner.QRScannerActivity
import net.aliasvault.app.vaultstore.AppError
import net.aliasvault.app.vaultstore.VaultStore
-import net.aliasvault.app.vaultstore.interfaces.CryptoOperationCallback
import net.aliasvault.app.vaultstore.keystoreprovider.AndroidKeystoreProvider
import net.aliasvault.app.vaultstore.storageprovider.AndroidStorageProvider
import net.aliasvault.app.webapi.WebApiService
@@ -2065,29 +2064,5 @@ class NativeVaultManager(reactContext: ReactApplicationContext) :
}
}
- /**
- * The vault encryption key as base64, for the app to open the vault after a biometric or PIN unlock.
- * @param promise Resolves with the key, rejects with the native error code when the store holds none.
- */
- @ReactMethod
- override fun getEncryptionKey(promise: Promise) {
- vaultStore.getEncryptionKey(
- object : CryptoOperationCallback {
- override fun onSuccess(result: String) {
- promise.resolve(result)
- }
-
- override fun onError(e: Exception) {
- Log.e(TAG, "Error getting encryption key", e)
- if (e is AppError) {
- promise.reject(e.code, e.message, e)
- } else {
- promise.reject("E-001", "Failed to get encryption key: ${e.message}", e)
- }
- }
- },
- )
- }
-
// endregion
}
diff --git a/apps/mobile-app/app/unlock.tsx b/apps/mobile-app/app/unlock.tsx
index 537d3eaa8..a7f881af4 100644
--- a/apps/mobile-app/app/unlock.tsx
+++ b/apps/mobile-app/app/unlock.tsx
@@ -293,7 +293,7 @@ export default function UnlockScreen() : React.ReactNode {
try {
/*
* Clear any wrong key from memory first (e.g., from failed password attempt).
- * This forces getEncryptionKey() to fetch from keychain via biometrics.
+ * This forces the native unlock to fetch the key from the keychain via biometrics.
*/
await NativeVaultManager.clearEncryptionKeyFromMemory();
diff --git a/apps/mobile-app/ios/NativeVaultManager/RCTNativeVaultManager.mm b/apps/mobile-app/ios/NativeVaultManager/RCTNativeVaultManager.mm
index ca0f97398..b2ffdc4b8 100644
--- a/apps/mobile-app/ios/NativeVaultManager/RCTNativeVaultManager.mm
+++ b/apps/mobile-app/ios/NativeVaultManager/RCTNativeVaultManager.mm
@@ -391,8 +391,4 @@
[vaultManager storeEncryptedDatabase:base64EncryptedDb resolver:resolve rejecter:reject];
}
-- (void)getEncryptionKey:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject {
- [vaultManager getEncryptionKey:resolve rejecter:reject];
-}
-
@end
diff --git a/apps/mobile-app/ios/NativeVaultManager/VaultManager.swift b/apps/mobile-app/ios/NativeVaultManager/VaultManager.swift
index 2d8a93904..47f688fd8 100644
--- a/apps/mobile-app/ios/NativeVaultManager/VaultManager.swift
+++ b/apps/mobile-app/ios/NativeVaultManager/VaultManager.swift
@@ -1477,19 +1477,6 @@ public class VaultManager: NSObject {
reject("DB_ERROR", "Failed to store encrypted database: \(error.localizedDescription)", error)
}
}
-
- /// The vault encryption key as base64, for the app to open the vault after a biometric or PIN unlock.
- @objc
- func getEncryptionKey(_ resolve: @escaping RCTPromiseResolveBlock,
- rejecter reject: @escaping RCTPromiseRejectBlock) {
- do {
- resolve(try vaultStore.getEncryptionKeyBase64())
- } catch let vaultError as AppError {
- reject(vaultError.code, vaultError.message, vaultError)
- } catch let error as NSError {
- reject("E-001", "Failed to get encryption key: \(error.localizedDescription)", error)
- }
- }
}
/// Routes `rustCall` invocations onto the Rust core Uniffi bindings.
diff --git a/apps/mobile-app/ios/VaultStoreKit/VaultStore+Crypto.swift b/apps/mobile-app/ios/VaultStoreKit/VaultStore+Crypto.swift
index e7d2144ca..67de28148 100644
--- a/apps/mobile-app/ios/VaultStoreKit/VaultStore+Crypto.swift
+++ b/apps/mobile-app/ios/VaultStoreKit/VaultStore+Crypto.swift
@@ -235,7 +235,7 @@ extension VaultStore {
#endif
}
- /// The vault encryption key as base64, for the React Native layer to open the vault after a biometric or PIN unlock.
+ /// The vault encryption key as base64, for the sync engine.
public func getEncryptionKeyBase64() throws -> String {
return try getEncryptionKey().base64EncodedString()
}
diff --git a/apps/mobile-app/specs/NativeVaultManager.ts b/apps/mobile-app/specs/NativeVaultManager.ts
index d59d0c4fa..ad2921231 100644
--- a/apps/mobile-app/specs/NativeVaultManager.ts
+++ b/apps/mobile-app/specs/NativeVaultManager.ts
@@ -29,10 +29,6 @@ export interface Spec extends TurboModule {
// result is JSON text. Swift/Kotlin hold one case per function and no logic; see platform/NativeRustCore.ts.
rustCall(name: string, argsJson: string): Promise<string>;
- // The vault encryption key as base64, for the app to decrypt the vault after a biometric or PIN unlock. Throws
- // when the native store holds no key (locked); may prompt for biometrics when the key lives in the keychain.
- getEncryptionKey(): Promise<string>;
-
// Store the encrypted vault blob for persistence and which is also accessed by the native autofill extensions.
storeEncryptedDatabase(base64EncryptedDb: string): Promise<void>;