Skip to content

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

Update passkey AddEdit delete flow (#1404)

Leendert de Borstf70c59da1261
diff --git a/apps/mobile-app/app/(tabs)/items/add-edit.tsx b/apps/mobile-app/app/(tabs)/items/add-edit.tsx
index 3bac7f253..0398215ee 100644
--- a/apps/mobile-app/app/(tabs)/items/add-edit.tsx
+++ b/apps/mobile-app/app/(tabs)/items/add-edit.tsx
@@ -82,6 +82,7 @@ export default function AddEditItemScreen(): React.ReactNode {
const [originalAttachmentIds, setOriginalAttachmentIds] = useState<string[]>([]);
const [totpCodes, setTotpCodes] = useState<TotpCode[]>([]);
const [originalTotpCodeIds, setOriginalTotpCodeIds] = useState<string[]>([]);
+ const [passkeyIds, setPasskeyIds] = useState<string[]>([]);
const [passkeyIdsMarkedForDeletion, setPasskeyIdsMarkedForDeletion] = useState<string[]>([]);
const [hasUnsavedChanges, setHasUnsavedChanges] = useState(false);
@@ -461,6 +462,10 @@ export default function AddEditItemScreen(): React.ReactNode {
if (itemTotpCodes.length > 0) {
setShow2FA(true);
}
+
+ // Load passkeys for this item
+ const itemPasskeys = await dbContext.sqliteClient!.passkeys.getByItemId(id);
+ setPasskeyIds(itemPasskeys.map(pk => pk.Id));
}
} catch (err) {
console.error('Error loading item:', err);
@@ -1304,7 +1309,7 @@ export default function AddEditItemScreen(): React.ReactNode {
{t('passkeys.passkey')}
</ThemedText>
<RobustPressable
- onPress={() => setPasskeyIdsMarkedForDeletion(['passkey'])}
+ onPress={() => setPasskeyIdsMarkedForDeletion(passkeyIds)}
style={{
padding: 6,
borderRadius: 4,
diff --git a/apps/mobile-app/ios/AliasVault.xcodeproj/project.pbxproj b/apps/mobile-app/ios/AliasVault.xcodeproj/project.pbxproj
index a3165edba..5d4eeb343 100644
--- a/apps/mobile-app/ios/AliasVault.xcodeproj/project.pbxproj
+++ b/apps/mobile-app/ios/AliasVault.xcodeproj/project.pbxproj
@@ -1117,8 +1117,6 @@
"${PODS_CONFIGURATION_BUILD_DIR}/React-Core/React-Core_privacy.bundle",
"${PODS_CONFIGURATION_BUILD_DIR}/React-cxxreact/React-cxxreact_privacy.bundle",
"${PODS_CONFIGURATION_BUILD_DIR}/boost/boost_privacy.bundle",
- "${PODS_CONFIGURATION_BUILD_DIR}/expo-dev-launcher/EXDevLauncher.bundle",
- "${PODS_CONFIGURATION_BUILD_DIR}/expo-dev-menu/EXDevMenu.bundle",
"${PODS_CONFIGURATION_BUILD_DIR}/glog/glog_privacy.bundle",
);
name = "[CP] Copy Pods Resources";
@@ -1133,8 +1131,6 @@
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/React-Core_privacy.bundle",
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/React-cxxreact_privacy.bundle",
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/boost_privacy.bundle",
- "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/EXDevLauncher.bundle",
- "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/EXDevMenu.bundle",
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/glog_privacy.bundle",
);
runOnlyForDeploymentPostprocessing = 0;
diff --git a/apps/mobile-app/utils/db/repositories/PasskeyRepository.ts b/apps/mobile-app/utils/db/repositories/PasskeyRepository.ts
index ada9e669f..69267fc97 100644
--- a/apps/mobile-app/utils/db/repositories/PasskeyRepository.ts
+++ b/apps/mobile-app/utils/db/repositories/PasskeyRepository.ts
@@ -23,7 +23,7 @@ const PasskeyQueries = {
p.Id,
p.ItemId,
p.RpId,
- p.UserId,
+ p.UserHandle,
p.PublicKey,
p.PrivateKey,
p.DisplayName,
@@ -49,7 +49,7 @@ const PasskeyQueries = {
p.Id,
p.ItemId,
p.RpId,
- p.UserId,
+ p.UserHandle,
p.PublicKey,
p.PrivateKey,
p.DisplayName,
@@ -65,6 +65,32 @@ const PasskeyQueries = {
LEFT JOIN FieldValues fv ON fv.ItemId = i.Id AND fv.FieldKey = 'login.username' AND fv.IsDeleted = 0
WHERE p.Id = ? AND p.IsDeleted = 0`,
+ /**
+ * Get all passkeys for a specific item.
+ * Joins with Items and FieldValues to get item name and username.
+ */
+ GET_BY_ITEM_ID: `
+ SELECT
+ p.Id,
+ p.ItemId,
+ p.RpId,
+ p.UserHandle,
+ p.PublicKey,
+ p.PrivateKey,
+ p.DisplayName,
+ p.PrfKey,
+ p.AdditionalData,
+ p.CreatedAt,
+ p.UpdatedAt,
+ p.IsDeleted,
+ i.Name as ItemName,
+ fv.Value as Username
+ FROM Passkeys p
+ LEFT JOIN Items i ON p.ItemId = i.Id
+ LEFT JOIN FieldValues fv ON fv.ItemId = i.Id AND fv.FieldKey = 'login.username' AND fv.IsDeleted = 0
+ WHERE p.ItemId = ? AND p.IsDeleted = 0
+ ORDER BY p.CreatedAt DESC`,
+
/**
* Insert a new passkey.
*/
@@ -126,6 +152,18 @@ export class PasskeyRepository extends BaseRepository {
return this.mapRow(results[0] as any);
}
+ /**
+ * Get all passkeys for a specific item.
+ * @param itemId - The item ID
+ * @returns Array of passkey objects with item info
+ */
+ public async getByItemId(itemId: string): Promise<PasskeyWithItemInfo[]> {
+ const results = await this.client.executeQuery(PasskeyQueries.GET_BY_ITEM_ID, [itemId]);
+
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ return results.map((row: any) => this.mapRow(row));
+ }
+
/**
* Create a new passkey linked to an item.
* @param passkey - The passkey object to create (without timestamps and IsDeleted)