diff options
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 |