Files
2022-11-21 18:47:04 +05:30
..
2022-11-17 13:05:31 +05:30
2022-11-16 20:37:50 +05:30
2022-11-16 20:37:50 +05:30

masking

Personal Identifiable Information protection. Wrapper types and traits for secret management which help ensure they aren't accidentally copied, logged, or otherwise exposed (as much as possible), and also ensure secrets are securely wiped from memory when dropped. Secret-keeping library inspired by secrecy.

How to use

To convert non-secret variable into secret use new(). Sample:

expiry_year: ccard.map(|x| Secret::new(x.card_exp_year.to_string())),
// output: "expiry_year: *** alloc::string::String ***"

To get value from secret use expose(). Sample:

last4_digits: Some(card_number.peek().clone())

Most fields are under Option. To simplify dealing with Option, use expose_cloning(). Sample:

    card_info.push_str(
        &card_detail
            .card_holder_name
            .peek_cloning()
            .unwrap_or_default(),
    );