From 0afe2e6177b48078db381d26334d3f4fd13363da Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 19 Aug 2016 16:36:46 -0400 Subject: chunking This changed the storage format, not that it matters because nobody is using it yet. --- Types.hs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'Types.hs') 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 -- cgit v1.2.3