summaryrefslogtreecommitdiff
path: root/src/identity.h
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2019-12-11 22:14:12 +0100
committerRoman Smrž <roman.smrz@seznam.cz>2019-12-18 22:26:28 +0100
commitd084c069be38b6f3ad74912ca629403d9fdaec58 (patch)
tree957e9e2340b291cdff6dac60480d1f4060c106a3 /src/identity.h
parent361891f25ca735fd85db64a14823cc55b8a0619a (diff)
Identity loading and validation
Diffstat (limited to 'src/identity.h')
-rw-r--r--src/identity.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/identity.h b/src/identity.h
new file mode 100644
index 0000000..d31951f
--- /dev/null
+++ b/src/identity.h
@@ -0,0 +1,38 @@
+#pragma once
+
+#include <erebos/identity.h>
+#include "pubkey.h"
+
+using std::function;
+using std::optional;
+using std::string;
+using std::vector;
+
+namespace erebos {
+
+class IdentityData
+{
+public:
+ static optional<IdentityData> load(const Ref &);
+
+ const vector<Stored<Signed<IdentityData>>> prev;
+ const optional<string> name;
+ const optional<Stored<Signed<IdentityData>>> owner;
+ const Stored<PublicKey> keyIdentity;
+ const optional<Stored<PublicKey>> keyMessage;
+};
+
+class Identity::Priv
+{
+public:
+ vector<Stored<Signed<IdentityData>>> data;
+ shared_future<optional<string>> name;
+ optional<Identity> owner;
+
+ static bool verifySignatures(const Stored<Signed<IdentityData>> & sdata);
+ static shared_ptr<Priv> validate(const vector<Stored<Signed<IdentityData>>> & sdata);
+ optional<Stored<IdentityData>> lookupProperty(
+ function<bool(const IdentityData &)> sel) const;
+};
+
+}