summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2019-11-12 22:09:20 +0100
committerRoman Smrž <roman.smrz@seznam.cz>2019-11-17 21:58:03 +0100
commit372436c0d1abee281f6c957059c7043daa742ea8 (patch)
tree16fd6f8fe501b3ad56a81d0f901456fc45763d19 /src
parentbfcfbb8523e6fc5ea2a74302661995e09ad0de71 (diff)
Command to display identity
Diffstat (limited to 'src')
-rw-r--r--src/Main.hs14
1 files changed, 14 insertions, 0 deletions
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