module System.X509.MacOS (
getSystemCertificateStore,
) where
import Data.Word (Word8)
import Foreign.C.Types
import Foreign.Ptr
import Data.X509.CertificateStore
import System.X509.Common (maybeSSLCertEnvOr, nativeCertificates)
foreign import ccall safe "hs_x509_trusted_certificates"
c_trustedCertificates :: Ptr (Ptr Word8) -> Ptr CSize -> IO CInt
getSystemCertificateStore :: IO CertificateStore
getSystemCertificateStore :: IO CertificateStore
getSystemCertificateStore =
IO CertificateStore -> IO CertificateStore
maybeSSLCertEnvOr (IO CertificateStore -> IO CertificateStore)
-> IO CertificateStore -> IO CertificateStore
forall a b. (a -> b) -> a -> b
$
[SignedCertificate] -> CertificateStore
makeCertificateStore
([SignedCertificate] -> CertificateStore)
-> IO [SignedCertificate] -> IO CertificateStore
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> String
-> (Ptr (Ptr Word8) -> Ptr CSize -> IO CInt)
-> IO [SignedCertificate]
nativeCertificates String
"System.X509.MacOS" Ptr (Ptr Word8) -> Ptr CSize -> IO CInt
c_trustedCertificates