-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathneoterm-auth.h
38 lines (30 loc) · 936 Bytes
/
neoterm-auth.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#ifndef NEOTERM_AUTH_H
#define NEOTERM_AUTH_H
#include <stdbool.h>
#ifdef __ANDROID__
# ifndef NEOTERM_HOME
# define NEOTERM_HOME "/data/data/com.neoterm/files/home"
# endif
# ifndef NEOTERM_PREFIX
# define NEOTERM_PREFIX "/data/data/com.neoterm/files/usr"
# endif
# define AUTH_HASH_FILE_PATH NEOTERM_HOME "/.neoterm_authinfo"
#else
# define AUTH_HASH_FILE_PATH "/tmp/access_hash"
#endif
#ifdef __cplusplus
extern "C" {
#endif
// Hash password using PBKDF function.
// Returns digest (in binary form) or NULL if failed.
unsigned char *neoterm_passwd_hash(const char *password);
// Update file that stores password hash
// Return true on success, false otherwise.
bool neoterm_change_passwd(const char *new_password);
// Check validity of password (user name is ignored).
// Return true if password is ok, otherwise return false.
bool neoterm_auth(const char *user, const char *password);
#ifdef __cplusplus
}
#endif
#endif