From 2114136e59597df164175192a35d7b3b1ccc485d Mon Sep 17 00:00:00 2001 From: Tyera Eulberg Date: Mon, 25 Jul 2022 20:09:41 -0700 Subject: [PATCH] Add Display implementations for various ConfidentialTransfer pod structs (#26783) --- zk-token-sdk/src/zk_token_elgamal/pod.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/zk-token-sdk/src/zk_token_elgamal/pod.rs b/zk-token-sdk/src/zk_token_elgamal/pod.rs index ab6e5d14e..cf1f87d65 100644 --- a/zk-token-sdk/src/zk_token_elgamal/pod.rs +++ b/zk-token-sdk/src/zk_token_elgamal/pod.rs @@ -43,6 +43,12 @@ impl fmt::Debug for ElGamalCiphertext { } } +impl fmt::Display for ElGamalCiphertext { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "{}", base64::encode(self.0)) + } +} + impl Default for ElGamalCiphertext { fn default() -> Self { Self::zeroed() @@ -59,6 +65,12 @@ impl fmt::Debug for ElGamalPubkey { } } +impl fmt::Display for ElGamalPubkey { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "{}", base64::encode(self.0)) + } +} + #[derive(Clone, Copy, Default, Pod, Zeroable, PartialEq, Eq)] #[repr(transparent)] pub struct PedersenCommitment(pub [u8; 32]); @@ -180,6 +192,12 @@ impl fmt::Debug for AeCiphertext { } } +impl fmt::Display for AeCiphertext { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "{}", base64::encode(self.0)) + } +} + impl Default for AeCiphertext { fn default() -> Self { Self::zeroed()