Implement onboarding reset functionality and enhance backup features
- Added a new method to reset the onboarding state, allowing users to re-initiate the onboarding process. - Integrated backup creation functionality, enabling users to create encrypted backups of their node identity. - Updated API endpoints to handle onboarding reset and backup creation requests. - Enhanced UI components to support the new onboarding reset and backup features, including error handling and user feedback. - Introduced new dependencies for cryptographic operations and data encoding.
This commit is contained in:
@@ -86,6 +86,24 @@ impl AuthManager {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Reset onboarding state so the user can go through onboarding again (dev/testing).
|
||||
pub async fn reset_onboarding(&self) -> Result<()> {
|
||||
let onboarding_file = self.data_dir.join("onboarding.json");
|
||||
let state = OnboardingState { complete: false };
|
||||
fs::write(
|
||||
&onboarding_file,
|
||||
serde_json::to_string_pretty(&state)?,
|
||||
)
|
||||
.await?;
|
||||
if let Some(mut user) = self.get_user().await? {
|
||||
user.onboarding_complete = false;
|
||||
let user_file = self.data_dir.join("user.json");
|
||||
let content = serde_json::to_string_pretty(&user)?;
|
||||
fs::write(&user_file, content).await?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn is_onboarding_complete(&self) -> Result<bool> {
|
||||
// Check onboarding.json first (persisted before user setup)
|
||||
let onboarding_file = self.data_dir.join("onboarding.json");
|
||||
|
||||
Reference in New Issue
Block a user