Skip to content
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ p384 = { version = "0.13.0", optional = true, features = ["ecdsa"] }
rand = { version = "0.8.5", optional = true, features = ["std"], default-features = false }
rsa = { version = "0.9.6", optional = true }
sha2 = { version = "0.10.7", optional = true, features = ["oid"] }
zeroize = { version = "1.8.2", features = ["derive"] }

[target.'cfg(target_arch = "wasm32")'.dependencies]
js-sys = "0.3"
Expand Down
3 changes: 2 additions & 1 deletion src/decoding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use std::fmt::{Debug, Formatter};

use base64::{Engine, engine::general_purpose::STANDARD};
use serde::de::DeserializeOwned;
use zeroize::{Zeroize, ZeroizeOnDrop};

use crate::algorithms::AlgorithmFamily;
use crate::crypto::{CryptoProvider, JwtVerifier};
Expand Down Expand Up @@ -43,7 +44,7 @@ macro_rules! expect_two {
}};
}

#[derive(Clone)]
#[derive(Clone, Zeroize, ZeroizeOnDrop)]
/// Different kinds of decoding keys.
pub enum DecodingKeyKind {
/// A raw public key.
Expand Down
4 changes: 3 additions & 1 deletion src/encoding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use base64::{
engine::general_purpose::{STANDARD, URL_SAFE},
};
use serde::ser::Serialize;
use zeroize::{Zeroize, ZeroizeOnDrop};

use crate::algorithms::AlgorithmFamily;
use crate::crypto::CryptoProvider;
Expand All @@ -16,8 +17,9 @@ use crate::serialization::{b64_encode, b64_encode_part};

/// A key to encode a JWT with. Can be a secret, a PEM-encoded key or a DER-encoded key.
/// This key can be re-used so make sure you only initialize it once if you can for better performance.
#[derive(Clone)]
#[derive(Clone, Zeroize, ZeroizeOnDrop)]
pub struct EncodingKey {
#[zeroize(skip)]
family: AlgorithmFamily,
content: Vec<u8>,
}
Expand Down