diff --git a/zk-token-sdk/src/encryption/auth_encryption.rs b/zk-token-sdk/src/encryption/auth_encryption.rs index d48916d765..02c1478a4c 100644 --- a/zk-token-sdk/src/encryption/auth_encryption.rs +++ b/zk-token-sdk/src/encryption/auth_encryption.rs @@ -15,7 +15,7 @@ use { signature::Signature, signer::{Signer, SignerError}, }, - std::convert::TryInto, + std::{convert::TryInto, fmt}, zeroize::Zeroize, }; @@ -129,6 +129,12 @@ impl AeCiphertext { } } +impl fmt::Display for AeCiphertext { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "{}", base64::encode(self.to_bytes())) + } +} + #[cfg(test)] mod tests { use { diff --git a/zk-token-sdk/src/encryption/elgamal.rs b/zk-token-sdk/src/encryption/elgamal.rs index a4bbd55615..e49454c2a9 100644 --- a/zk-token-sdk/src/encryption/elgamal.rs +++ b/zk-token-sdk/src/encryption/elgamal.rs @@ -457,6 +457,12 @@ impl ElGamalCiphertext { } } +impl fmt::Display for ElGamalCiphertext { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "{}", base64::encode(self.to_bytes())) + } +} + impl<'a, 'b> Add<&'b ElGamalCiphertext> for &'a ElGamalCiphertext { type Output = ElGamalCiphertext;