noledgebin / frontend

NoledgeBin is a zero-knowledge pastebin
https://andinus.unfla.me/noledgebin/
GNU Affero General Public License v3.0
1 stars 1 forks source link

Connected to backend #26

Open joel122002 opened 2 years ago

joel122002 commented 2 years ago

The const ‘frontendOnly’ determines if the app should use the backend or not. If set to true the paste is stored in the URL and so is the passphrase (encryption key). If set to false the paste is sent to the backend which returns a JSON string with an id and deleteId. This id is used to retrieve the paste by sending a GET request and deleteId is used to delete a paste by sending a DELETE request. Deleting a paste has not yet been implemented on the frontend.

‘sendPostRequest()’ sends a post request to the server with the encrypted text. After sending the request the id is sent and the json is received the id, deleteId and passphrase are sent as parameters to ‘displaySuccessNoteAfterPost()’ which show the user the URL for the paste int the format domain/id#passphrase

‘getPaste()’ send a get request to the server which sends the paste as a JSON. ‘getPaste()’ then calls ‘displayPaste()’ and passes the encrypted text received from the server and the passphrase (from the fragment identifier of the URL) as parameters. ‘displayPaste()’ then decrypts the paste and shows it to the user.