Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make zeroize not used with no-default-features #242

Merged
merged 1 commit into from
Sep 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 = "zeroize")]
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 = "zeroize")]
impl Drop for CredentialValues {
fn drop(&mut self) {
self.zeroize();
Expand All @@ -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() {
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
Loading