commit ed4a25edcac070f7a57d0c2bd6bfc26195b6f6aa
parent eb6bbb08883400f359b5dd6917f84c4209ff212b
Author: Antoine A <>
Date: Wed, 25 Mar 2026 18:48:00 +0100
common: improve Base32 debug fmt
Diffstat:
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/common/taler-common/src/api_common.rs b/common/taler-common/src/api_common.rs
@@ -123,7 +123,7 @@ pub type EddsaSignature = Base32<64>;
/// EdDSA and ECDHE public keys always point on Curve25519
/// and represented using the standard 256 bits Ed25519 compact format,
/// converted to Crockford Base32.
-#[derive(Debug, Clone, PartialEq, Eq)]
+#[derive(Clone, PartialEq, Eq)]
pub struct EddsaPublicKey(Base32<32>);
impl Deref for EddsaPublicKey {
@@ -159,6 +159,12 @@ impl Display for EddsaPublicKey {
}
}
+impl std::fmt::Debug for EddsaPublicKey {
+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ Display::fmt(&self.0, f)
+ }
+}
+
#[derive(Debug, thiserror::Error)]
pub enum EddsaPublicKeyError {
#[error(transparent)]
diff --git a/common/taler-common/src/types/base32.rs b/common/taler-common/src/types/base32.rs
@@ -183,7 +183,7 @@ fn decode_batch(encoded: &[u8], decoded: &mut [u8]) -> bool {
!invalid
}
-#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord)]
+#[derive(Clone, PartialEq, Eq, PartialOrd, Ord)]
pub struct Base32<const L: usize>([u8; L]);
impl<const L: usize> Base32<L> {
@@ -221,6 +221,12 @@ impl<const L: usize> Display for Base32<L> {
}
}
+impl<const L: usize> std::fmt::Debug for Base32<L> {
+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ Display::fmt(&self, f)
+ }
+}
+
impl<const L: usize> Serialize for Base32<L> {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where