Skip to content

Commit 3772ff0

Browse files
authored
upload documentaion
1 parent 4f14b7e commit 3772ff0

File tree

1 file changed

+106
-0
lines changed

1 file changed

+106
-0
lines changed

README.md

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
[![Website](https://img.shields.io/website?down_color=edad0c&down_message=Classify&up_color=edad0c&up_message=Classify&url=https%3A%2F%2Fclassify-web.herokuapp.com%2F)](https://classify-web.herokuapp.com/)
2+
![GitHub repo size](https://img.shields.io/github/repo-size/cheatsnake/classify?color=blue)
3+
![GitHub](https://img.shields.io/github/license/cheatsnake/classify?color=%235DAF83)
4+
[![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://github.com/cheatsnake/classify/issues)
5+
6+
# :key: Classify
7+
8+
Classify is open source project for enrypting text messages. Encryption is based on a simple and clear "One-time pad" method. The essence of this method is to apply the "exclusive OR" operation for each ASCII code of the message symbol in binary form and the corresponding ASCII code of the secret key.
9+
10+
## :eyeglasses: API overview
11+
Classify API provides unlimited access to encoding and decoding text messages using a given key. You can freely use the endpoints of this API to create your own apps.
12+
13+
## :lock: Encrypting data
14+
This endpoint accepts text message data and a secret key as input. At the output, the user receives a JSON object with an encoded message.
15+
```sh
16+
POST https://classify-web.herokuapp.com/api/encrypt
17+
Content-Type: application/json; charset=utf-8
18+
{
19+
"data": "Your message",
20+
"key": "Your key"
21+
}
22+
```
23+
24+
## :unlock: Decrypting data
25+
This endpoint accepts an encrypted text message and a secret key as input. At the output, the user receives a JSON object with a decrypted message.
26+
```sh
27+
POST https://classify-web.herokuapp.com/api/decrypt
28+
Content-Type: application/json; charset=utf-8
29+
{
30+
"data": "Encrypted message",
31+
"key": "Secret key"
32+
}
33+
```
34+
35+
## :key: Keygen
36+
The reliability of the encrypted message depends on the specified key. Ideally, the key should be randomly generated and have a message length. To do this, you can use our built-in key generator.
37+
```sh
38+
GET https://classify-web.herokuapp.com/api/keygen
39+
```
40+
Key length parameter:
41+
```sh
42+
?length=32
43+
```
44+
Presence of symbols (1 - true, 0 - false):
45+
```sh
46+
?symbols=1
47+
```
48+
49+
## :dart: Examples
50+
JavaScript:
51+
```sh
52+
async function encryptData() {
53+
try {
54+
const url = 'https://classify-web.herokuapp.com/api/encrypt';
55+
const jsonData = JSON.stringify({
56+
data: "Hello world!", key: "secret"
57+
});
58+
let response = await fetch(url, {
59+
method: 'POST',
60+
headers: {
61+
'Content-Type': 'application/json;charset=utf-8'
62+
},
63+
body: jsonData
64+
});
65+
const result = await response.json();
66+
console.log(result);
67+
} catch (error) {
68+
console.error(error);
69+
}
70+
}
71+
```
72+
73+
## :zap: Launch local server
74+
75+
### Install packages
76+
```sh
77+
npm install
78+
```
79+
### Create .env file with secret key
80+
:warning: Classify uses double encryption. This means that after encrypting the message with your key, the received encrypted message is encrypted again with the key that is defined in the .env file. Therefore, each created copy of the application will have its own built-in key, and will not support decryption of its encrypted contents from another application.
81+
```sh
82+
SECRET_KEY=CreateReliableKeyUsingRandomGenerator
83+
```
84+
### Runs the server with Nodemon for development
85+
```sh
86+
npm run dev
87+
```
88+
The page will reload if you make edits.\
89+
You will also see any lint errors in the console.\
90+
Open [http://localhost:5000](http://localhost:5000) to view it in the browser.
91+
92+
### Launch tests
93+
```sh
94+
npm run test
95+
```
96+
97+
### Create a production build
98+
```sh
99+
npm run build
100+
```
101+
102+
### Runs the server of production build
103+
```sh
104+
npm start
105+
```
106+
Open [http://localhost:5000](http://localhost:5000) to view it in the browser.

0 commit comments

Comments
 (0)