diff options
author | Roman Smrž <roman.smrz@seznam.cz> | 2019-05-22 21:09:15 +0200 |
---|---|---|
committer | Roman Smrž <roman.smrz@seznam.cz> | 2019-05-22 21:09:15 +0200 |
commit | d1a81e08acb2fc34a2a1f72fde979fbe66dea24e (patch) | |
tree | 280eb4b0f5782f5da541dd868a52569f1514c80b /src/Identity.hs | |
parent | b3dd410bb4ed093b74fe349d3a51a5767c76f952 (diff) |
Simple identity name formatting
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 ff63353..96346d8 100644 --- a/src/Identity.hs +++ b/src/Identity.hs @@ -2,9 +2,12 @@ module Identity ( Identity, IdentityData(..), emptyIdentity, finalOwner, + displayIdentity, ) where +import Data.Maybe import Data.Text (Text) +import qualified Data.Text as T import PubKey import Storage @@ -51,3 +54,9 @@ unfoldOwners cur = cur : case idOwner $ fromStored $ signedData $ fromStored cur finalOwner :: Stored Identity -> Stored Identity finalOwner = last . unfoldOwners + +displayIdentity :: Stored Identity -> Text +displayIdentity sidentity = T.concat + [ T.intercalate (T.pack " / ") $ map (fromMaybe (T.pack "<unnamed>") . idName . fromStored . signedData . fromStored) owners + ] + where owners = reverse $ unfoldOwners sidentity |