forked from cory/tildefriends
Move some DB things out of httpd.
This commit is contained in:
47
src/ssb.db.h
47
src/ssb.db.h
@ -311,6 +311,53 @@ tf_ssb_db_stored_connection_t* tf_ssb_db_get_stored_connections(tf_ssb_t* ssb, i
|
||||
*/
|
||||
void tf_ssb_db_forget_stored_connection(tf_ssb_t* ssb, const char* address, int port, const char* pubkey);
|
||||
|
||||
/**
|
||||
** Retrieve a user's hashed password from the database.
|
||||
** @param ssb The SSB instance.
|
||||
** @param name The username.
|
||||
** @param[out] out_password Populated with the password.
|
||||
** @param password_size The size of the out_password buffer.
|
||||
** @return true if the password hash was successfully retrieved.
|
||||
*/
|
||||
bool tf_ssb_db_get_account_password_hash(tf_ssb_t* ssb, const char* name, char* out_password, size_t password_size);
|
||||
|
||||
/**
|
||||
** Insert or update a user's hashed password in the database.
|
||||
** @param ssb The SSB instance.
|
||||
** @param name The username.
|
||||
** @param password The raw password.
|
||||
** @return true if the hash of the password was successfully stored.
|
||||
*/
|
||||
bool tf_ssb_db_set_account_password(tf_ssb_t* ssb, const char* name, const char* password);
|
||||
|
||||
/**
|
||||
** Add a user account to the database.
|
||||
** @param ssb The SSB instance.
|
||||
** @param name The username to add.
|
||||
** @param password The user's raw password.
|
||||
** @return true If the user was added successfully.
|
||||
*/
|
||||
bool tf_ssb_db_register_account(tf_ssb_t* ssb, const char* name, const char* password);
|
||||
|
||||
/**
|
||||
** Get an entry from the properties table.
|
||||
** @param ssb The SSB instance.
|
||||
** @param id The user.
|
||||
** @param key The property key.
|
||||
** @return The property value or null. Free with tf_free().
|
||||
*/
|
||||
const char* tf_ssb_db_get_property(tf_ssb_t* ssb, const char* id, const char* key);
|
||||
|
||||
/**
|
||||
** Store an entry in the properties table.
|
||||
** @param ssb The SSB instance.
|
||||
** @param id The user.
|
||||
** @param key The property key.
|
||||
** @param value The property value.
|
||||
** @return true if the property was stored successfully.
|
||||
*/
|
||||
bool tf_ssb_db_set_property(tf_ssb_t* ssb, const char* id, const char* key, const char* value);
|
||||
|
||||
/**
|
||||
** An SQLite authorizer callback. See https://www.sqlite.org/c3ref/set_authorizer.html for use.
|
||||
** @param user_data User data registered with the authorizer.
|
||||
|
Reference in New Issue
Block a user