2013-12-21 07:59:23 -08:00
|
|
|
#ifndef E_AUTH_H
|
|
|
|
#define E_AUTH_H
|
|
|
|
|
2021-07-02 05:26:05 -07:00
|
|
|
typedef enum _E_Auth_Fprint_Type
|
|
|
|
{
|
|
|
|
E_AUTH_FPRINT_TYPE_UNKNOWN,
|
|
|
|
E_AUTH_FPRINT_TYPE_PRESS,
|
|
|
|
E_AUTH_FPRINT_TYPE_SWIPE
|
|
|
|
} E_Auth_Fprint_Type;
|
|
|
|
|
|
|
|
typedef enum _E_Auth_Fprint_Status
|
|
|
|
{
|
|
|
|
E_AUTH_FPRINT_STATUS_AUTH,
|
|
|
|
E_AUTH_FPRINT_STATUS_NO_AUTH,
|
|
|
|
E_AUTH_FPRINT_STATUS_SHORT_SWIPE,
|
|
|
|
E_AUTH_FPRINT_STATUS_NO_CENTER,
|
|
|
|
E_AUTH_FPRINT_STATUS_REMOVE_RETRY,
|
|
|
|
E_AUTH_FPRINT_STATUS_RETRY,
|
|
|
|
E_AUTH_FPRINT_STATUS_DISCONNECT,
|
|
|
|
E_AUTH_FPRINT_STATUS_ERROR
|
|
|
|
} E_Auth_Fprint_Status;
|
|
|
|
|
|
|
|
typedef struct _E_Event_Auth_Fprint_Available
|
|
|
|
{
|
|
|
|
E_Auth_Fprint_Type type;
|
|
|
|
} E_Event_Auth_Fprint_Available;
|
|
|
|
|
|
|
|
typedef struct _E_Event_Auth_Fprint_Status
|
|
|
|
{
|
|
|
|
E_Auth_Fprint_Status status;
|
|
|
|
} E_Event_Auth_Fprint_Status;
|
|
|
|
|
|
|
|
extern E_API int E_EVENT_AUTH_FPRINT_AVAILABLE;
|
|
|
|
extern E_API int E_EVENT_AUTH_FPRINT_STATUS;
|
|
|
|
|
|
|
|
EINTERN int e_auth_init(void);
|
|
|
|
EINTERN int e_auth_shutdown(void);
|
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API int e_auth_begin(char *passwd);
|
2019-10-07 17:29:24 -07:00
|
|
|
E_API int e_auth_polkit_begin(char *passwd, const char *cookie, unsigned int uid);
|
2013-12-21 07:59:23 -08:00
|
|
|
|
2014-09-05 12:02:10 -07:00
|
|
|
static inline int
|
|
|
|
e_auth_hash_djb2(const char *key, int len)
|
|
|
|
{
|
|
|
|
unsigned int hash_num = 5381;
|
|
|
|
const unsigned char *ptr;
|
|
|
|
|
|
|
|
if (!key) return 0;
|
|
|
|
for (ptr = (unsigned char *)key; len; ptr++, len--)
|
|
|
|
hash_num = ((hash_num << 5) + hash_num) ^ *ptr; /* hash * 33 ^ c */
|
|
|
|
|
|
|
|
return (int)hash_num;
|
|
|
|
}
|
|
|
|
|
2021-07-02 05:26:05 -07:00
|
|
|
E_API void e_auth_fprint_begin(const char *user);
|
|
|
|
E_API void e_auth_fprint_end(void);
|
|
|
|
|
2013-12-21 07:59:23 -08:00
|
|
|
#endif
|