Fake Mirrors
    Preparing search index...

    Function decrypt

    • Decrypt a string with a secret using AES-256-GCM.

      The input should be a URL-safe Base64 encoded string from encrypt. Extracts the salt, IV, and auth tag, then decrypts and decompresses the data.

      Parameters

      • value: string

        URL-safe Base64 encoded ciphertext

      • secret: string

        The secret key for decryption

      Returns string

      The decrypted plaintext

      Error if decryption fails or auth tag is invalid

      const encrypted = encrypt('Secret message', 'mySecret123')
      const decrypted = decrypt(encrypted, 'mySecret123')
      console.log(decrypted) // Secret message