Skip to content

Commit cc61d4b

Browse files
Merge pull request #85 from walters-labs/jacksonwalters-add-docs-link-to-readme
add link to API documentation to README.md
2 parents 0a4ba22 + 9712dde commit cc61d4b

File tree

1 file changed

+2
-64
lines changed

1 file changed

+2
-64
lines changed

README.md

Lines changed: 2 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -13,72 +13,10 @@ iOS frontend written in Swift: [https://github.com/open-encrypt/open-encrypt-ios
1313

1414
A public API is available for performing key generation, encryption, and decryption.
1515

16-
[https://rapidapi.com/jacksonwalters/api/open-encrypt](https://rapidapi.com/jacksonwalters/api/open-encrypt)
17-
1816
The public API key is `open-encrypt-public-api-key`. It is currently rate limited to 60 requests / min.
1917

20-
### Key Generation
21-
22-
The endpoint is `api/keygen.php`. To generate public/secret keys, run the following command:
23-
```bash
24-
curl -X POST https://open-encrypt.com/api/keygen.php \
25-
-H "Content-Type: application/json" \
26-
-H "X-API-Key: open-encrypt-public-api-key" \
27-
-d '{"method": "ring_lwe"}' > keys.json
28-
```
29-
30-
This returns a JSON response with four fields: `{"status","method","public_key","secret_key"}`.
31-
32-
The public key and secret key are both base64-encoded strings. They will be piped to a file `keys.json`.
33-
34-
### Encryption
35-
36-
The endpoint is `api/encrypt.php`. Create `to_encrypt.json` using the public key from `keys.json`:
37-
38-
```bash
39-
PUBLIC_KEY=$(jq -r '.public_key' keys.json)
40-
cat > to_encrypt.json <<EOF
41-
{
42-
"method": "ring_lwe",
43-
"public_key": "$PUBLIC_KEY",
44-
"plaintext": "Hello world!"
45-
}
46-
EOF
47-
```
48-
49-
Then encrypt the message:
50-
```bash
51-
curl -X POST https://open-encrypt.com/api/encrypt.php \
52-
-H "Content-Type: application/json" \
53-
-H "X-API-Key: open-encrypt-public-api-key" \
54-
-d @to_encrypt.json > encrypted.json
55-
```
56-
57-
### Decryption
58-
59-
The endpoint is `api/decrypt.php`. Create `to_decrypt.json` using the secret key from `keys.json` and ciphertext from `encrypted.json`:
60-
61-
```bash
62-
SECRET_KEY=$(jq -r '.secret_key' keys.json)
63-
CIPHERTEXT=$(jq -r '.ciphertext' encrypted.json)
64-
cat > to_decrypt.json <<EOF
65-
{
66-
"method": "ring_lwe",
67-
"secret_key": "$SECRET_KEY",
68-
"ciphertext": "$CIPHERTEXT"
69-
}
70-
EOF
71-
```
72-
73-
Then decrypt the message:
74-
```bash
75-
curl -X POST https://open-encrypt.com/api/decrypt.php \
76-
-H "Content-Type: application/json" \
77-
-H "X-API-Key: open-encrypt-public-api-key" \
78-
-d @to_decrypt.json
79-
```
80-
81-
**Note:** The `api_key` field in the JSON body is not needed when using the `X-API-Key` header.
18+
- Documentation: [https://docs.open-encrypt.com](https://docs.open-encrypt.com)
19+
- RapidAPI: [https://rapidapi.com/jacksonwalters/api/open-encrypt](https://rapidapi.com/jacksonwalters/api/open-encrypt)
8220

8321
## Disclaimer
8422

0 commit comments

Comments
 (0)