diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/erebos/contact.h | 2 | ||||
-rw-r--r-- | include/erebos/identity.h | 31 |
2 files changed, 32 insertions, 1 deletions
diff --git a/include/erebos/contact.h b/include/erebos/contact.h index 963e22a..9008ce7 100644 --- a/include/erebos/contact.h +++ b/include/erebos/contact.h @@ -57,7 +57,7 @@ struct ContactData Ref store(const Storage &) const; vector<Stored<ContactData>> prev; - vector<Stored<Signed<IdentityData>>> identity; + vector<StoredIdentityPart> identity; optional<string> name; }; diff --git a/include/erebos/identity.h b/include/erebos/identity.h index 7829361..4792330 100644 --- a/include/erebos/identity.h +++ b/include/erebos/identity.h @@ -71,6 +71,37 @@ private: Identity(std::shared_ptr<const Priv> && p); }; +struct IdentityData; +struct IdentityExtension; + +struct StoredIdentityPart +{ + using Part = variant< + Stored<Signed<IdentityData>>, + Stored<Signed<IdentityExtension>>>; + + StoredIdentityPart(Part p): part(move(p)) {} + + static StoredIdentityPart load(const Ref &); + Ref store(const Storage & st) const; + + bool operator==(const StoredIdentityPart & other) const + { return part == other.part; } + bool operator<(const StoredIdentityPart & other) const + { return part < other.part; } + + const Ref & ref() const; + const Stored<Signed<IdentityData>> & base() const; + + vector<StoredIdentityPart> previous() const; + vector<Digest> roots() const; + optional<string> name() const; + optional<StoredIdentityPart> owner() const; + bool isSignedBy(const Stored<PublicKey> &) const; + + Part part; +}; + DECLARE_SHARED_TYPE(optional<Identity>) } |