mirror of
https://github.com/TriliumNext/Notes.git
synced 2026-05-24 06:58:24 -05:00
when leaving protected session don't forget to reset note cache (titles), #1810
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user