Assert that encrypting then decrypting plaintext with key produces the original data. Uses crypto-lib's secretbox (XChaCha20).
plaintext
key
Hex-encoded 256-bit key.
Data to round-trip.
import { expectEncryptDecryptRoundTrip, TEST_KEYS } from "@sebastienrousseau/crypto-testing";expectEncryptDecryptRoundTrip(TEST_KEYS.aes256, "hello world"); Copy
import { expectEncryptDecryptRoundTrip, TEST_KEYS } from "@sebastienrousseau/crypto-testing";expectEncryptDecryptRoundTrip(TEST_KEYS.aes256, "hello world");
If the decrypted output does not match the input.
Assert that encrypting then decrypting
plaintextwithkeyproduces the original data. Uses crypto-lib's secretbox (XChaCha20).