summaryrefslogtreecommitdiffhomepage
path: root/Types.hs
diff options
context:
space:
mode:
authorJoey Hess <joeyh@joeyh.name>2016-08-19 16:36:46 -0400
committerJoey Hess <joeyh@joeyh.name>2016-08-19 16:36:46 -0400
commit0afe2e6177b48078db381d26334d3f4fd13363da (patch)
treece23c42a9273394c0738978a6e0724d69b90777a /Types.hs
parentfdc80b7a2416782d3208acf154fb8afb7fb2279b (diff)
downloadkeysafe-0afe2e6177b48078db381d26334d3f4fd13363da.tar.gz
chunking
This changed the storage format, not that it matters because nobody is using it yet.
Diffstat (limited to 'Types.hs')
-rw-r--r--Types.hs13
1 files changed, 7 insertions, 6 deletions
diff --git a/Types.hs b/Types.hs
index e7dbe1e..e66e3b2 100644
--- a/Types.hs
+++ b/Types.hs
@@ -15,28 +15,29 @@ import Control.DeepSeq
-- | keysafe stores secret keys.
newtype SecretKey = SecretKey B.ByteString
--- | The secret key, encrypted with a password.
-data EncryptedSecretKey = EncryptedSecretKey B.ByteString (CostCalc BruteForceOp UnknownPassword)
+-- | The secret key, encrypted with a password, in fixed size chunks.
+data EncryptedSecretKey = EncryptedSecretKey [B.ByteString] (CostCalc BruteForceOp UnknownPassword)
instance NFData EncryptedSecretKey where
- rnf (EncryptedSecretKey bs _) = rnf bs
+ rnf (EncryptedSecretKey cs _) = rnf cs
instance Show EncryptedSecretKey where
- show (EncryptedSecretKey bs _) = show bs
+ show (EncryptedSecretKey cs _) = show cs
instance Bruteforceable EncryptedSecretKey UnknownPassword where
getBruteCostCalc (EncryptedSecretKey _ cc) = cc
-- | An object in a form suitable to be stored on a keysafe server.
newtype StorableObject = StorableObject { fromStorableObject :: B.ByteString }
- deriving (Show)
+ deriving (Show, Eq, Ord)
-- | An identifier for a StorableObject
newtype StorableObjectIdent = StorableObjectIdent B.ByteString
- deriving (Show, NFData)
+ deriving (Show, Eq, Ord, NFData)
-- | A Shamir secret share, with a known number (N of M).
data Share = Share ShareNum StorableObject
+ deriving (Eq, Ord)
type ShareNum = Int