Editor FINISHED

saving works
This commit is contained in:
Nikola Petrov
2024-07-22 15:26:29 +02:00
parent 1ee0d2b459
commit b08c1651e6
3 changed files with 48 additions and 17 deletions

View File

@@ -374,9 +374,19 @@ void arg_editor(Buffer &decrypted_buffer, Buffer &encrypted_buffer, const char *
}
LoginInfoPointer lip = get_logininfo_pointer_from_buffer(decrypted_buffer, pass);
edit_file(lip.password);
int len = 0;
char *new_buff = edit_file(lip.password, len);
if (new_buff == nullptr)
{
return;
}
// delete_logininfo_from_buffer(decrypted_buffer, pass);
// Aes256::encrypt(key, decrypted_buffer, encrypted_buffer);
// encrypted_buffer.save_to_file();
std::string lable = lip.label;
std::string username = lip.username;
delete_logininfo_from_buffer(decrypted_buffer, pass);
add_logininfo_to_buffer(decrypted_buffer, lable.c_str(), lable.size(), username.c_str(), username.size(), new_buff, len);
Aes256::encrypt(key, decrypted_buffer, encrypted_buffer);
encrypted_buffer.save_to_file();
}