omnium 0.9.1

A set of extensions for building web applications on axum.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use crate::security::{
    crypto::{decrypt_string_aes256_gcm, encrypt_string_aes256_gcm},
    secrets::create_service_secret,
};

#[test]
fn test_round_trip_encryption() {
    let secret = create_service_secret().unwrap().value;

    let encrypted = encrypt_string_aes256_gcm("test plaintext", &secret).unwrap();
    assert_ne!(encrypted, "test plaintext");

    let decrypted = decrypt_string_aes256_gcm(&encrypted, &secret).unwrap();
    assert_eq!(decrypted, "test plaintext");
}