aboutsummaryrefslogblamecommitdiff
path: root/include/libnpass/libnpass.h
blob: 1a0f31a14ab34b623f7df7cfad07dbbe9e177c02 (plain) (tree)
1
2
3
4
5
6
7
8
9

                         
                  
 
                       
 

                           
                           
                           

             






                           

                            

  
                                                              
                                      
                                       

                                                     
                               
                                          
                                                           
                              
 
                                                   
                                                  
#include <dirent.h>
#include <linux/limits.h>
#include <stdio.h>

#define PASS_DEF_LEN 32

typedef enum {
	PASS_GEN_DIGIT = 0,
	PASS_GEN_ALNUM = 1,
	PASS_GEN_GRAPH = 2,
} pass_gen_t;

typedef enum {
	PASS_STORE_DIR = 0,
	PASS_STORE_ENC = 1,
	PASS_STORE_INV = 2,
} pass_store_t;

struct store {
	char name[NAME_MAX];
	pass_store_t type;
};

int pass_readstore_all(const char *path, struct store **stor);
int pass_store_path_set(char **store);
int pass_store_type(const char *spath);
int pass_store_cmp(const void *vp1, const void *vp2);

int pass_init(const char *fpr);
int pass_cat(FILE *out, const char *path);
int pass_add(const char *path, const char *pass, size_t n);
int pass_rm(const char *path);

ssize_t pass_getpass(char **lineptr, FILE *stream);
int pass_gen(pass_gen_t gen, char *pass, int len);