1
0
mirror of https://github.com/PurpleI2P/i2pd.git synced 2025-01-14 21:09:57 +00:00
i2pd/libi2pd/Family.h

49 lines
1.0 KiB
C
Raw Normal View History

/*
2022-03-24 15:50:20 -04:00
* Copyright (c) 2013-2022, The PurpleI2P Project
*
* This file is part of Purple i2pd project and licensed under BSD3
*
* See full license text in LICENSE file at top of project tree
*/
2016-02-18 15:57:43 -05:00
#ifndef FAMILY_H__
2016-02-20 20:20:19 -05:00
#define FAMILY_H__
2016-02-18 15:57:43 -05:00
#include <map>
#include <string>
#include <memory>
#include "Signature.h"
#include "Identity.h"
2016-02-18 15:57:43 -05:00
namespace i2p
{
namespace data
{
2022-03-24 15:50:20 -04:00
typedef int FamilyID;
2016-02-18 15:57:43 -05:00
class Families
{
public:
Families ();
~Families ();
void LoadCertificates ();
2018-01-06 11:48:51 +08:00
bool VerifyFamily (const std::string& family, const IdentHash& ident,
2022-03-24 15:50:20 -04:00
const char * signature, const char * key = nullptr) const;
FamilyID GetFamilyID (const std::string& family) const;
2016-02-18 15:57:43 -05:00
private:
void LoadCertificate (const std::string& filename);
private:
2022-03-24 15:50:20 -04:00
std::map<std::string, std::pair<std::shared_ptr<i2p::crypto::Verifier>, FamilyID> > m_SigningKeys; // family -> (verifier, id)
2018-01-06 11:48:51 +08:00
};
2016-02-20 20:20:19 -05:00
std::string CreateFamilySignature (const std::string& family, const IdentHash& ident);
// return base64 signature of empty string in case of failure
2016-02-18 15:57:43 -05:00
}
}
#endif