mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 10:26:08 +01:00 
			
		
		
		
	fixed some encryption issues
This commit is contained in:
		| @@ -52,6 +52,10 @@ function encrypt(key, plainText, ivLength = 13) { | ||||
| } | ||||
|  | ||||
| function decrypt(key, cipherText, ivLength = 13) { | ||||
|     if (cipherText === null) { | ||||
|         return null; | ||||
|     } | ||||
|  | ||||
|     if (!key) { | ||||
|         return "[protected]"; | ||||
|     } | ||||
| @@ -93,6 +97,10 @@ function decrypt(key, cipherText, ivLength = 13) { | ||||
| function decryptString(dataKey, cipherText) { | ||||
|     const buffer = decrypt(dataKey, cipherText); | ||||
|  | ||||
|     if (buffer === null) { | ||||
|         return null; | ||||
|     } | ||||
|  | ||||
|     const str = buffer.toString('utf-8'); | ||||
|  | ||||
|     if (str === 'false') { | ||||
| @@ -108,4 +116,4 @@ module.exports = { | ||||
|     encrypt, | ||||
|     decrypt, | ||||
|     decryptString | ||||
| }; | ||||
| }; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user