Rename Pass to LoginInfo

and move print_usage, get_args to arg_func.h
This commit is contained in:
Nikola Petrov
2023-08-27 20:16:37 +02:00
parent 746859c70e
commit a900289dbf
4 changed files with 111 additions and 112 deletions

View File

@@ -5,6 +5,23 @@ class Buffer;
class Cryptography;
#include <string>
enum class Arg
{
Get, // get password for label
Generate, // generate password for label
List, // list all labels
Delete, // delete password for label
Print_all_p, // print all passwords
Input, // input password for label
Change, // change main password
Show, // show password for label
Error // error
};
void print_args();
Arg get_args(int argc, char** argv, char** label);
const char* arg_get(Buffer& decrypted_buffer, const char* label);
const char* arg_generate(Buffer& decrypted_buffer, Buffer& encrypted_buffer, const char* label, Cryptography& crypto);

View File

@@ -3,10 +3,10 @@
class Buffer;
struct Pass
struct LoginInfo
{
uint32_t label;
uint32_t password;
uint32_t password;
};
struct Index
@@ -15,26 +15,13 @@ struct Index
uint32_t offset;
};
enum class Arg
{
Get, // get password for label
Generate, // generate password for label
List, // list all labels
Delete, // delete password for label
Print_all_p, // print all passwords
Input, // input password for label
Change, // change main password
Show, // show password for label
Error // error
};
int find_logininfo_in_buffer(Buffer& buffer, const char* label);
int find_password_in_buffer(Buffer& buff, const char* label);
void delete_logininfo_from_buffer(Buffer& buffer, int index_of_pass);
void delete_password_from_buffer(Buffer& in, int index_of_pass);
void add_logininfo_to_buffer(Buffer& buffer, const char* label, const char* password);
void add_password_to_buffer(Buffer& in, const char* label, const char* password);
const char* get_password_from_buffer(Buffer& decrypted_buffer, int label);
const char* get_logininfo_pointer_from_buffer(Buffer& buffer, int index_of_pass);
void generate_password(std::string& password, int len);
@@ -42,6 +29,3 @@ bool save_buffer_to_file(Buffer& buffer);
bool load_buffer_from_file(Buffer& buffer);
void print_usage();
Arg get_args(int argc, char** argv, char** label);