diff options
author | Roman Smrž <roman.smrz@seznam.cz> | 2019-05-19 22:19:15 +0200 |
---|---|---|
committer | Roman Smrž <roman.smrz@seznam.cz> | 2019-05-22 20:50:01 +0200 |
commit | b3dd410bb4ed093b74fe349d3a51a5767c76f952 (patch) | |
tree | 0a3e22be5d9632993ea436fef5b6e2767b64f715 /src/Identity.hs | |
parent | 75cf4c130cc21afd4d569ce0291c2656de162908 (diff) |
Direct message service basics
Diffstat (limited to 'src/Identity.hs')
-rw-r--r-- | src/Identity.hs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/Identity.hs b/src/Identity.hs index c1561b6..ff63353 100644 --- a/src/Identity.hs +++ b/src/Identity.hs @@ -1,6 +1,7 @@ module Identity ( Identity, IdentityData(..), emptyIdentity, + finalOwner, ) where import Data.Text (Text) @@ -42,3 +43,11 @@ instance Storable IdentityData where <*> loadMbRef "owner" <*> loadRef "key-id" <*> loadRef "key-msg" + +unfoldOwners :: Stored Identity -> [Stored Identity] +unfoldOwners cur = cur : case idOwner $ fromStored $ signedData $ fromStored cur of + Nothing -> [] + Just prev -> unfoldOwners prev + +finalOwner :: Stored Identity -> Stored Identity +finalOwner = last . unfoldOwners |