mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
fixed some encryption issues
This commit is contained in:
parent
7133e60267
commit
bdfd760b9d
@ -52,6 +52,10 @@ function encrypt(key, plainText, ivLength = 13) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function decrypt(key, cipherText, ivLength = 13) {
|
function decrypt(key, cipherText, ivLength = 13) {
|
||||||
|
if (cipherText === null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
if (!key) {
|
if (!key) {
|
||||||
return "[protected]";
|
return "[protected]";
|
||||||
}
|
}
|
||||||
@ -93,6 +97,10 @@ function decrypt(key, cipherText, ivLength = 13) {
|
|||||||
function decryptString(dataKey, cipherText) {
|
function decryptString(dataKey, cipherText) {
|
||||||
const buffer = decrypt(dataKey, cipherText);
|
const buffer = decrypt(dataKey, cipherText);
|
||||||
|
|
||||||
|
if (buffer === null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
const str = buffer.toString('utf-8');
|
const str = buffer.toString('utf-8');
|
||||||
|
|
||||||
if (str === 'false') {
|
if (str === 'false') {
|
||||||
|
@ -338,7 +338,7 @@ class Note {
|
|||||||
|
|
||||||
decrypt() {
|
decrypt() {
|
||||||
if (this.isProtected && !this.isDecrypted && protectedSessionService.isProtectedSessionAvailable()) {
|
if (this.isProtected && !this.isDecrypted && protectedSessionService.isProtectedSessionAvailable()) {
|
||||||
this.title = protectedSessionService.decryptString(note.title);
|
this.title = protectedSessionService.decryptString(this.title);
|
||||||
|
|
||||||
this.isDecrypted = true;
|
this.isDecrypted = true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user