module Network.TLS.PostHandshake
    ( requestCertificate
    , requestCertificateServer
    , postHandshakeAuthWith
    , postHandshakeAuthClientWith
    , postHandshakeAuthServerWith
    ) where
import Network.TLS.Context.Internal
import Network.TLS.IO
import Network.TLS.Struct13
import Network.TLS.Handshake.Common
import Network.TLS.Handshake.Client
import Network.TLS.Handshake.Server
import Control.Monad.State.Strict
requestCertificate :: MonadIO m => Context -> m Bool
requestCertificate ctx =
    liftIO $ withWriteLock ctx $
        checkValid ctx >> ctxDoRequestCertificate ctx ctx
postHandshakeAuthWith :: MonadIO m => Context -> Handshake13 -> m ()
postHandshakeAuthWith ctx hs =
    liftIO $ withWriteLock ctx $ handleException ctx $ ctxDoPostHandshakeAuthWith ctx ctx hs