summaryrefslogtreecommitdiffhomepage
path: root/Types.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Types.hs')
-rw-r--r--Types.hs14
1 files changed, 11 insertions, 3 deletions
diff --git a/Types.hs b/Types.hs
index 2ab5d6c..c065da3 100644
--- a/Types.hs
+++ b/Types.hs
@@ -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