From 372436c0d1abee281f6c957059c7043daa742ea8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Roman=20Smr=C5=BE?= <roman.smrz@seznam.cz>
Date: Tue, 12 Nov 2019 22:09:20 +0100
Subject: Command to display identity

---
 src/Main.hs | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/Main.hs b/src/Main.hs
index 0e1daf7..6bd0967 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -17,6 +17,7 @@ import Data.Char
 import Data.List
 import Data.Maybe
 import qualified Data.Text as T
+import qualified Data.Text.IO as T
 import Data.Time.LocalTime
 
 import System.Console.Haskeline
@@ -51,6 +52,19 @@ main = do
                         forM_ (signedSignature signed) $ \sig -> do
                             putStr $ "SIG "
                             BC.putStrLn $ showRef $ storedRef $ sigKey $ fromStored sig
+                    "identity" -> case verifyIdentity (wrappedLoad ref) of
+                        Just identity -> do
+                            let disp idt = do
+                                    maybe (return ()) (T.putStrLn . (T.pack "Name: " `T.append`)) $ idName idt
+                                    BC.putStrLn . (BC.pack "KeyId: " `BC.append`) . showRefDigest . refDigest . storedRef $ idKeyIdentity idt
+                                    BC.putStrLn . (BC.pack "KeyMsg: " `BC.append`) . showRefDigest . refDigest . storedRef $ idKeyMessage idt
+                                    case idOwner idt of
+                                         Nothing -> return ()
+                                         Just owner -> do
+                                             putStrLn $ "OWNER " ++ BC.unpack (showRefDigest $ refDigest $ storedRef $ idData owner)
+                                             disp owner
+                            disp identity
+                        Nothing -> putStrLn $ "Identity verification failed"
                     _ -> error $ "unknown object type '" ++ objtype ++ "'"
 
         ["update-identity"] -> updateIdentity st
-- 
cgit v1.2.3