encoding: updating all remaining usages of base64 to base58

This commit is contained in:
Dave Hrycyszyn
2020-01-27 12:10:18 +00:00
parent 1ab4e3efeb
commit a55b87809e
6 changed files with 10 additions and 10 deletions
+2 -2
View File
@@ -100,12 +100,12 @@ impl PemStorable for DummyMixIdentityPublicKey {
}
impl DummyMixIdentityPublicKey {
pub fn to_b64_string(&self) -> String {
pub fn to_base58_string(&self) -> String {
bs58::encode(&self.to_bytes()).into_string()
}
#[allow(dead_code)]
fn from_b64_string(val: String) -> Self {
fn from_base58_string(val: String) -> Self {
Self::from_bytes(&bs58::decode(&val).into_vec().unwrap())
}
}
+2 -2
View File
@@ -61,7 +61,7 @@ impl HealthCheckResult {
.mix_nodes()
.into_iter()
.filter(|node| {
match self.node_score(NodeAddressBytes::from_b64_string(node.pub_key.clone())) {
match self.node_score(NodeAddressBytes::from_base58_string(node.pub_key.clone())) {
None => {
error!("Unknown node in topology - {:?}", node);
false
@@ -75,7 +75,7 @@ impl HealthCheckResult {
.providers()
.into_iter()
.filter(|node| {
match self.node_score(NodeAddressBytes::from_b64_string(node.pub_key.clone())) {
match self.node_score(NodeAddressBytes::from_base58_string(node.pub_key.clone())) {
None => {
error!("Unknown node in topology - {:?}", node);
false
+3 -3
View File
@@ -95,7 +95,7 @@ impl NodeScore {
pub(crate) fn from_mixnode(node: mix::Node) -> Self {
NodeScore {
typ: NodeType::Mix,
pub_key: NodeAddressBytes::from_b64_string(node.pub_key),
pub_key: NodeAddressBytes::from_base58_string(node.pub_key),
addresses: vec![node.host],
version: node.version,
layer: format!("layer {}", node.layer),
@@ -107,7 +107,7 @@ impl NodeScore {
pub(crate) fn from_provider(node: provider::Node) -> Self {
NodeScore {
typ: NodeType::MixProvider,
pub_key: NodeAddressBytes::from_b64_string(node.pub_key),
pub_key: NodeAddressBytes::from_base58_string(node.pub_key),
addresses: vec![node.mixnet_listener, node.client_listener],
version: node.version,
layer: format!("provider"),
@@ -149,7 +149,7 @@ impl std::fmt::Display for NodeScore {
return Err(std::fmt::Error);
}
};
let stringified_key = self.pub_key.to_b64_string();
let stringified_key = self.pub_key.to_base58_string();
write!(
f,
"({})\t{}/{}\t({}%)\t|| {}\tv{} <{}> - {}",
+1 -1
View File
@@ -32,7 +32,7 @@ pub fn execute(matches: &ArgMatches) {
.unwrap();
// TODO: reading auth_token from disk (if exists);
println!("Public key: {}", keypair.public_key.to_b64_string());
println!("Public key: {}", keypair.public_key.to_base58_string());
let mut temporary_address = [0u8; 32];
let public_key_bytes = keypair.public_key().to_bytes();
+1 -1
View File
@@ -33,7 +33,7 @@ pub fn execute(matches: &ArgMatches) {
// TODO: reading auth_token from disk (if exists);
println!("Public key: {}", keypair.public_key.to_b64_string());
println!("Public key: {}", keypair.public_key.to_base58_string());
let mut temporary_address = [0u8; 32];
let public_key_bytes = keypair.public_key().to_bytes();
+1 -1
View File
@@ -34,7 +34,7 @@ impl Notifier {
net_client,
client_listener: client_listener.to_string(),
mixnet_listener: mixnet_listener.to_string(),
pub_key: pub_key.to_b64_string(),
pub_key: pub_key.to_base58_string(),
client_ledger,
}
}