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.
- Encrypt Text: Convert plain text into encrypted text using a custom password.
- Decrypt Text: Revert encrypted text back to its original form using the same password.
- Clipboard Integration: Easily copy encrypted/decrypted text to the clipboard or paste input text from the clipboard.
- Dynamic UI: The app dynamically switches between encryption and decryption modes with a clean and responsive design.
- Select the Encrypt button from the navigation bar.
- Enter the text you want to encrypt in the input box.
- Provide a password for encryption in the password input field.
- The encrypted text will appear in the output box. You can copy it to the clipboard by clicking the "Copy" icon.
- Select the Decrypt button from the navigation bar.
- Paste the encrypted text in the input box.
- Provide the same password used for encryption.
- The decrypted text will appear in the output box. You can copy it to the clipboard by clicking the "Copy" icon.
- Paste from Clipboard: Click the "Paste" icon in the input box to automatically paste clipboard content.
- Copy to Clipboard: Click the "Copy" icon in the output box to copy the result.
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 |
- If the decryption fails due to an incorrect password, the API will return a
401 Unauthorized
response. - Ensure that your request body is properly formatted as JSON.
- SvelteKit: Framework for building modern web apps.
- crypto-ts: AES encryption library.
- Font Awesome: Icon library for UI elements.
This project is open-source and available under the MIT License.