packages feed

shomei-core-0.2.0.0: src/Shomei/Session/Token/Domain.hs

-- | Access tokens and the token pair returned by the auth workflows.
--
-- 'AccessToken' is the signed JWT (produced by the 'Shomei.SigningKey.Signer' port,
-- really signed by EP-4). 'TokenPair' bundles it with the opaque refresh token and the
-- access-token lifetime.
module Shomei.Session.Token.Domain
  ( AccessToken (..),
    TokenPair (..),
  )
where

import Data.Time (NominalDiffTime)
import Shomei.Prelude
import Shomei.Session.RefreshToken.Domain (RefreshToken)

newtype AccessToken = AccessToken Text
  deriving stock (Generic)
  deriving newtype (Eq)

instance Show AccessToken where
  show _ = "AccessToken <redacted>"

data TokenPair = TokenPair
  { accessToken :: !AccessToken,
    refreshToken :: !RefreshToken,
    expiresIn :: !NominalDiffTime
  }
  deriving stock (Generic, Eq, Show)