macros/macros.rs
1use sanitization::{secure_drop_struct, SecretBytes};
2
3secure_drop_struct! {
4 struct SessionCredentials {
5 private_key: SecretBytes<32>,
6 nonce: SecretBytes<12>,
7 }
8}
9
10fn main() {
11 let credentials = SessionCredentials {
12 private_key: SecretBytes::from_array([1; 32]),
13 nonce: SecretBytes::from_array([2; 12]),
14 };
15
16 assert!(credentials.private_key.constant_time_eq(&[1; 32]));
17 assert!(credentials.nonce.constant_time_eq(&[2; 12]));
18}