zk-token-sdk: implement Display for ciphertexts (#26755)
This commit is contained in:
parent
3396d4eccd
commit
700da0fc83
|
@ -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 {
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue