// Encrypt function wrapper for JSON Backend
Encrypt function wrapper for JSON Backend
Encrypt function wrapper for JSON Backend
pub fn json_encrypt(plaintext: String) -> String {
    // Generate derivation value
    let derivation_value = generate_derivation_value();
    // Derive password using derivation value
    let derived_password = derive_password(derivation_value.clone());
    // Generate IV
    let iv = generate_initialization_vector();
    // Encrypt
    let ciphertext = aes_256_gcm_siv_encrypt(derived_password, iv.to_vec(), plaintext);
    // Return formatted string for storage in JSON
    format!(
        "{}${}${}",
        derivation_value,
        base64::encode(iv),
        base64::encode(ciphertext)
    )
}
pub fn json_encrypt ( plaintext : String ) -> String { // Generate derivation value let derivation_value = generate_derivation_value ( ) ; // Derive password using derivation value let derived_password = derive_password ( derivation_value . clone ( ) ) ; // Generate IV let iv = generate_initialization_vector ( ) ; // Encrypt let ciphertext = aes_256_gcm_siv_encrypt ( derived_password , iv . to_vec ( ) , plaintext ) ; // Return formatted string for storage in JSON format ! ( " " derivation_value base64 encode ( iv ) base64 encode ( ciphertext ) ) }
Encrypt function wrapper for JSON Backend
Encrypt function wrapper for JSON Backend
plaintext
String