mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
use decryptString()
This commit is contained in:
parent
475fddeec1
commit
b7b583ff04
@ -52,7 +52,7 @@ class Note extends Entity {
|
||||
this.isContentAvailable = protectedSessionService.isProtectedSessionAvailable();
|
||||
|
||||
if (this.isContentAvailable) {
|
||||
this.title = protectedSessionService.decrypt(this.title).toString();
|
||||
this.title = protectedSessionService.decryptString(this.title);
|
||||
}
|
||||
else {
|
||||
this.title = "[protected]";
|
||||
|
@ -37,7 +37,7 @@ class NoteRevision extends Entity {
|
||||
|
||||
if (this.isProtected) {
|
||||
if (protectedSessionService.isProtectedSessionAvailable()) {
|
||||
this.title = protectedSessionService.decrypt(this.title).toString();
|
||||
this.title = protectedSessionService.decryptString(this.title);
|
||||
}
|
||||
else {
|
||||
this.title = "[Protected]";
|
||||
|
@ -41,8 +41,8 @@ async function getRecentChanges() {
|
||||
for (const change of recentChanges) {
|
||||
if (change.current_isProtected) {
|
||||
if (protectedSessionService.isProtectedSessionAvailable()) {
|
||||
change.title = protectedSessionService.decrypt(change.title).toString();
|
||||
change.current_title = protectedSessionService.decrypt(change.current_title).toString();
|
||||
change.title = protectedSessionService.decryptString(change.title);
|
||||
change.current_title = protectedSessionService.decryptString(change.current_title);
|
||||
}
|
||||
else {
|
||||
change.title = change.current_title = "[Protected]";
|
||||
|
@ -54,7 +54,7 @@ async function loadProtectedNotes() {
|
||||
protectedNoteTitles = await sql.getMap(`SELECT noteId, title FROM notes WHERE isDeleted = 0 AND isProtected = 1`);
|
||||
|
||||
for (const noteId in protectedNoteTitles) {
|
||||
protectedNoteTitles[noteId] = protectedSessionService.decrypt(protectedNoteTitles[noteId]).toString();
|
||||
protectedNoteTitles[noteId] = protectedSessionService.decryptString(protectedNoteTitles[noteId]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,7 @@ function isProtectedSessionAvailable() {
|
||||
function decryptNotes(notes) {
|
||||
for (const note of notes) {
|
||||
if (note.isProtected) {
|
||||
note.title = decrypt(note.title).toString();
|
||||
note.title = decrypt(note.title);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -50,12 +50,17 @@ function decrypt(cipherText) {
|
||||
return dataEncryptionService.decrypt(getDataKey(), cipherText);
|
||||
}
|
||||
|
||||
function decryptString(cipherText) {
|
||||
return dataEncryptionService.decryptString(getDataKey(), cipherText);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
setDataKey,
|
||||
getDataKey,
|
||||
isProtectedSessionAvailable,
|
||||
encrypt,
|
||||
decrypt,
|
||||
decryptString,
|
||||
decryptNotes,
|
||||
setProtectedSessionId
|
||||
};
|
Loading…
x
Reference in New Issue
Block a user