summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ymir/mlmmj-expose.nix6
1 files changed, 3 insertions, 3 deletions
diff --git a/ymir/mlmmj-expose.nix b/ymir/mlmmj-expose.nix
index 6673c06c..3481308d 100644
--- a/ymir/mlmmj-expose.nix
+++ b/ymir/mlmmj-expose.nix
@@ -41,7 +41,7 @@ let
41 setCurrentDirectory listDir 41 setCurrentDirectory listDir
42 key <- (BS.readFile "exposed.key") `catchIOError` (\e -> if isDoesNotExistError e then randomKey >>= (\k -> BS.writeFile "exposed.key" k >> return k) else ioError e) 42 key <- (BS.readFile "exposed.key") `catchIOError` (\e -> if isDoesNotExistError e then randomKey >>= (\k -> BS.writeFile "exposed.key" k >> return k) else ioError e)
43 let ((map toLower -> ident), (map toLower -> recipient)) = read . CLBS.unpack $ decryptMsg CBC key extension 43 let ((map toLower -> ident), (map toLower -> recipient)) = read . CLBS.unpack $ decryptMsg CBC key extension
44 identities <- (read <$> readFile "exposed.ids") `catchIOError` (\e -> if isDoesNotExistError e then return [] else ioError e) 44 identities <- (lines <$> readFile "exposed.ids") `catchIOError` (\e -> if isDoesNotExistError e then return [] else ioError e)
45 unless (ident `elem` identities) . die $ "Unknown sender: ‘" ++ ident ++ "’" 45 unless (ident `elem` identities) . die $ "Unknown sender: ‘" ++ ident ++ "’"
46 subscribers <- getSubscribers 46 subscribers <- getSubscribers
47 unless (recipient `elem` subscribers) . die $ "Unknown recipient: ‘" ++ recipient ++ "’" 47 unless (recipient `elem` subscribers) . die $ "Unknown recipient: ‘" ++ recipient ++ "’"
@@ -56,7 +56,7 @@ let
56 identities <- (read <$> readFile "exposed.ids") `catchIOError` (\e -> if isDoesNotExistError e then return [] else ioError e) 56 identities <- (read <$> readFile "exposed.ids") `catchIOError` (\e -> if isDoesNotExistError e then return [] else ioError e)
57 case ident `elem` identities of 57 case ident `elem` identities of
58 True -> putStrLn "Identity is already known" 58 True -> putStrLn "Identity is already known"
59 False -> writeFile "exposed.ids" . show $ ident : identities 59 False -> writeFile "exposed.ids" . unlines $ ident : identities
60 _ -> hPutStrLn stderr ("Called without expected arguments (<listDirectory> <senderIdentity>)") >> exitWith (ExitFailure 2) 60 _ -> hPutStrLn stderr ("Called without expected arguments (<listDirectory> <senderIdentity>)") >> exitWith (ExitFailure 2)
61 "mlmmj-get-exposed" -> do 61 "mlmmj-get-exposed" -> do
62 args <- getArgs 62 args <- getArgs
@@ -64,7 +64,7 @@ let
64 [listDir, (map toLower -> ident), (map toLower -> recipient)] -> do 64 [listDir, (map toLower -> ident), (map toLower -> recipient)] -> do
65 setCurrentDirectory listDir 65 setCurrentDirectory listDir
66 key <- (BS.readFile "exposed.key") `catchIOError` (\e -> if isDoesNotExistError e then randomKey >>= (\k -> BS.writeFile "exposed.key" k >> return k) else ioError e) 66 key <- (BS.readFile "exposed.key") `catchIOError` (\e -> if isDoesNotExistError e then randomKey >>= (\k -> BS.writeFile "exposed.key" k >> return k) else ioError e)
67 identities <- (read <$> readFile "exposed.ids") `catchIOError` (\e -> if isDoesNotExistError e then return [] else ioError e) 67 identities <- (lines <$> readFile "exposed.ids") `catchIOError` (\e -> if isDoesNotExistError e then return [] else ioError e)
68 unless (ident `elem` identities) . die $ "Unknown sender: ‘" ++ ident ++ "’" 68 unless (ident `elem` identities) . die $ "Unknown sender: ‘" ++ ident ++ "’"
69 subscribers <- getSubscribers 69 subscribers <- getSubscribers
70 unless (recipient `elem` subscribers) . die $ "Unknown recipient: ‘" ++ recipient ++ "’" 70 unless (recipient `elem` subscribers) . die $ "Unknown recipient: ‘" ++ recipient ++ "’"