Skip to content

Commit

Permalink
Impl Display for KeyName
Browse files Browse the repository at this point in the history
this change was made so that we can concat the KeyName with secure story
prefix and service
  • Loading branch information
elizabethengelman committed Dec 3, 2024
1 parent e2b7342 commit dabbb27
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
4 changes: 2 additions & 2 deletions cmd/soroban-cli/src/commands/keys/generate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,10 @@ impl Cmd {
} else if self.secure_store {
// secure_store:org.stellar.cli:<key name>
let entry_name_with_prefix = format!(
"{}{}-{:?}",
"{}{}-{}",
keyring::SECURE_STORE_ENTRY_PREFIX,
keyring::SECURE_STORE_ENTRY_SERVICE,
self.name.to_string()
self.name
);

//checking that the entry name is valid before writing to the secure store
Expand Down
11 changes: 10 additions & 1 deletion cmd/soroban-cli/src/config/address.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
use std::str::FromStr;
use std::{
fmt::{self, Display, Formatter},
str::FromStr,
};

use crate::xdr;

Expand Down Expand Up @@ -87,6 +90,12 @@ impl std::str::FromStr for KeyName {
}
}

impl Display for KeyName {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
write!(f, "{}", self.0)
}
}

fn allowed_char(c: char) -> bool {
c.is_ascii_alphanumeric() || c == '_' || c == '-'
}

0 comments on commit dabbb27

Please sign in to comment.