forked from lastpass/lastpass-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.h
33 lines (26 loc) · 1.12 KB
/
config.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
#ifndef CONFIG_H
#define CONFIG_H
#include "kdf.h"
#include <stdio.h>
#include <stdbool.h>
#include <sys/types.h>
enum config_type {
CONFIG_DATA,
CONFIG_CONFIG,
CONFIG_RUNTIME,
};
char *config_path(const char *name);
FILE *config_fopen(const char *name, const char *mode);
bool config_exists(const char *name);
bool config_unlink(const char *name);
time_t config_mtime(const char *name);
void config_touch(const char *name);
void config_write_string(const char *name, const char *string);
void config_write_buffer(const char *name, const char *buffer, size_t len);
char *config_read_string(const char *name);
size_t config_read_buffer(const char *name, unsigned char **buffer);
void config_write_encrypted_string(const char *name, const char *string, unsigned const char key[KDF_HASH_LEN]);
void config_write_encrypted_buffer(const char *name, const char *buffer, size_t len, unsigned const char key[KDF_HASH_LEN]);
char *config_read_encrypted_string(const char *name, unsigned const char key[KDF_HASH_LEN]);
size_t config_read_encrypted_buffer(const char *name, unsigned char **buffer, unsigned const char key[KDF_HASH_LEN]);
#endif