#ifndef _AUTH_H
#define _AUTH_H
#include <stdint.h>
#define TOKEN_SIZE 16
#define MAX_PASSWORD_LENGTH 64
#define SCRYPT_SALT_SIZE 8
#define SCRYPT_OUTPUT_SIZE 32
#define SCRYPT_N 1<<14
#define SCRYPT_r 8
#define SCRYPT_p 1
struct auth_header {
uint8_t version;
uint8_t reserved1;
uint16_t reserved2;
};
struct auth_v2 {
struct auth_header header;
uint8_t password[SCRYPT_OUTPUT_SIZE];
uint8_t salt[SCRYPT_SALT_SIZE];
};
int auth_set_password(const char *username, const char *password);
int auth_check_password(const char *username, const char *password);
char * auth_login(const char *username, const char *password);
int auth_logout(const char *username, const char *token);
int auth_check_token(const char *username, const char *given_token);
int auth_get_counter(const char *username, uint32_t *counter);
#endif