From e4ce0630d62997c806c5e008a172df67a27bb224 Mon Sep 17 00:00:00 2001 From: Berend Sliedrecht Date: Wed, 6 Sep 2023 09:24:13 +0200 Subject: [PATCH] Make zeroize not used with `no-default-features` Signed-off-by: Berend Sliedrecht --- src/data_types/credential.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/data_types/credential.rs b/src/data_types/credential.rs index 03bf97d0..8cdfe060 100644 --- a/src/data_types/credential.rs +++ b/src/data_types/credential.rs @@ -1,4 +1,6 @@ use std::collections::HashMap; + +#[cfg(feature = "zeroize")] use zeroize::Zeroize; use crate::cl::{CredentialSignature, RevocationRegistry, SignatureCorrectnessProof, Witness}; @@ -82,6 +84,7 @@ pub type ShortCredentialValues = HashMap; #[derive(Clone, Debug, Default, PartialEq, Eq, Deserialize, Serialize)] pub struct CredentialValues(pub HashMap); +#[cfg(feature = "zeroize")] impl Drop for CredentialValues { fn drop(&mut self) { self.zeroize(); @@ -98,6 +101,7 @@ impl Validatable for CredentialValues { } } +#[cfg(feature = "zeroize")] impl Zeroize for CredentialValues { fn zeroize(&mut self) { for attr in self.0.values_mut() { @@ -106,7 +110,8 @@ impl Zeroize for CredentialValues { } } -#[derive(Clone, Debug, PartialEq, Eq, Zeroize, Deserialize, Serialize)] +#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] +#[cfg_attr(feature = "zeroize", derive(Zeroize))] pub struct AttributeValues { pub raw: String, pub encoded: String,