decrypt
Type: decrypt(content: string): APIResult<string>
The decrypt() method decrypts data encrypted by encrypt() and returns the original plaintext string.
TypeScript
const = .().("afbc12...:5cbb...:beef...");Parameters
| Option | Type | Description |
|---|---|---|
| content | string | Encrypted string to be decrypted |
Return Value
APIResult<string>: If decryption is successful, the result will contain the original string in thedatafield. If it fails, it will returnsuccess: falsewith accompanyingmessage,status, andcode.
Example Usage
TypeScript
const = .().("example text");
if (.) {
const = .().(.);
.(.data); // "example text"
}Notes
- The input must follow the format produced by
encrypt(). - The format must be a string containing IV, ciphertext, and auth tag separated by colons (
:). - Decryption will fail if the format is invalid or if the authentication tag is incorrect.
Last updated on