{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DerivingVia #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableInstances #-}
module Cardano.Crypto.KES.Single (
SingleKES,
VerKeyKES (..),
SignKeyKES (..),
SigKES (..),
) where
import Data.Proxy (Proxy (..))
import GHC.Generics (Generic)
import NoThunks.Class (NoThunks)
import Control.DeepSeq (NFData)
import Control.Exception (assert)
import Control.Monad ((<$!>))
import Cardano.Binary (FromCBOR (..), ToCBOR (..))
import Cardano.Crypto.DSIGN.Class as DSIGN
import Cardano.Crypto.DirectSerialise
import Cardano.Crypto.Hash.Class
import Cardano.Crypto.KES.Class
data SingleKES d
deriving instance NFData (VerKeyDSIGN d) => NFData (VerKeyKES (SingleKES d))
deriving instance NFData (SigDSIGN d) => NFData (SigKES (SingleKES d))
deriving via
(SignKeyDSIGNM d)
instance
NFData (SignKeyDSIGNM d) => NFData (SignKeyKES (SingleKES d))
instance DSIGNMAlgorithm d => KESAlgorithm (SingleKES d) where
type SeedSizeKES (SingleKES d) = SeedSizeDSIGN d
newtype VerKeyKES (SingleKES d) = VerKeySingleKES (VerKeyDSIGN d)
deriving (forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall d x.
Rep (VerKeyKES (SingleKES d)) x -> VerKeyKES (SingleKES d)
forall d x.
VerKeyKES (SingleKES d) -> Rep (VerKeyKES (SingleKES d)) x
$cto :: forall d x.
Rep (VerKeyKES (SingleKES d)) x -> VerKeyKES (SingleKES d)
$cfrom :: forall d x.
VerKeyKES (SingleKES d) -> Rep (VerKeyKES (SingleKES d)) x
Generic)
newtype SigKES (SingleKES d) = SigSingleKES (SigDSIGN d)
deriving (forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall d x. Rep (SigKES (SingleKES d)) x -> SigKES (SingleKES d)
forall d x. SigKES (SingleKES d) -> Rep (SigKES (SingleKES d)) x
$cto :: forall d x. Rep (SigKES (SingleKES d)) x -> SigKES (SingleKES d)
$cfrom :: forall d x. SigKES (SingleKES d) -> Rep (SigKES (SingleKES d)) x
Generic)
newtype SignKeyKES (SingleKES d) = SignKeySingleKES (SignKeyDSIGNM d)
type ContextKES (SingleKES d) = ContextDSIGN d
type Signable (SingleKES d) = DSIGN.Signable d
algorithmNameKES :: forall (proxy :: * -> *). proxy (SingleKES d) -> String
algorithmNameKES proxy (SingleKES d)
_ = forall v (proxy :: * -> *). DSIGNAlgorithm v => proxy v -> String
algorithmNameDSIGN (forall {k} (t :: k). Proxy t
Proxy :: Proxy d) forall a. [a] -> [a] -> [a]
++ String
"_kes_2^0"
totalPeriodsKES :: forall (proxy :: * -> *). proxy (SingleKES d) -> Period
totalPeriodsKES proxy (SingleKES d)
_ = Period
1
verifyKES :: forall a.
(Signable (SingleKES d) a, HasCallStack) =>
ContextKES (SingleKES d)
-> VerKeyKES (SingleKES d)
-> Period
-> a
-> SigKES (SingleKES d)
-> Either String ()
verifyKES ContextKES (SingleKES d)
ctxt (VerKeySingleKES VerKeyDSIGN d
vk) Period
t a
a (SigSingleKES SigDSIGN d
sig) =
forall a. HasCallStack => Bool -> a -> a
assert (Period
t forall a. Eq a => a -> a -> Bool
== Period
0) forall a b. (a -> b) -> a -> b
$
forall v a.
(DSIGNAlgorithm v, Signable v a, HasCallStack) =>
ContextDSIGN v
-> VerKeyDSIGN v -> a -> SigDSIGN v -> Either String ()
verifyDSIGN ContextKES (SingleKES d)
ctxt VerKeyDSIGN d
vk a
a SigDSIGN d
sig
type SizeVerKeyKES (SingleKES d) = SizeVerKeyDSIGN d
type SizeSignKeyKES (SingleKES d) = SizeSignKeyDSIGN d
type SizeSigKES (SingleKES d) = SizeSigDSIGN d
hashVerKeyKES :: forall h.
HashAlgorithm h =>
VerKeyKES (SingleKES d) -> Hash h (VerKeyKES (SingleKES d))
hashVerKeyKES (VerKeySingleKES VerKeyDSIGN d
vk) =
forall h a b. Hash h a -> Hash h b
castHash (forall v h.
(DSIGNAlgorithm v, HashAlgorithm h) =>
VerKeyDSIGN v -> Hash h (VerKeyDSIGN v)
hashVerKeyDSIGN VerKeyDSIGN d
vk)
rawSerialiseVerKeyKES :: VerKeyKES (SingleKES d) -> ByteString
rawSerialiseVerKeyKES (VerKeySingleKES VerKeyDSIGN d
vk) = forall v. DSIGNAlgorithm v => VerKeyDSIGN v -> ByteString
rawSerialiseVerKeyDSIGN VerKeyDSIGN d
vk
rawSerialiseSigKES :: SigKES (SingleKES d) -> ByteString
rawSerialiseSigKES (SigSingleKES SigDSIGN d
sig) = forall v. DSIGNAlgorithm v => SigDSIGN v -> ByteString
rawSerialiseSigDSIGN SigDSIGN d
sig
rawDeserialiseVerKeyKES :: ByteString -> Maybe (VerKeyKES (SingleKES d))
rawDeserialiseVerKeyKES = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall d. VerKeyDSIGN d -> VerKeyKES (SingleKES d)
VerKeySingleKES forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall v. DSIGNAlgorithm v => ByteString -> Maybe (VerKeyDSIGN v)
rawDeserialiseVerKeyDSIGN
{-# INLINE rawDeserialiseVerKeyKES #-}
rawDeserialiseSigKES :: ByteString -> Maybe (SigKES (SingleKES d))
rawDeserialiseSigKES = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall d. SigDSIGN d -> SigKES (SingleKES d)
SigSingleKES forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall v. DSIGNAlgorithm v => ByteString -> Maybe (SigDSIGN v)
rawDeserialiseSigDSIGN
{-# INLINE rawDeserialiseSigKES #-}
deriveVerKeyKES :: forall (m :: * -> *).
(MonadST m, MonadThrow m) =>
SignKeyKES (SingleKES d) -> m (VerKeyKES (SingleKES d))
deriveVerKeyKES (SignKeySingleKES SignKeyDSIGNM d
v) =
forall d. VerKeyDSIGN d -> VerKeyKES (SingleKES d)
VerKeySingleKES forall (m :: * -> *) a b. Monad m => (a -> b) -> m a -> m b
<$!> forall v (m :: * -> *).
(DSIGNMAlgorithm v, MonadThrow m, MonadST m) =>
SignKeyDSIGNM v -> m (VerKeyDSIGN v)
deriveVerKeyDSIGNM SignKeyDSIGNM d
v
signKES :: forall a (m :: * -> *).
(Signable (SingleKES d) a, MonadST m, MonadThrow m) =>
ContextKES (SingleKES d)
-> Period
-> a
-> SignKeyKES (SingleKES d)
-> m (SigKES (SingleKES d))
signKES ContextKES (SingleKES d)
ctxt Period
t a
a (SignKeySingleKES SignKeyDSIGNM d
sk) =
forall a. HasCallStack => Bool -> a -> a
assert (Period
t forall a. Eq a => a -> a -> Bool
== Period
0) forall a b. (a -> b) -> a -> b
$!
forall d. SigDSIGN d -> SigKES (SingleKES d)
SigSingleKES forall (m :: * -> *) a b. Monad m => (a -> b) -> m a -> m b
<$!> forall v a (m :: * -> *).
(DSIGNMAlgorithm v, Signable v a, MonadST m, MonadThrow m) =>
ContextDSIGN v -> a -> SignKeyDSIGNM v -> m (SigDSIGN v)
signDSIGNM ContextKES (SingleKES d)
ctxt a
a SignKeyDSIGNM d
sk
updateKESWith :: forall (m :: * -> *).
(MonadST m, MonadThrow m) =>
MLockedAllocator m
-> ContextKES (SingleKES d)
-> SignKeyKES (SingleKES d)
-> Period
-> m (Maybe (SignKeyKES (SingleKES d)))
updateKESWith MLockedAllocator m
_allocator ContextKES (SingleKES d)
_ctx (SignKeySingleKES SignKeyDSIGNM d
_sk) Period
_to = forall (m :: * -> *) a. Monad m => a -> m a
return forall a. Maybe a
Nothing
genKeyKESWith :: forall (m :: * -> *).
(MonadST m, MonadThrow m) =>
MLockedAllocator m
-> MLockedSeed (SeedSizeKES (SingleKES d))
-> m (SignKeyKES (SingleKES d))
genKeyKESWith MLockedAllocator m
allocator MLockedSeed (SeedSizeKES (SingleKES d))
seed =
forall d. SignKeyDSIGNM d -> SignKeyKES (SingleKES d)
SignKeySingleKES forall (m :: * -> *) a b. Monad m => (a -> b) -> m a -> m b
<$!> forall v (m :: * -> *).
(DSIGNMAlgorithm v, MonadST m, MonadThrow m) =>
MLockedAllocator m
-> MLockedSeed (SeedSizeDSIGN v) -> m (SignKeyDSIGNM v)
genKeyDSIGNMWith MLockedAllocator m
allocator MLockedSeed (SeedSizeKES (SingleKES d))
seed
forgetSignKeyKESWith :: forall (m :: * -> *).
(MonadST m, MonadThrow m) =>
MLockedAllocator m -> SignKeyKES (SingleKES d) -> m ()
forgetSignKeyKESWith MLockedAllocator m
allocator (SignKeySingleKES SignKeyDSIGNM d
v) =
forall v (m :: * -> *).
(DSIGNMAlgorithm v, MonadST m, MonadThrow m) =>
MLockedAllocator m -> SignKeyDSIGNM v -> m ()
forgetSignKeyDSIGNMWith MLockedAllocator m
allocator SignKeyDSIGNM d
v
instance
( KESAlgorithm (SingleKES d)
, UnsoundDSIGNMAlgorithm d
) =>
UnsoundPureKESAlgorithm (SingleKES d)
where
newtype UnsoundPureSignKeyKES (SingleKES d) = UnsoundPureSignKeySingleKES (SignKeyDSIGN d)
deriving (forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall d x.
Rep (UnsoundPureSignKeyKES (SingleKES d)) x
-> UnsoundPureSignKeyKES (SingleKES d)
forall d x.
UnsoundPureSignKeyKES (SingleKES d)
-> Rep (UnsoundPureSignKeyKES (SingleKES d)) x
$cto :: forall d x.
Rep (UnsoundPureSignKeyKES (SingleKES d)) x
-> UnsoundPureSignKeyKES (SingleKES d)
$cfrom :: forall d x.
UnsoundPureSignKeyKES (SingleKES d)
-> Rep (UnsoundPureSignKeyKES (SingleKES d)) x
Generic)
unsoundPureSignKES :: forall a.
Signable (SingleKES d) a =>
ContextKES (SingleKES d)
-> Period
-> a
-> UnsoundPureSignKeyKES (SingleKES d)
-> SigKES (SingleKES d)
unsoundPureSignKES ContextKES (SingleKES d)
ctxt Period
t a
a (UnsoundPureSignKeySingleKES SignKeyDSIGN d
sk) =
forall a. HasCallStack => Bool -> a -> a
assert (Period
t forall a. Eq a => a -> a -> Bool
== Period
0) forall a b. (a -> b) -> a -> b
$!
forall d. SigDSIGN d -> SigKES (SingleKES d)
SigSingleKES forall a b. (a -> b) -> a -> b
$!
forall v a.
(DSIGNAlgorithm v, Signable v a, HasCallStack) =>
ContextDSIGN v -> a -> SignKeyDSIGN v -> SigDSIGN v
signDSIGN ContextKES (SingleKES d)
ctxt a
a SignKeyDSIGN d
sk
unsoundPureUpdateKES :: ContextKES (SingleKES d)
-> UnsoundPureSignKeyKES (SingleKES d)
-> Period
-> Maybe (UnsoundPureSignKeyKES (SingleKES d))
unsoundPureUpdateKES ContextKES (SingleKES d)
_ctx UnsoundPureSignKeyKES (SingleKES d)
_sk Period
_to = forall a. Maybe a
Nothing
unsoundPureGenKeyKES :: Seed -> UnsoundPureSignKeyKES (SingleKES d)
unsoundPureGenKeyKES Seed
seed =
forall d. SignKeyDSIGN d -> UnsoundPureSignKeyKES (SingleKES d)
UnsoundPureSignKeySingleKES forall a b. (a -> b) -> a -> b
$! forall v. DSIGNAlgorithm v => Seed -> SignKeyDSIGN v
genKeyDSIGN Seed
seed
unsoundPureDeriveVerKeyKES :: UnsoundPureSignKeyKES (SingleKES d) -> VerKeyKES (SingleKES d)
unsoundPureDeriveVerKeyKES (UnsoundPureSignKeySingleKES SignKeyDSIGN d
v) =
forall d. VerKeyDSIGN d -> VerKeyKES (SingleKES d)
VerKeySingleKES forall a b. (a -> b) -> a -> b
$! forall v. DSIGNAlgorithm v => SignKeyDSIGN v -> VerKeyDSIGN v
deriveVerKeyDSIGN SignKeyDSIGN d
v
unsoundPureSignKeyKESToSoundSignKeyKES :: forall (m :: * -> *).
(MonadST m, MonadThrow m) =>
UnsoundPureSignKeyKES (SingleKES d) -> m (SignKeyKES (SingleKES d))
unsoundPureSignKeyKESToSoundSignKeyKES =
forall (m :: * -> *) k.
(MonadST m, MonadThrow m, UnsoundKESAlgorithm k,
UnsoundPureKESAlgorithm k) =>
UnsoundPureSignKeyKES k -> m (SignKeyKES k)
unsoundPureSignKeyKESToSoundSignKeyKESViaSer
rawSerialiseUnsoundPureSignKeyKES :: UnsoundPureSignKeyKES (SingleKES d) -> ByteString
rawSerialiseUnsoundPureSignKeyKES (UnsoundPureSignKeySingleKES SignKeyDSIGN d
sk) =
forall v. DSIGNAlgorithm v => SignKeyDSIGN v -> ByteString
rawSerialiseSignKeyDSIGN SignKeyDSIGN d
sk
rawDeserialiseUnsoundPureSignKeyKES :: ByteString -> Maybe (UnsoundPureSignKeyKES (SingleKES d))
rawDeserialiseUnsoundPureSignKeyKES ByteString
b =
forall d. SignKeyDSIGN d -> UnsoundPureSignKeyKES (SingleKES d)
UnsoundPureSignKeySingleKES forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall v. DSIGNAlgorithm v => ByteString -> Maybe (SignKeyDSIGN v)
rawDeserialiseSignKeyDSIGN ByteString
b
instance
(KESAlgorithm (SingleKES d), UnsoundDSIGNMAlgorithm d) =>
UnsoundKESAlgorithm (SingleKES d)
where
rawSerialiseSignKeyKES :: forall (m :: * -> *).
(MonadST m, MonadThrow m) =>
SignKeyKES (SingleKES d) -> m ByteString
rawSerialiseSignKeyKES (SignKeySingleKES SignKeyDSIGNM d
sk) =
forall v (m :: * -> *).
(UnsoundDSIGNMAlgorithm v, MonadST m, MonadThrow m) =>
SignKeyDSIGNM v -> m ByteString
rawSerialiseSignKeyDSIGNM SignKeyDSIGNM d
sk
rawDeserialiseSignKeyKESWith :: forall (m :: * -> *).
(MonadST m, MonadThrow m) =>
MLockedAllocator m
-> ByteString -> m (Maybe (SignKeyKES (SingleKES d)))
rawDeserialiseSignKeyKESWith MLockedAllocator m
allocator ByteString
bs =
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall d. SignKeyDSIGNM d -> SignKeyKES (SingleKES d)
SignKeySingleKES forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall v (m :: * -> *).
(UnsoundDSIGNMAlgorithm v, MonadST m, MonadThrow m) =>
MLockedAllocator m -> ByteString -> m (Maybe (SignKeyDSIGNM v))
rawDeserialiseSignKeyDSIGNMWith MLockedAllocator m
allocator ByteString
bs
deriving instance DSIGNAlgorithm d => Show (VerKeyKES (SingleKES d))
deriving instance DSIGNAlgorithm d => Eq (VerKeyKES (SingleKES d))
instance DSIGNMAlgorithm d => ToCBOR (VerKeyKES (SingleKES d)) where
toCBOR :: VerKeyKES (SingleKES d) -> Encoding
toCBOR = forall v. KESAlgorithm v => VerKeyKES v -> Encoding
encodeVerKeyKES
encodedSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size)
-> Proxy (VerKeyKES (SingleKES d)) -> Size
encodedSizeExpr forall t. ToCBOR t => Proxy t -> Size
_size = forall v. KESAlgorithm v => Proxy (VerKeyKES v) -> Size
encodedVerKeyKESSizeExpr
instance DSIGNMAlgorithm d => FromCBOR (VerKeyKES (SingleKES d)) where
fromCBOR :: forall s. Decoder s (VerKeyKES (SingleKES d))
fromCBOR = forall v s. KESAlgorithm v => Decoder s (VerKeyKES v)
decodeVerKeyKES
{-# INLINE fromCBOR #-}
instance DSIGNMAlgorithm d => NoThunks (VerKeyKES (SingleKES d))
deriving via (SignKeyDSIGNM d) instance DSIGNMAlgorithm d => NoThunks (SignKeyKES (SingleKES d))
deriving instance DSIGNAlgorithm d => Show (SigKES (SingleKES d))
deriving instance DSIGNAlgorithm d => Eq (SigKES (SingleKES d))
instance DSIGNAlgorithm d => NoThunks (SigKES (SingleKES d))
instance DSIGNMAlgorithm d => ToCBOR (SigKES (SingleKES d)) where
toCBOR :: SigKES (SingleKES d) -> Encoding
toCBOR = forall v. KESAlgorithm v => SigKES v -> Encoding
encodeSigKES
encodedSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size)
-> Proxy (SigKES (SingleKES d)) -> Size
encodedSizeExpr forall t. ToCBOR t => Proxy t -> Size
_size = forall v. KESAlgorithm v => Proxy (SigKES v) -> Size
encodedSigKESSizeExpr
instance DSIGNMAlgorithm d => FromCBOR (SigKES (SingleKES d)) where
fromCBOR :: forall s. Decoder s (SigKES (SingleKES d))
fromCBOR = forall v s. KESAlgorithm v => Decoder s (SigKES v)
decodeSigKES
deriving instance DSIGNAlgorithm d => Show (UnsoundPureSignKeyKES (SingleKES d))
deriving instance Eq (SignKeyDSIGN d) => Eq (UnsoundPureSignKeyKES (SingleKES d))
instance UnsoundDSIGNMAlgorithm d => ToCBOR (UnsoundPureSignKeyKES (SingleKES d)) where
toCBOR :: UnsoundPureSignKeyKES (SingleKES d) -> Encoding
toCBOR = forall v.
UnsoundPureKESAlgorithm v =>
UnsoundPureSignKeyKES v -> Encoding
encodeUnsoundPureSignKeyKES
encodedSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size)
-> Proxy (UnsoundPureSignKeyKES (SingleKES d)) -> Size
encodedSizeExpr forall t. ToCBOR t => Proxy t -> Size
_size Proxy (UnsoundPureSignKeyKES (SingleKES d))
_skProxy = forall v. KESAlgorithm v => Proxy (SignKeyKES v) -> Size
encodedSignKeyKESSizeExpr (forall {k} (t :: k). Proxy t
Proxy :: Proxy (SignKeyKES (SingleKES d)))
instance UnsoundDSIGNMAlgorithm d => FromCBOR (UnsoundPureSignKeyKES (SingleKES d)) where
fromCBOR :: forall s. Decoder s (UnsoundPureSignKeyKES (SingleKES d))
fromCBOR = forall v s.
UnsoundPureKESAlgorithm v =>
Decoder s (UnsoundPureSignKeyKES v)
decodeUnsoundPureSignKeyKES
instance DSIGNAlgorithm d => NoThunks (UnsoundPureSignKeyKES (SingleKES d))
instance DirectSerialise (SignKeyDSIGNM d) => DirectSerialise (SignKeyKES (SingleKES d)) where
directSerialise :: forall (m :: * -> *).
(MonadST m, MonadThrow m) =>
(Ptr CChar -> CSize -> m ()) -> SignKeyKES (SingleKES d) -> m ()
directSerialise Ptr CChar -> CSize -> m ()
push (SignKeySingleKES SignKeyDSIGNM d
sk) = forall a (m :: * -> *).
(DirectSerialise a, MonadST m, MonadThrow m) =>
(Ptr CChar -> CSize -> m ()) -> a -> m ()
directSerialise Ptr CChar -> CSize -> m ()
push SignKeyDSIGNM d
sk
instance DirectDeserialise (SignKeyDSIGNM d) => DirectDeserialise (SignKeyKES (SingleKES d)) where
directDeserialise :: forall (m :: * -> *).
(MonadST m, MonadThrow m) =>
(Ptr CChar -> CSize -> m ()) -> m (SignKeyKES (SingleKES d))
directDeserialise Ptr CChar -> CSize -> m ()
pull = forall d. SignKeyDSIGNM d -> SignKeyKES (SingleKES d)
SignKeySingleKES forall (m :: * -> *) a b. Monad m => (a -> b) -> m a -> m b
<$!> forall a (m :: * -> *).
(DirectDeserialise a, MonadST m, MonadThrow m) =>
(Ptr CChar -> CSize -> m ()) -> m a
directDeserialise Ptr CChar -> CSize -> m ()
pull
instance DirectSerialise (VerKeyDSIGN d) => DirectSerialise (VerKeyKES (SingleKES d)) where
directSerialise :: forall (m :: * -> *).
(MonadST m, MonadThrow m) =>
(Ptr CChar -> CSize -> m ()) -> VerKeyKES (SingleKES d) -> m ()
directSerialise Ptr CChar -> CSize -> m ()
push (VerKeySingleKES VerKeyDSIGN d
sk) = forall a (m :: * -> *).
(DirectSerialise a, MonadST m, MonadThrow m) =>
(Ptr CChar -> CSize -> m ()) -> a -> m ()
directSerialise Ptr CChar -> CSize -> m ()
push VerKeyDSIGN d
sk
instance DirectDeserialise (VerKeyDSIGN d) => DirectDeserialise (VerKeyKES (SingleKES d)) where
directDeserialise :: forall (m :: * -> *).
(MonadST m, MonadThrow m) =>
(Ptr CChar -> CSize -> m ()) -> m (VerKeyKES (SingleKES d))
directDeserialise Ptr CChar -> CSize -> m ()
pull = forall d. VerKeyDSIGN d -> VerKeyKES (SingleKES d)
VerKeySingleKES forall (m :: * -> *) a b. Monad m => (a -> b) -> m a -> m b
<$!> forall a (m :: * -> *).
(DirectDeserialise a, MonadST m, MonadThrow m) =>
(Ptr CChar -> CSize -> m ()) -> m a
directDeserialise Ptr CChar -> CSize -> m ()
pull