Fix ordering in perl subscription_list
[blerg.git] / common / auth.h
1 /* Blerg is (C) 2011 The Dominion of Awesome, and is distributed under a
2  * BSD-style license.  Please see the COPYING file for details.
3  */
4 #ifndef _AUTH_H
5 #define _AUTH_H
6
7 #include <stdint.h>
8
9 #define TOKEN_SIZE 16
10 #define MAX_PASSWORD_LENGTH 64
11 #define SCRYPT_SALT_SIZE 8
12 #define SCRYPT_OUTPUT_SIZE 32
13 #define SCRYPT_N 1<<14
14 #define SCRYPT_r 8
15 #define SCRYPT_p 1
16
17 struct auth_header {
18         uint8_t version;
19         uint8_t reserved1;
20         uint16_t reserved2;
21 };
22
23 struct auth_v2 {
24         struct auth_header header;
25         uint8_t password[SCRYPT_OUTPUT_SIZE];
26         uint8_t salt[SCRYPT_SALT_SIZE];
27 };
28
29 int auth_set_password(const char *username, const char *password);
30 int auth_check_password(const char *username, const char *password);
31 char * auth_login(const char *username, const char *password);
32 int auth_logout(const char *username, const char *token);
33 int auth_check_token(const char *username, const char *given_token);
34 int auth_get_counter(const char *username, uint32_t *counter);
35
36 #endif //_AUTH_H