Decrypt

Decrypts a base64 encoded encrypted text using AES-GCM decryption algorithm.

CategoryFunctions
AuthorPol Gubau
Since1.0.0
Last Updated2025-03-15
TypeAsync
CompatibilityBrowser

Example

  • Input

    await decrypt('encryptedTextInBase64', 'your-32-character-key')

    Output:

    decrypted text

Return

Returns the decrypted text.

Type: string

Props

NameTypeDefaultRequiredDescription
encryptedTextstringnullYesThe encrypted text in base64 format.
keystringnullYesThe decryption key (must be at least 32 characters long).

Notes

This function uses the AES-GCM decryption algorithm for decrypting the text.

Errors

Throws an error if the key is less than 32 characters.

Tags

  • decryption
  • AES-GCM
  • security

Related