fixed password change (broken since migration to CBC encryption)

This commit is contained in:
azivner
2017-11-22 20:57:06 -05:00
parent b96e434345
commit c1fca4764b
2 changed files with 3 additions and 5 deletions

View File

@@ -11,14 +11,14 @@ async function verifyPassword(password) {
return givenPasswordHash === dbPasswordHash;
}
async function setDataKey(password, plainText) {
async function setDataKey(password, plainTextDataKey) {
const passwordDerivedKey = await my_scrypt.getPasswordDerivedKey(password);
const encryptedDataKeyIv = utils.randomSecureToken(16).slice(0, 16);
await options.setOption('encrypted_data_key_iv', encryptedDataKeyIv);
const buffer = Buffer.from(plainText);
const buffer = Buffer.from(plainTextDataKey);
const newEncryptedDataKey = data_encryption.encrypt(passwordDerivedKey, encryptedDataKeyIv, buffer);