use super::*;
use crate::types::Nonce;
#[test]
fn test_xchacha20poly1305() {
let key = [0x42; CHACHA20POLY1305_KEY_SIZE];
let nonce_bytes = [0x24; XCHACHA20POLY1305_NONCE_SIZE];
let nonce = Nonce::<XCHACHA20POLY1305_NONCE_SIZE>::new(nonce_bytes);
let plaintext = b"Extended nonce allows for random nonces";
let xchacha = XChaCha20Poly1305::new(&key);
let ciphertext = xchacha
.encrypt(&nonce, plaintext, None)
.expect("Encryption failed");
let decrypted = xchacha
.decrypt(&nonce, &ciphertext, None)
.expect("Decryption failed");
assert_eq!(decrypted, plaintext);
}