Skip to content
Snippets Groups Projects

update to runtime 800

Merged Hugo Trentesaux requested to merge hugo-dev into master
2 unresolved threads
1 file
+ 16
8
Compare changes
  • Side-by-side
  • Inline
+ 16
8
@@ -8,9 +8,9 @@ pub enum Subcommand {
#[default]
#[clap(hide = true)]
Nothing,
/// Generate key pair with old style unsafe scrypt
Pubkey { id: String, pass: String },
/// Prompt
/// Analyse a base58 pubkey and gives it in all its form
Pubkey { pubkey: String },
/// Prompt for cesium input
Prompt,
}
@@ -18,11 +18,19 @@ pub enum Subcommand {
pub async fn handle_command(_data: Data, command: Subcommand) -> Result<(), GcliError> {
match command {
Subcommand::Nothing => {}
Subcommand::Pubkey { id, pass } => {
let keypair = pair_from_cesium(id, pass);
println!("Pubkey: {}", bs58::encode(keypair.pkey).into_string());
let address: AccountId = keypair.pkey.into();
println!("Address: {}", address.to_string());
Subcommand::Pubkey { pubkey } => {
let raw_pubkey = bs58::decode(pubkey).into_vec().unwrap();
let raw_pubkey: [u8; 32] = if raw_pubkey.len() > 32 {
return Err(GcliError::Input("invalid pubkey size".to_string()));
} else {
[vec![0; 32 - raw_pubkey.len()], raw_pubkey]
.concat()
.try_into()
.unwrap()
};
println!("Pubkey (hex): 0x{}", hex::encode(raw_pubkey));
let address: AccountId = sp_core::ed25519::Public(raw_pubkey).into();
println!("Address (SS58): {}", address.to_string());
}
Subcommand::Prompt => {
let keypair = prompt_secret_cesium();
Loading