|
SecurePasswd_MGMT 2026.03.19
A modern, cross-platform password manager and two-factor authenticator (TOTP) designed with state-of-the-art security.
|
#include "database.h"#include "key_derivation.h"#include <sqlite3.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <stdbool.h>#include <sodium.h>Functions | |
| static int | initialize_schema () |
| int | database_open (const char *db_path, const char *password) |
| Opens and initializes the database. | |
| void | database_close () |
| Closes the database. | |
| PasswordEntry * | database_get_all_entries (int *count) |
| Retrieves all password entries from the database. | |
| PasswordEntry * | database_search (const char *query, int *count) |
| Searches for password entries by service or username. | |
| PasswordEntry * | database_get_entry_by_identity (const char *service, const char *username) |
| Retrieves a password entry by its identity (Service + Username). | |
| PasswordEntry * | database_get_entry_secure (int id) |
| Retrieves a single password entry with ALL details (including secrets) by ID. | |
| int | database_add_entry (const PasswordEntry *entry) |
| Adds a new password entry to the database. | |
| int | database_update_entry (const PasswordEntry *entry) |
| Updates an existing password entry in the database. | |
| int | database_delete_entry (int id) |
| Deletes a password entry from the database by its ID. | |
| void | free_password_entries (PasswordEntry *entries, int count) |
| Frees a list of PasswordEntry structs. | |
| int | database_rekey (const char *new_password) |
| Changes the master password of the database. | |
Variables | |
| static sqlite3 * | db = NULL |
| static char | current_db_path [4096] = {0} |
| int database_add_entry | ( | const PasswordEntry * | entry | ) |
Adds a new password entry to the database.
| entry | A pointer to the PasswordEntry to add. |
| void database_close | ( | ) |
Closes the database.
| int database_delete_entry | ( | int | id | ) |
Deletes a password entry from the database by its ID.
| id | The ID of the entry to delete. |
| PasswordEntry * database_get_all_entries | ( | int * | count | ) |
Retrieves all password entries from the database.
| count | A pointer to an integer that will be filled with the number of entries. |
| PasswordEntry * database_get_entry_by_identity | ( | const char * | service, |
| const char * | username ) |
Retrieves a password entry by its identity (Service + Username).
| service | The name of the service. |
| username | The username for the service. |
| PasswordEntry * database_get_entry_secure | ( | int | id | ) |
Retrieves a single password entry with ALL details (including secrets) by ID.
| id | The ID of the entry to retrieve. |
| int database_open | ( | const char * | db_path, |
| const char * | password ) |
Opens and initializes the database.
| db_path | The path to the database file. |
| password | The master password for the database. |
| int database_rekey | ( | const char * | new_password | ) |
Changes the master password of the database.
| new_password | The new master password. |
| PasswordEntry * database_search | ( | const char * | query, |
| int * | count ) |
Searches for password entries by service or username.
| query | The search query string. |
| count | A pointer to an integer that will be filled with the number of entries. |
| int database_update_entry | ( | const PasswordEntry * | entry | ) |
Updates an existing password entry in the database.
| entry | A pointer to the PasswordEntry to update. |
| void free_password_entries | ( | PasswordEntry * | entries, |
| int | count ) |
Frees a list of PasswordEntry structs.
| entries | The array of PasswordEntry structs to free. |
| count | The number of entries in the array. |
|
static |
|
static |
|
static |