removed dataKey where it's not necessary anymore (use of CLS instead)

This commit is contained in:
azivner
2018-03-31 08:53:52 -04:00
parent 5d203b2278
commit 05676f3459
12 changed files with 78 additions and 105 deletions

View File

@@ -37,21 +37,18 @@ async function uploadFile(req) {
async function downloadFile(req, res) {
const noteId = req.params.noteId;
const note = await sql.getRow("SELECT * FROM notes WHERE noteId = ?", [noteId]);
const protectedSessionId = req.query.protectedSessionId;
if (!note) {
return res.status(404).send(`Note ${noteId} doesn't exist.`);
}
if (note.isProtected) {
const dataKey = protected_session.getDataKeyForProtectedSessionId(protectedSessionId);
if (!dataKey) {
if (!protected_session.isProtectedSessionAvailable()) {
res.status(401).send("Protected session not available");
return;
}
protected_session.decryptNote(dataKey, note);
protected_session.decryptNote(note);
}
const labelMap = await labels.getNoteLabelMap(noteId);