Mercurial > sci
diff scid/db.h @ 44:576f4b1ec79f
scid: implement API authentication
author | David Demelier <markand@malikania.fr> |
---|---|
date | Thu, 11 Aug 2022 21:24:07 +0200 |
parents | 00b9af607524 |
children | 71cd8447e3a4 |
line wrap: on
line diff
--- a/scid/db.h Thu Aug 11 11:34:32 2022 +0200 +++ b/scid/db.h Thu Aug 11 21:24:07 2022 +0200 @@ -39,6 +39,11 @@ #include <jansson.h> /** + * Maximum property value. + */ +#define DB_PROP_VALUE_MAX 256 + +/** * Open database specified by path. * * \pre path != NULL @@ -48,6 +53,28 @@ db_open(const char *path); /** + * Reinitialize the API key in database and return it. + * + * \pre out != NULL + * \param out the destination key + * \param outsz the maximum size to write + * \return 0 on success or -1 on error + */ +int +db_key_init(char *out, size_t outsz); + +/** + * Fetch the key from the database. + * + * \pre out != NULL + * \param out the destination key + * \param outsz the maximum size to write + * \return 0 if not found, 1 if found or -1 on error + */ +int +db_key_get(char *out, size_t outsz); + +/** * Add a new job. * * \pre job != NULL