Skip to content

Commit

Permalink
Make zeroize not used with no-default-features
Browse files Browse the repository at this point in the history
Signed-off-by: Berend Sliedrecht <[email protected]>
  • Loading branch information
berendsliedrecht committed Sep 6, 2023
1 parent 79d6097 commit 4848b9e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/data_types/credential.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
use std::collections::HashMap;

#[cfg(feature = "ffi")]
use zeroize::Zeroize;

use crate::cl::{CredentialSignature, RevocationRegistry, SignatureCorrectnessProof, Witness};
Expand Down Expand Up @@ -82,6 +84,8 @@ pub type ShortCredentialValues = HashMap<String, String>;
#[derive(Clone, Debug, Default, PartialEq, Eq, Deserialize, Serialize)]
pub struct CredentialValues(pub HashMap<String, AttributeValues>);


#[cfg(feature = "ffi")]
impl Drop for CredentialValues {
fn drop(&mut self) {
self.zeroize();
Expand All @@ -98,6 +102,7 @@ impl Validatable for CredentialValues {
}
}

#[cfg(feature = "ffi")]
impl Zeroize for CredentialValues {
fn zeroize(&mut self) {
for attr in self.0.values_mut() {
Expand All @@ -106,7 +111,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,
Expand Down

0 comments on commit 4848b9e

Please sign in to comment.