Burgernotes/APIDOCS.md

62 lines
2.2 KiB
Markdown
Raw Normal View History

2024-03-10 22:00:40 +00:00
# 🍔 Burgernotes API docs
2023-08-05 23:28:57 +01:00
Use the Burgernotes API to automate tasks, build your own client, and more!
2023-08-06 18:17:28 +01:00
Headers should be: "Content-type: application/json; charset=UTF-8" for all POSTs
2024-03-10 22:00:40 +00:00
## 🔑 Authentication
2023-08-05 23:28:57 +01:00
POST - /api/signup - provide "username" and "password".
2024-06-21 01:46:21 +01:00
POST - /api/login - provide "username", "password"
2023-08-05 23:28:57 +01:00
2024-06-21 01:46:21 +01:00
To prevent the server from knowing the encryption key, the password you provide in the request must be hashed with the SHA-3 algorithm with 128 iterations (the hash is hashed again 128 times).
2024-02-25 19:38:36 +00:00
2024-02-23 11:32:47 +00:00
Password should be at least 8 characters, username must be under 20 characters and alphanumeric.
2023-08-05 23:28:57 +01:00
If username is taken, error code 422 will return.
Assuming everything went correctly, the server will return a secret key.
You'll need to store two things in local storage:
- The secret key you just got, used to fetch notes, save stuff etc.
2024-02-25 19:41:46 +00:00
- A SHA512 hashed password, used as encryption key
2023-08-05 23:28:57 +01:00
2024-03-10 22:00:40 +00:00
## 🔐 Encryption
2023-08-05 23:28:57 +01:00
Note content and title is encrypted using AES 256-bit.
2024-02-25 19:41:46 +00:00
Encryption password is the SHA512 hashed password we talked about earlier.
2023-08-05 23:28:57 +01:00
2024-03-10 22:00:40 +00:00
## 🕹️ Basic stuff
2023-08-05 23:28:57 +01:00
POST - /api/userinfo - get user info such as username, provide "secretKey"
POST - /api/listnotes - list notes, provide "secretKey"
note titles will have to be decrypted.
POST - /api/newnote - create a note, provide "secretKey" and "noteName"
"noteName" should be encrypted.
POST - /api/readnote - read notes, provide "secretKey" and "noteId"
note content will have to be decrypted.
2024-03-10 22:00:40 +00:00
POST - /api/editnote - edit notes, provide "secretKey", "noteId", "title", and "content"
2023-08-05 23:28:57 +01:00
"content" should be encrypted.
2024-03-11 20:45:22 +00:00
"title" is the first line of the note content, and should be encrypted.
2023-08-05 23:28:57 +01:00
POST - /api/removenote - remove notes, provide "secretKey" and "noteId"
2024-03-10 22:00:40 +00:00
## ⚙️ More stuff
2023-08-05 23:28:57 +01:00
POST - /api/deleteaccount - delete account, provide "secretKey"
please display a warning before this action
POST - /api/exportnotes - export notes, provide "secretKey"
2023-08-19 18:20:37 +01:00
note content and title will have to be decrypted
POST - /api/sessions/list - show all sessions, provide "secretKey"
2024-02-25 19:41:46 +00:00
POST - /api/sessions/remove - remove session, provide "secretKey" and "sessionId"
2024-06-21 01:46:21 +01:00
POST - /api/listusers - lists all users in JSON, provide "masterKey" (set in config.ini)