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 <blu3beri@proton.me>
  • Loading branch information
berendsliedrecht committed Sep 6, 2023
1 parent 79d6097 commit a3accec
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 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,7 @@ 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 +101,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 +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,
Expand Down

0 comments on commit a3accec

Please sign in to comment.