Decrypt
Decrypts a base64 encoded encrypted text using AES-GCM decryption algorithm.
| Category | Functions |
| Author | Pol Gubau |
| Since | 1.0.0 |
| Last Updated | 2025-03-15 |
| Type | Async |
| Compatibility | Browser |
Example
Input
await decrypt('encryptedTextInBase64', 'your-32-character-key')Output:
decrypted text
Return
Returns the decrypted text.
Type: string
Props
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
| encryptedText | string | null | Yes | The encrypted text in base64 format. |
| key | string | null | Yes | The 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