mirror of
https://github.com/zadam/trilium.git
synced 2025-11-02 03:16:11 +01:00
server side WIP - saving encrypted note now works, changing terminology of "encrypted note" to "protected note"
This commit is contained in:
25
services/request_context.js
Normal file
25
services/request_context.js
Normal 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
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user