diff options
author | Joey Hess <joeyh@joeyh.name> | 2016-09-15 00:26:33 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2016-09-15 00:26:41 -0400 |
commit | 4fc681f78b2e659d3db3da99fe7c640416fb3b43 (patch) | |
tree | 6d20d2864f98d4c3be1814d399bc669524ee6a42 /Types.hs | |
parent | b431fc0fb9d3b4617e4331a549ea02fda236223b (diff) | |
download | keysafe-4fc681f78b2e659d3db3da99fe7c640416fb3b43.tar.gz |
Change format of ~/.keysafe/backup.log
Allow deserializing SecretKeySource so we can later know what gpg keys are
backed up.
Converted KeyId to Text as JSON can't handle ByteString.
Diffstat (limited to 'Types.hs')
-rw-r--r-- | Types.hs | 14 |
1 files changed, 11 insertions, 3 deletions
@@ -9,9 +9,11 @@ module Types where import Types.Cost import qualified Data.ByteString as B +import qualified Data.Text as T import Data.String import Control.DeepSeq import GHC.Generics (Generic) +import Data.Aeson -- | keysafe stores secret keys. newtype SecretKey = SecretKey B.ByteString @@ -53,11 +55,17 @@ newtype Name = Name B.ByteString -- | Source of the secret key stored in keysafe. data SecretKeySource = GpgKey KeyId | KeyFile FilePath - deriving (Show) + deriving (Show, Generic) + +instance ToJSON SecretKeySource +instance FromJSON SecretKeySource -- | The keyid is any value that is unique to a private key, and can be -- looked up somehow without knowing the private key. -- -- A gpg keyid is the obvious example. -data KeyId = KeyId B.ByteString - deriving (Show) +data KeyId = KeyId T.Text + deriving (Show, Generic) + +instance ToJSON KeyId +instance FromJSON KeyId |