feat: add comprehensive backup functionality for vault operations#5
Merged
feat: add comprehensive backup functionality for vault operations#5
Conversation
Summary of Changes:
- Added backup prompts when saving/modifying vault files (default: Yes)
- Added backup prompt for GPG encryption (default: Yes)
- ASCII armor prompt now defaults to Yes
- Improved backup file naming to preserve extensions
- Added overwrite protection for existing files
Detailed Changes:
1. Vault Backup System (service.rs):
- Added create_backup() method that creates timestamped backups
- Integrated backup prompt in save_vault() with Y default
- Backup format: vault.toml.backup.{timestamp}
2. GPG Improvements (gpg.rs):
- Updated encrypt_vault() to handle .toml.gpg/.toml.asc extensions
- Added overwrite prompts for existing GPG files
- Improved backup_vault() to create .gpg.backup format for GPG files
- Fixed extension handling in decrypt_vault()
3. User Prompts (utils.rs):
- Added prompt_yes_no() utility for consistent Y/n prompting
- Used throughout for backup and overwrite confirmations
4. CLI Updates (cli.rs):
- Updated gpg_encrypt to use prompt_yes_no with Y default
- Removed redundant backup code (now handled by GPG module)
5. Interactive Mode (interactive.rs):
- Changed ASCII armor prompt to Y default
- Changed backup prompt to Y default
- Used prompt_yes_no for consistency
File Naming Conventions:
- Regular backups: vault.toml.backup.20250721_152607
- GPG backups: vault.toml.gpg.backup.20250721_152607
- GPG encrypted: vault.toml.gpg (binary) or vault.toml.asc (ASCII)
All changes maintain backward compatibility while improving user safety
through better backup defaults and overwrite protection.
0e53a4b to
f68efee
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of Changes:
Detailed Changes:
Vault Backup System (service.rs):
GPG Improvements (gpg.rs):
User Prompts (utils.rs):
CLI Updates (cli.rs):
Interactive Mode (interactive.rs):
File Naming Conventions:
All changes maintain backward compatibility while improving user safety through better backup defaults and overwrite protection.