Macro sc_bytes

Source
sc_bytes!() { /* proc-macro */ }
Expand description

Reads and encrypts the specified file contents using Aes256Gcm with the key embedded using use_staticrypt and a randomly generated nonce (derived from the STATICRYPT_SEED env variable at compile time).

Note that sc_bytes does not do any parsing by default, so it always outputs a Vec<u8>.

Example:

use staticrypt::*;

use_staticrypt!();

fn main() {
    let encrypted = String::from_utf8(sc_bytes!("./testfile.txt"))
        .expect("Should be valid UTF-8");

    assert_eq!(encrypted, "Hello, staticrypt!\n");
}