diff options
| author | Anders Betts <anders.betts@gmail.com> | 2026-09-17 19:55:36 +0200 |
|---|---|---|
| committer | Anders Betts <anders.betts@gmail.com> | 2026-09-17 19:55:36 +0200 |
| commit | 380195f7cd5e57acf2c1cf2bc41069e6b0b979ed (patch) | |
| tree | 32a88fb22a7fbe8f1fd5c105156d1f928c93950d /src/auth.h | |
| download | bokf-380195f7cd5e57acf2c1cf2bc41069e6b0b979ed.tar.gz bokf-380195f7cd5e57acf2c1cf2bc41069e6b0b979ed.zip | |
Initial commit: daemon, clients, docs, Docker deploy pipelinev0.1.0
Diffstat (limited to 'src/auth.h')
| -rw-r--r-- | src/auth.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/auth.h b/src/auth.h new file mode 100644 index 0000000..630d8dc --- /dev/null +++ b/src/auth.h @@ -0,0 +1,19 @@ +#ifndef BOKF_AUTH_H +#define BOKF_AUTH_H + +#include <sqlite3.h> +#include <stdint.h> + +#define AUTH_TOKEN_PREFIX "bokf_" + +int auth_hash_password(const char *pw, char **out_phc); +int auth_verify_password(const char *phc, const char *pw); +void auth_hash_token(const char *token, unsigned char out[32]); +char *auth_generate_token(void); + +/* Returns user id > 0, -1 if not found, -2 on database error. */ +int64_t auth_user_lookup(sqlite3 *db, const char *username, char **out_pwhash, + char **out_display, int *out_is_admin, + int *out_disabled); + +#endif |
