Crypto Testing
    Preparing search index...

    Function expectEncryptDecryptRoundTrip

    • Assert that encrypting then decrypting plaintext with key produces the original data. Uses crypto-lib's secretbox (XChaCha20).

      Parameters

      • key: string

        Hex-encoded 256-bit key.

      • plaintext: string

        Data to round-trip.

      Returns void

      import { expectEncryptDecryptRoundTrip, TEST_KEYS } from "@sebastienrousseau/crypto-testing";

      expectEncryptDecryptRoundTrip(TEST_KEYS.aes256, "hello world");

      If the decrypted output does not match the input.