server side WIP - saving encrypted note now works, changing terminology of "encrypted note" to "protected note"

This commit is contained in:
azivner
2017-11-14 21:54:12 -05:00
parent c18799b938
commit ff411f00b1
19 changed files with 208 additions and 87 deletions

View File

@@ -0,0 +1,25 @@
"use strict";
const protected_session = require('./protected_session');
module.exports = function(req) {
const browserId = req.headers['x-browser-id'];
function isProtectedSessionAvailable() {
return protected_session.isProtectedSessionAvailable(req);
}
function getDataKey() {
if (!isProtectedSessionAvailable()) {
throw new Error("Protected session is not available");
}
return protected_session.getDataKey(req);
}
return {
browserId,
isProtectedSessionAvailable,
getDataKey
};
};