when leaving protected session don't forget to reset note cache (titles), #1810

This commit is contained in:
zadam
2021-04-03 22:02:25 +02:00
parent 2318d615bb
commit ef37a52a06
6 changed files with 25 additions and 4 deletions
+6 -1
View File
@@ -5,7 +5,7 @@ const log = require('./log');
const dataEncryptionService = require('./data_encryption');
const cls = require('./cls');
const dataKeyMap = {};
let dataKeyMap = {};
function setDataKey(decryptedDataKey) {
const protectedSessionId = utils.randomSecureToken(32);
@@ -29,6 +29,10 @@ function getDataKey() {
return dataKeyMap[protectedSessionId];
}
function resetDataKey() {
dataKeyMap = {};
}
function isProtectedSessionAvailable() {
const protectedSessionId = getProtectedSessionId();
@@ -71,6 +75,7 @@ function decryptString(cipherText) {
module.exports = {
setDataKey,
getDataKey,
resetDataKey,
isProtectedSessionAvailable,
encrypt,
decrypt,