#ifndef SWISSVAULT_H
#define SWISSVAULT_H

#include "swissdef.h"

// store valuables in a new account (auth,data MUST not be empty)
// if acc_id==0 creates new account 
// else stores new value, if authenticated
// stores auth-value
// @return id of account (negative or null on error)
int store(struct account *acc);

// retrieve something from an account (int_acc MUST be !=0)
// if account exists and auth is successful:
// stores new auth and returns data
// @return <=0 on error number of account else
int retrieve(struct account *acc);

// renew the key of an account (auth, id MUST not be empty/==0)
// @return success (negative or null on error)
int refresh(struct account *acc);

// delete an account (auth, id MUST not be empty/==0)
int delete(struct account *acc);


// always call before closing else valuables might be lost
int close_vault();

inline void free_account(struct account *acc);

#endif
