Crypto Vue
    Preparing search index...

    Function useEncrypt

    • Vue composable for symmetric encryption/decryption using secretbox (XChaCha20-Poly1305).

      If the CryptoPlugin has been installed with a defaultKey, that key is used when none is passed explicitly.

      Returns UseEncryptReturn

      <script setup lang="ts">
      const { encrypt, randomKey, ciphertext } = useEncrypt();
      const key = randomKey();
      await encrypt(key, "secret message");
      </script>