summaryrefslogtreecommitdiff
path: root/src/Propellor/Property/Gpg.hs
diff options
context:
space:
mode:
authorJoey Hess2014-11-15 17:02:25 -0400
committerJoey Hess2014-11-15 17:02:30 -0400
commit8d91b5de6b43333ba77974053cdcdfa87409fb62 (patch)
tree61f3ed9063234b6fc93ad6e05de7e1761fd1cbd5 /src/Propellor/Property/Gpg.hs
parent7902f705b0ba9c88e23fbe6023b293b838a56127 (diff)
Convert GpgKeyId to newtype
Diffstat (limited to 'src/Propellor/Property/Gpg.hs')
-rw-r--r--src/Propellor/Property/Gpg.hs8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/Propellor/Property/Gpg.hs b/src/Propellor/Property/Gpg.hs
index b4698663..5819ea7b 100644
--- a/src/Propellor/Property/Gpg.hs
+++ b/src/Propellor/Property/Gpg.hs
@@ -9,7 +9,8 @@ import System.PosixCompat
installed :: Property
installed = Apt.installed ["gnupg"]
-type GpgKeyId = String
+-- A numeric id, or a description of the key, in a form understood by gpg.
+newtype GpgKeyId = GpgKeyId { getGpgKeyId :: String }
-- | Sets up a user with a gpg key from the privdata.
--
@@ -19,11 +20,8 @@ type GpgKeyId = String
--
-- Recommend only using this for low-value dedicated role keys.
-- No attempt has been made to scrub the key out of memory once it's used.
---
--- The GpgKeyId does not have to be a numeric id; it can just as easily
--- be a description of the key.
keyImported :: GpgKeyId -> UserName -> Property
-keyImported keyid user = flagFile' prop genflag
+keyImported (GpgKeyId keyid) user = flagFile' prop genflag
`requires` installed
where
desc = user ++ " has gpg key " ++ show keyid