Merge #1403: Disable edit of defined key in multisig template recovery path
59c73001a4c9eaa835f2a9345d995f263653ab48 Disable edit of defined key in multisig template recovery path (edouardparis)
Pull request description:
The primary keys shouldn't be editable from the recovery path in the Multisig Savings template but only from the primary path. It could bring to weird behaviors and corner cases.
ACKs for top commit:
jp1ac4:
Tested ACK 59c73001a4c9eaa835f2a9345d995f263653ab48.
Tree-SHA512: 0fa72bfeac7a32fc188f041c395f46ce2e3de72d7f750343641bff68b92d885d3510f3cd4600cc09856a5192a493fe7b3afca70a7ca78c0aeeb9ee0f3411fda5
This commit is contained in:
commit
cbc46e9e26
@ -128,6 +128,39 @@ pub fn path(
|
||||
.into()
|
||||
}
|
||||
|
||||
pub fn uneditable_defined_key<'a>(
|
||||
alias: &'a str,
|
||||
color: iced::Color,
|
||||
title: impl Into<Cow<'a, str>>,
|
||||
warning: Option<&'static str>,
|
||||
) -> Element<'a, message::DefineKey> {
|
||||
card::simple(
|
||||
Row::new()
|
||||
.spacing(10)
|
||||
.width(Length::Fill)
|
||||
.align_items(Alignment::Center)
|
||||
.push(icon::round_key_icon().size(H3_SIZE).style(color))
|
||||
.push(
|
||||
Column::new()
|
||||
.width(Length::Fill)
|
||||
.spacing(5)
|
||||
.push(
|
||||
Row::new()
|
||||
.spacing(10)
|
||||
.push(p1_regular(title).style(color::GREY_2))
|
||||
.push(p1_bold(alias)),
|
||||
)
|
||||
.push_maybe(warning.map(|w| p2_regular(w).style(color::RED))),
|
||||
)
|
||||
.push_maybe(if warning.is_none() {
|
||||
Some(icon::check_icon().style(color::GREEN))
|
||||
} else {
|
||||
None
|
||||
}),
|
||||
)
|
||||
.into()
|
||||
}
|
||||
|
||||
pub fn defined_key<'a>(
|
||||
alias: &'a str,
|
||||
color: iced::Color,
|
||||
|
||||
@ -15,7 +15,10 @@ use crate::installer::{
|
||||
message::{self, Message},
|
||||
step::descriptor::editor::key::Key,
|
||||
view::{
|
||||
editor::{define_descriptor_advanced_settings, defined_key, path, undefined_key},
|
||||
editor::{
|
||||
define_descriptor_advanced_settings, defined_key, path, undefined_key,
|
||||
uneditable_defined_key,
|
||||
},
|
||||
layout,
|
||||
},
|
||||
};
|
||||
@ -168,21 +171,30 @@ pub fn multisig_security_template<'a>(
|
||||
.enumerate()
|
||||
.map(|(j, recovery_key)| {
|
||||
if let Some(key) = recovery_key {
|
||||
defined_key(
|
||||
&key.name,
|
||||
if j < 2 { color::GREEN } else { color::ORANGE },
|
||||
if j < 2 {
|
||||
format!("Primary key #{}", j + 1)
|
||||
} else {
|
||||
"Recovery key".to_string()
|
||||
},
|
||||
if use_taproot && !key.is_compatible_taproot {
|
||||
Some("Key is not compatible with Taproot")
|
||||
} else {
|
||||
None
|
||||
},
|
||||
true,
|
||||
)
|
||||
if j < 2 {
|
||||
uneditable_defined_key(
|
||||
&key.name,
|
||||
color::GREEN,
|
||||
format!("Primary key #{}", j + 1),
|
||||
if use_taproot && !key.is_compatible_taproot {
|
||||
Some("Key is not compatible with Taproot")
|
||||
} else {
|
||||
None
|
||||
},
|
||||
)
|
||||
} else {
|
||||
defined_key(
|
||||
&key.name,
|
||||
color::ORANGE,
|
||||
"Recovery key".to_string(),
|
||||
if use_taproot && !key.is_compatible_taproot {
|
||||
Some("Key is not compatible with Taproot")
|
||||
} else {
|
||||
None
|
||||
},
|
||||
true,
|
||||
)
|
||||
}
|
||||
} else {
|
||||
undefined_key(
|
||||
if j < 2 { color::GREEN } else { color::ORANGE },
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user