{-# LANGUAGE TypeOperators #-}

module Zero.Identification.API
  (
    IdentificationAPI
  , identificationAPI
  ) where

import           Servant.API
import           Data.Text (Text)
import           Data.Proxy (Proxy(..))
import           Zero.SessionToken.Internal (SessionToken)
import           Zero.KeyFetchToken.Internal (KeyFetchToken, KeyFetchState)
import           Zero.Identification.Internal (IdentityAssertion, Certificate)

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

type IdentificationAPI =
       KeyFetchToken :> "account" :> "keys"
         :> Get '[JSON] KeyFetchState

  :<|> SessionToken :> "assert" :> "identity"
         :> ReqBody '[PlainText] Text
         :> Post '[JSON] (Headers '[Header "Set-Cookie" Text] Certificate)

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

identificationAPI :: Proxy IdentificationAPI
identificationAPI = Proxy
