diff options
Diffstat (limited to 'kiki.hs')
-rw-r--r-- | kiki.hs | 33 |
1 files changed, 32 insertions, 1 deletions
@@ -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 | ||
1557 | kiki "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 () | ||
1565 | kiki "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 | |||
1557 | kiki "tar" args | "--help" `elem` args = do | 1588 | kiki "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 | ] |