summaryrefslogtreecommitdiff
path: root/src/Main.hs
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2020-01-08 22:12:18 +0100
committerRoman Smrž <roman.smrz@seznam.cz>2020-01-08 22:12:18 +0100
commit28f3049341e21e299b15e3948422fb113947621a (patch)
tree7a6ac8f1e7caec95ee6b32489e355df19eb3235b /src/Main.hs
parent35347e4cfbd9070d1065b1ff9600013d648c5e6e (diff)
Interactive identity update for custom refs
Diffstat (limited to 'src/Main.hs')
-rw-r--r--src/Main.hs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/Main.hs b/src/Main.hs
index 93517b2..b143253 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -71,6 +71,14 @@ main = do
["update-identity"] -> updateSharedIdentity st
+ ("update-identity" : srefs) -> do
+ sequence <$> mapM (readRef st . BC.pack) srefs >>= \case
+ Nothing -> error "ref does not exist"
+ Just refs
+ | Just idt <- validateIdentityF $ map wrappedLoad refs -> do
+ BC.putStrLn . showRefDigest . refDigest . storedRef . idData =<< interactiveIdentityUpdate idt
+ | otherwise -> error "invalid identity"
+
[bhost] -> interactiveLoop st bhost
_ -> error "Expecting broadcast address"