#ifndef _DB_IF_H_
#define _DB_IF_H_
#include "db.h"
#include "sha1.h"
#include <string>
#include <list>

class DbIf {
public:
	DbIf(int argc, char ** argv);
	~DbIf();
	std::string getSalt();
	bool consumeKey(std::string key);

	PosDb & getDb();

private:
	void expireKeys();
	PosDb * db;
	std::list<std::pair<uint64_t, SHA1Hash> > valid_keys;
	uint64_t key_lifetime;
	size_t salt_size;
	std::string secret;
	
};

#endif

