summaryrefslogtreecommitdiff
path: root/src/Attach.hs
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2020-03-21 21:35:46 +0100
committerRoman Smrž <roman.smrz@seznam.cz>2020-03-21 21:35:46 +0100
commitbc47aa7472e05b810339752da4d34bc04d37ef72 (patch)
treed7e94c2694198a1f0a061237da8fe145ee96620f /src/Attach.hs
parent38a22490180c5e98d5ad105938a89ff31f29d349 (diff)
Generation number for stored objects
Diffstat (limited to 'src/Attach.hs')
-rw-r--r--src/Attach.hs7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/Attach.hs b/src/Attach.hs
index 2ce6110..761da0f 100644
--- a/src/Attach.hs
+++ b/src/Attach.hs
@@ -6,14 +6,12 @@ module Attach (
import Control.Monad.Except
import Control.Monad.Reader
-import Crypto.Hash
import Crypto.Random
import Data.Bits
import Data.ByteArray (Bytes, ScrubbedBytes, convert)
import qualified Data.ByteArray as BA
import qualified Data.ByteString.Char8 as BC
-import qualified Data.ByteString.Lazy as BL
import Data.Maybe
import qualified Data.Text as T
import Data.Word
@@ -60,7 +58,7 @@ instance Storable AttachService where
skeys <- loadBinaries "skey"
(decline :: Maybe T.Text) <- loadMbText "decline"
let res = catMaybes
- [ AttachRequest <$> (digestFromByteString =<< req)
+ [ AttachRequest <$> (refDigestFromByteString =<< req)
, AttachResponse <$> rsp
, AttachRequestNonce <$> rnonce
, AttachIdentity <$> aid <*> pure skeys
@@ -183,8 +181,7 @@ attachAccept printMsg self peer = do
nonceDigest :: UnifiedIdentity -> UnifiedIdentity -> Bytes -> Bytes -> RefDigest
-nonceDigest id1 id2 nonce1 nonce2 = hashFinalize $ hashUpdates hashInit $
- BL.toChunks $ serializeObject $ Rec
+nonceDigest id1 id2 nonce1 nonce2 = hashToRefDigest $ serializeObject $ Rec
[ (BC.pack "id", RecRef $ storedRef $ idData id1)
, (BC.pack "id", RecRef $ storedRef $ idData id2)
, (BC.pack "nonce", RecBinary $ convert nonce1)