]> begriffs open source - libpw/blob - include/pw.h
Switch to Meson build system
[libpw] / include / pw.h
1 #ifndef LIBPW_PW_H
2 #define LIBPW_PW_H
3
4 #include <stdbool.h>
5 #include <time.h>
6
7 #include <sqlite3.h>
8
9 typedef struct pw_context pw_context;
10
11 typedef enum pw_status
12 {
13         PW_OK,
14         PW_SQLITE_ERROR,
15         PW_CRYPT_ERROR,
16         PW_NO_MEM,
17         PW_NO_USER,
18         PW_BAD_PASS,
19         PW_BAD_TOKEN
20 } pw_status;
21
22 pw_status pw_init_context(sqlite3 *db, pw_context **ctx);
23
24 pw_status pw_set(pw_context *, char *user, char *pass);
25 pw_status pw_check(pw_context *, char *user, char *pass);
26 pw_status pw_reset_with_token(
27         pw_context *, char *user, char *newpass, char *token
28 );
29
30 pw_status pw_token_create(
31         pw_context *ctx, char *user,
32         unsigned char **token, unsigned int *token_len
33 );
34 pw_status pw_token_redeem(pw_context *, char *token);
35 pw_status pw_token_revoke(pw_context *, char *token);
36
37 #endif