Skip to content
Snippets Groups Projects
Commit f9cf29e6 authored by Nicolas80's avatar Nicolas80
Browse files

Code review:

* Small comment cleanup
* Code cleanup removed unnecessary empty cells in "g1v1" row
* Added doc on prompt_secret_substrate_and_compute_keypair method to explain the values returned in the tuple.
parent f9beaf54
No related branches found
No related tags found
1 merge request!44feat: Can choose between ed25519 ans sr25519
Pipeline #40232 passed
......@@ -26,7 +26,7 @@ pub fn compute_vault_key_files_table(vault_key_addresses: &[String]) -> Result<T
pub fn compute_vault_accounts_table(
account_tree_nodes: &[Rc<RefCell<AccountTreeNode>>],
) -> Result<Table, GcliError> {
// Appel to the new function with show_g1v1 = true to maintain compatibility
// Calling the new function with show_g1v1 = true to maintain compatibility
compute_vault_accounts_table_with_g1v1(account_tree_nodes, true)
}
......@@ -114,19 +114,12 @@ pub fn compute_vault_accounts_row_with_g1v1(
// Add a second line for the G1v1 public key only if show_g1v1 is true and it's an Ed25519 key
let is_ed25519 = crypto_scheme == CryptoScheme::Ed25519;
if show_g1v1 && is_ed25519 {
let mut g1v1_row = vec![Cell::new(format!(
rows.push(vec![Cell::new(format!(
"└ G1v1: {}",
cesium::compute_g1v1_public_key_from_ed25519_account_id(
&account_tree_node.account.address.0
)
))];
// Add empty cells to align with the main line
g1v1_row.push(Cell::new(""));
g1v1_row.push(Cell::new(""));
g1v1_row.push(Cell::new(""));
rows.push(g1v1_row);
))]);
}
(
......
......@@ -262,6 +262,18 @@ pub fn seed_from_cesium(id: &str, pwd: &str) -> [u8; 32] {
seed
}
/// This method will prompt for the (secret) substrate uri, compute the keypair, and return a tuple containing the (secret) substrate uri and the keypair.
///
/// # Arguments
///
/// * `crypto_scheme` - The cryptographic scheme to use (either Sr25519 or Ed25519).
///
/// # Returns
///
/// A tuple containing:
///
/// * `String` - The (secret) substrate URI provided by the user.
/// * `KeyPair` - The computed keypair based on the provided substrate URI and cryptographic scheme.
pub fn prompt_secret_substrate_and_compute_keypair(
crypto_scheme: CryptoScheme,
) -> (String, KeyPair) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment