summaryrefslogtreecommitdiff
path: root/include/erebos/attach.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/erebos/attach.h')
-rw-r--r--include/erebos/attach.h49
1 files changed, 49 insertions, 0 deletions
diff --git a/include/erebos/attach.h b/include/erebos/attach.h
new file mode 100644
index 0000000..6ea3d64
--- /dev/null
+++ b/include/erebos/attach.h
@@ -0,0 +1,49 @@
+#pragma once
+
+#include <erebos/pairing.h>
+
+#include <future>
+#include <mutex>
+#include <optional>
+#include <string>
+#include <vector>
+
+namespace erebos {
+
+using std::mutex;
+using std::optional;
+using std::promise;
+using std::string;
+using std::vector;
+
+struct AttachIdentity;
+
+class AttachService : public PairingService<AttachIdentity>
+{
+public:
+ AttachService(Config &&, const Server &);
+ virtual ~AttachService();
+
+ UUID uuid() const override;
+
+ void attachTo(const Peer &);
+
+protected:
+ virtual Stored<AttachIdentity> handlePairingComplete(const Peer &) override;
+ virtual void handlePairingResult(Context &, Stored<AttachIdentity>) override;
+
+ mutex handlerLock;
+};
+
+template<class T> class Signed;
+
+struct AttachIdentity
+{
+ Stored<Signed<struct IdentityData>> identity;
+ vector<vector<uint8_t>> keys;
+
+ static AttachIdentity load(const Ref &);
+ Ref store(const Storage &) const;
+};
+
+}