pub fn decrypt(
message: &str,
password: &str,
) -> Result<String, ValidationErrors>Expand description
Decrypts a Base64-encoded payload produced by encrypt and returns the original message.
Reverses the three stages of encrypt:
- Base64 decode — unpacks the payload back into
salt,nonce, andciphertext. - AES-256-GCM — decrypts and authenticates the ciphertext. Fails if the payload was tampered with or if the wrong password is provided.
- SGA decode — converts SGA symbols back to plain ASCII letters.
§Errors
Returns an error if the payload is malformed, authentication fails, or decoding fails.
§Example
let plaintext = ender_eye::decrypt(&ciphertext, "my-password").unwrap();
assert_eq!(plaintext, "hello world");