-- | This main module provides APIs for QUIC servers.
module Network.QUIC.Server (
    -- * Running a QUIC server
    run,
    stop,

    -- * Configuration
    ServerConfig,
    defaultServerConfig,
    scAddresses,
    scALPN,
    scRequireRetry,
    scUse0RTT,
    scCiphers,
    scGroups,
    scVersions,
    --   , scParameters
    scCredentials,
    scSessionManager,

    -- * Certificate
    clientCertificateChain,
) where

import Data.X509 (CertificateChain)

import Network.QUIC.Config
import Network.QUIC.Connection
import Network.QUIC.Connector
import Network.QUIC.Server.Run

----------------------------------------------------------------

-- | Getting a certificate chain of a client.
clientCertificateChain :: Connection -> IO (Maybe CertificateChain)
clientCertificateChain :: Connection -> IO (Maybe CertificateChain)
clientCertificateChain Connection
conn
    | Connection -> Bool
forall a. Connector a => a -> Bool
isClient Connection
conn = Maybe CertificateChain -> IO (Maybe CertificateChain)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe CertificateChain
forall a. Maybe a
Nothing
    | Bool
otherwise = Connection -> IO (Maybe CertificateChain)
getCertificateChain Connection
conn