-
Notifications
You must be signed in to change notification settings - Fork 13
fix: masternode key-protection dialog, nav reset-to-list, and network-switch passphrase wiring #913
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
05d47f4
79926f2
cb60820
8f12b7b
1102bdf
a7256a9
3ad70ed
d557b6b
a03c545
f223237
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -790,6 +790,31 @@ impl KeyInfoScreen { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// Build a key-info screen with the add-protection confirmation already open | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// when vault-backed protection is available, or show a warning when wallet | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// setup has not made protection available yet. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| pub fn new_with_protection_prompt( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| identity: QualifiedIdentity, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| key: IdentityPublicKey, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private_key_data: Option<(PrivateKeyData, Option<WalletDerivationPath>)>, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| app_context: &Arc<AppContext>, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) -> Self { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| let mut screen = Self::new(identity, key, private_key_data, app_context); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| let status = screen.compute_protection_status(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if status == IdentityProtectionStatus::NoVaultKeys { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| screen.protection_stage = ProtectionStage::Idle; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| MessageBanner::set_global( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| app_context.egui_ctx(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "Password protection is not available yet. Wait for wallet setup to finish, then try again.", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| MessageType::Warning, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| screen.protection_status = Some(status); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| screen.open_add_confirm(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| screen | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+802
to
+815
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Suggestion: Revalidation still opens the add flow for already-protected keys
Suggested change
source: ['codex'] There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Still valid at 🤖 Claudius the Magnificent |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fn validate_and_store_private_key(&mut self) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Convert the input string to bytes (hex decoding) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| let private_key_bytes = match hex::decode(self.private_key_input.text()) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -1099,6 +1124,8 @@ impl KeyInfoScreen { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| egui::CollapsingHeader::new("Key Protection") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .default_open(false) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Keep the header open so an active protection form or dialog remains visible. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .open((self.protection_stage != ProtectionStage::Idle).then_some(true)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .show(ui, |ui| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| let status_text = match status { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| IdentityProtectionStatus::Unprotected => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -236,6 +236,11 @@ pub enum DetailOutcome { | |
| Forward(Box<AppAction>), | ||
| } | ||
|
|
||
| enum KeyInfoOpenMode { | ||
| Normal, | ||
| WithProtectionPrompt, | ||
| } | ||
|
|
||
| /// Masternode/evonode detail view state. | ||
| pub struct MasternodeDetailView { | ||
| app_context: Arc<AppContext>, | ||
|
|
@@ -659,7 +664,7 @@ impl MasternodeDetailView { | |
| && let Some((target, key)) = self.first_protectable_key() | ||
| && ui.button("Add password protection…").clicked() | ||
| { | ||
| action = Some(self.open_key_info(target, &key)); | ||
| action = Some(self.open_key_info_with_protection_prompt(target, &key)); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 MEDIUM — this new routing makes the headline feature a silent no-op for multi-key masternodes This line newly routes the "Add password protection…" CTA into
It's reachable, not hypothetical: The existing Fix: filter 🤖 Claudius the Magnificent — grumpy review, MEDIUM (CODE-001) |
||
| } | ||
| action | ||
| } | ||
|
|
@@ -701,17 +706,40 @@ impl MasternodeDetailView { | |
| &self, | ||
| target: PrivateKeyTarget, | ||
| key: &dash_sdk::platform::IdentityPublicKey, | ||
| ) -> AppAction { | ||
| self.open_key_info_with_mode(target, key, KeyInfoOpenMode::Normal) | ||
| } | ||
|
|
||
| /// Open `KeyInfoScreen` directly in the add-protection confirmation flow. | ||
| fn open_key_info_with_protection_prompt( | ||
| &self, | ||
| target: PrivateKeyTarget, | ||
| key: &dash_sdk::platform::IdentityPublicKey, | ||
| ) -> AppAction { | ||
| self.open_key_info_with_mode(target, key, KeyInfoOpenMode::WithProtectionPrompt) | ||
| } | ||
|
|
||
| fn open_key_info_with_mode( | ||
| &self, | ||
| target: PrivateKeyTarget, | ||
| key: &dash_sdk::platform::IdentityPublicKey, | ||
| mode: KeyInfoOpenMode, | ||
| ) -> AppAction { | ||
| let holding = self | ||
| .identity | ||
| .private_keys | ||
| .get_cloned_private_key_data_and_wallet_info(&(target, key.id())); | ||
| AppAction::AddScreen(Screen::KeyInfoScreen(KeyInfoScreen::new( | ||
| self.identity.clone(), | ||
| key.clone(), | ||
| holding, | ||
| &self.app_context, | ||
| ))) | ||
| let identity = self.identity.clone(); | ||
| let key = key.clone(); | ||
| let screen = match mode { | ||
| KeyInfoOpenMode::Normal => { | ||
| KeyInfoScreen::new(identity, key, holding, &self.app_context) | ||
| } | ||
| KeyInfoOpenMode::WithProtectionPrompt => { | ||
| KeyInfoScreen::new_with_protection_prompt(identity, key, holding, &self.app_context) | ||
| } | ||
| }; | ||
| AppAction::AddScreen(Screen::KeyInfoScreen(screen)) | ||
| } | ||
|
|
||
| /// Render the collapsible DPNS voting section (collapsed by default, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.