-
Notifications
You must be signed in to change notification settings - Fork 50
/
termux-auth.h
42 lines (33 loc) · 1.02 KB
/
termux-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
39
40
41
42
#ifndef TERMUX_AUTH_H
#define TERMUX_AUTH_H
#include <stdbool.h>
#ifdef __ANDROID__
# ifndef TERMUX_HOME
# define TERMUX_HOME "/data/data/com.termux/files/home"
# endif
# ifndef TERMUX_PREFIX
# define TERMUX_PREFIX "/data/data/com.termux/files/usr"
# endif
# define AUTH_HASH_FILE_PATH TERMUX_HOME "/.termux_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 *termux_passwd_hash(const char *password);
// Update file that stores password hash
// Return true on success, false otherwise.
bool termux_change_passwd(const char *new_password);
// Remove file that stores password hash
// Return true on success, false otherwise.
bool termux_remove_passwd(void);
// Check validity of password (user name is ignored).
// Return true if password is ok, otherwise return false.
bool termux_auth(const char *user, const char *password);
#ifdef __cplusplus
}
#endif
#endif