Skip to content

feat(import-export): support user-created strategy backup and restore#48

Merged
dhruvanbhalara merged 2 commits into
mainfrom
feat/47-strategy-backup
Jun 17, 2026
Merged

feat(import-export): support user-created strategy backup and restore#48
dhruvanbhalara merged 2 commits into
mainfrom
feat/47-strategy-backup

Conversation

@dhruvanbhalara

@dhruvanbhalara dhruvanbhalara commented Jun 13, 2026

Copy link
Copy Markdown
Owner

Description

This PR implements support for exporting and importing user-created password generation strategies under a unified vault backup format. Custom strategies are now packaged alongside credentials in JSON and encrypted .pvault formats, and correctly resolved/restored during vault restoration.

Key changes:

  • Refactored DataService to format JSON and encrypted backups into a unified map format: { "passwords": [...], "strategies": [...] }.
  • Integrated backward compatibility to auto-detect and parse legacy password-only files.
  • Refactored ImportExportBloc and ImportExportPathResolver to handle backup generation and restore for custom strategies, incorporating a conflict resolution strategy (skips default strategies, overwrites matching IDs, and resolves name collisions).
  • Added a dynamic warning banner in the ExportVaultScreen when the CSV format option is selected since strategies cannot be represented in tabular CSV format.
  • Dispatched LoadSettings() to SettingsBloc upon successful import or duplicate resolution to update the in-memory strategy configuration.

Related Issues

Closes #47

Type of Change

  • ✨ New feature (non-breaking change which adds functionality)
  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • 🎨 UI/UX refinement

Checklist

  • I have followed the project's CONTRIBUTING.md guidelines.
  • My code follows the style guidelines of this project.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.
  • Any dependent changes have been merged and published in downstream modules.

Screenshots (if applicable)

N/A

Testing Instructions

  1. Navigate to Settings -> Password Generation Strategies, and create a custom strategy.
  2. Go to Settings -> Export Vault, enter a password, and export as Encrypted (.pvault).
  3. Confirm that when selecting CSV format, a warning banner is shown dynamically stating that CSV does not include strategies.
  4. Clear the database (or delete the custom strategy).
  5. Go to Settings -> Import Data, select the exported .pvault, enter the password, and resolve conflicts.
  6. Verify that the custom strategy is successfully imported and displayed in the Strategy Screen.

📊 Code Coverage Report

Metric Value
Total Lines 5287
Lines Hit 4285
Overall Coverage 81.05%

Generated by PassVault CI

@dhruvanbhalara dhruvanbhalara self-assigned this Jun 17, 2026
@dhruvanbhalara dhruvanbhalara added the enhancement New feature or request label Jun 17, 2026
@dhruvanbhalara dhruvanbhalara merged commit 8063d5d into main Jun 17, 2026
3 checks passed
@dhruvanbhalara dhruvanbhalara deleted the feat/47-strategy-backup branch June 17, 2026 05:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: Export/Import User-Created Password Generation Strategies

1 participant