summaryrefslogtreecommitdiff
path: root/kiki.hs
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2016-08-31 22:16:21 -0400
committerjoe <joe@jerkface.net>2016-08-31 22:16:21 -0400
commitd8950d3ccdf51f308aa93f06c16f26b15a6c55c4 (patch)
treea44064fbfc52d5ca1d51cfd0229625c6049bbfa0 /kiki.hs
parentfae3728a6b7e8ee13ed009e7c9cf3918eb4b89d7 (diff)
New command to rename subkeys.
Diffstat (limited to 'kiki.hs')
-rw-r--r--kiki.hs33
1 files changed, 32 insertions, 1 deletions
diff --git a/kiki.hs b/kiki.hs
index 5c27c36..9796c3d 100644
--- a/kiki.hs
+++ b/kiki.hs
@@ -1554,6 +1554,37 @@ kiki "delete" args = do
1554 forM_ report $ \(fname,act) -> do 1554 forM_ report $ \(fname,act) -> do
1555 putStrLn $ fname ++ ": " ++ reportString act 1555 putStrLn $ fname ++ ": " ++ reportString act
1556 1556
1557kiki "rename" args | "--help" `elem` args = do
1558 putStr . unlines $
1559 [ "kiki rename [--homedir <home>] [--passphrase-fd <fd>] <old-tag> <new-tag>"
1560 , ""
1561 , " Reassigns a key usage tag from old-tag to new-tag."
1562 , " The old signature will be replaced and a new one formed."
1563 ]
1564 return ()
1565kiki "rename" args = do
1566 let (sargs,margs) = processArgs sargspec polyVariadicArgs "--rename" args
1567 where sargspec = [("--homedir",1)]
1568 polyVariadicArgs = ["--rename"]
1569 passfd = fmap (FileDesc . read) passphrase_fd
1570 where passphrase_fd = concat <$> Map.lookup "--passphrase-fd" margs
1571 (oldtag:newtag:_) = fromMaybe [] $ Map.lookup "--rename" margs
1572 homespec = join . take 1 <$> Map.lookup "--homedir" margs
1573 kikiOp = KeyRingOperation
1574 { opFiles = Map.fromList $
1575 [ ( HomeSec, buildStreamInfo KF_All KeyRingFile )
1576 , ( HomePub, buildStreamInfo KF_All KeyRingFile )
1577 ]
1578 , opPassphrases = withAgent $ do pfile <- maybeToList passfd
1579 return $ PassphraseSpec Nothing Nothing pfile
1580 , opTransforms = [ RenameSubkeys oldtag newtag]
1581 , opHome = homespec
1582 }
1583 KikiResult rt report <- runKeyRing kikiOp
1584 forM_ report $ \(fname,act) -> do
1585 putStrLn $ fname ++ ": " ++ reportString act
1586
1587
1557kiki "tar" args | "--help" `elem` args = do 1588kiki "tar" args | "--help" `elem` args = do
1558 putStr . unlines $ 1589 putStr . unlines $
1559 [ "kiki tar (-c|-t) [--secrets SPEC] [--passphrase-fd FD] [--homedir HOMEDIR]" 1590 [ "kiki tar (-c|-t) [--secrets SPEC] [--passphrase-fd FD] [--homedir HOMEDIR]"
@@ -1752,7 +1783,7 @@ commands =
1752 -- , ( "init-key", "initialize the samizdat key ring") 1783 -- , ( "init-key", "initialize the samizdat key ring")
1753 , ( "init", "Initialize kiki") 1784 , ( "init", "Initialize kiki")
1754 , ( "delete", "Delete a subkey and its associated signatures" ) 1785 , ( "delete", "Delete a subkey and its associated signatures" )
1755 -- TODO: , ( "rename", "Change the usage tag on a specified subkey" ) 1786 , ( "rename", "Change the usage tag on a specified subkey" )
1756 -- also repairs signature and adds missing cross-certification. 1787 -- also repairs signature and adds missing cross-certification.
1757 , ( "tar", "import or export system key files in tar format" ) 1788 , ( "tar", "import or export system key files in tar format" )
1758 ] 1789 ]