Skip to Content
This project is in active development. Features and behaviors may change without notice.

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

OptionTypeDescription
contentstringEncrypted string to be decrypted

Return Value

  • APIResult<string>: If decryption is successful, the result will contain the original string in the data field. If it fails, it will return success: false with accompanying message, status, and code.

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