Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
fixed encryption
azivner0a793d0c475a
diff --git a/services/change_password.js b/services/change_password.jsindex 7157318db9..73188e3848 100644--- a/services/change_password.js+++ b/services/change_password.js@@ -30,11 +30,13 @@ async function changePassword(currentPassword, newPassword, req = null) {function encrypt(plainText) {const aes = getAes(newPasswordEncryptionKey);- const digest = crypto.createHash('sha256').update(aesjs.utils.utf8.toBytes(plainText)).digest().slice(0, 4);+ const plainTextBuffer = Buffer.from(plainText, 'latin1');++ const digest = crypto.createHash('sha256').update(plainTextBuffer).digest().slice(0, 4);console.log("Digest:", digest);- const encryptedBytes = aes.encrypt(Buffer.concat([digest, aesjs.utils.utf8.toBytes(plainText)]));+ const encryptedBytes = aes.encrypt(Buffer.concat([digest, plainTextBuffer]));console.log("Encrypted", encryptedBytes);