Easy Encryption is a Svelte-based web application that provides a simple and intuitive interface for encrypting and decrypting text. It uses AES encryption from the crypto-ts
library, allowing users to securely transform plaintext into ciphertext and vice versa.
This application also exposes an API endpoint to perform encryption and decryption operations programmatically.
POST /api
This API endpoint allows users to encrypt or decrypt text using a password.
The request must be sent as a POST request with a JSON body.
Header | Value |
---|---|
Content-Type |
application/json |
The request body should be a JSON object containing the following fields:
Field | Type | Required | Description |
---|---|---|---|
action |
string | ✅ Yes | Either "encrypt" or "decrypt" |
text |
string | ✅ Yes | The text to be encrypted or decrypted |
password |
string | ❌ No | The password for encryption/decryption (defaults to an empty string if not provided) |
POST /api
{
"action": "encrypt",
"text": "Hello, World!",
"password": "mypassword123"
}
POST /api
{
"action": "decrypt",
"text": "EncryptedTextHere",
"password": "mypassword123"
}
The API returns a JSON response with the encryption or decryption result.
{
"result": "EncryptedOrDecryptedTextHere"
}
Status Code | Message | Cause |
---|---|---|
400 | "Action is required" |
Missing action field |
400 | "Text is required" |
Missing text field |
400 | "Invalid action" |
Action is not "encrypt" or "decrypt" |
401 | "Invalid password" |
Decryption failed due to incorrect password |
400 | "Body cannot be empty" |
Request body is empty |
401 Unauthorized
response.This project is open-source and available under the MIT License.