-- | Stability: experimental
-- This module represents all the information the Relying Party must store in
-- the database for every credential.
module Crypto.WebAuthn.Operation.CredentialEntry
  ( CredentialEntry (..),
  )
where

import qualified Crypto.WebAuthn.Model.Types as M
import Data.Aeson (ToJSON)
import GHC.Generics (Generic)

-- | This type represents the database row a Relying Party server needs to
-- store for each credential that's registered to a user
data CredentialEntry = CredentialEntry
  { CredentialEntry -> CredentialId
ceCredentialId :: M.CredentialId,
    CredentialEntry -> UserHandle
ceUserHandle :: M.UserHandle,
    CredentialEntry -> PublicKeyBytes
cePublicKeyBytes :: M.PublicKeyBytes,
    CredentialEntry -> SignatureCounter
ceSignCounter :: M.SignatureCounter,
    CredentialEntry -> [AuthenticatorTransport]
ceTransports :: [M.AuthenticatorTransport]
  }
  deriving (CredentialEntry -> CredentialEntry -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CredentialEntry -> CredentialEntry -> Bool
$c/= :: CredentialEntry -> CredentialEntry -> Bool
== :: CredentialEntry -> CredentialEntry -> Bool
$c== :: CredentialEntry -> CredentialEntry -> Bool
Eq, Int -> CredentialEntry -> ShowS
[CredentialEntry] -> ShowS
CredentialEntry -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CredentialEntry] -> ShowS
$cshowList :: [CredentialEntry] -> ShowS
show :: CredentialEntry -> String
$cshow :: CredentialEntry -> String
showsPrec :: Int -> CredentialEntry -> ShowS
$cshowsPrec :: Int -> CredentialEntry -> ShowS
Show, forall x. Rep CredentialEntry x -> CredentialEntry
forall x. CredentialEntry -> Rep CredentialEntry x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CredentialEntry x -> CredentialEntry
$cfrom :: forall x. CredentialEntry -> Rep CredentialEntry x
Generic, [CredentialEntry] -> Encoding
[CredentialEntry] -> Value
CredentialEntry -> Encoding
CredentialEntry -> Value
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
toEncodingList :: [CredentialEntry] -> Encoding
$ctoEncodingList :: [CredentialEntry] -> Encoding
toJSONList :: [CredentialEntry] -> Value
$ctoJSONList :: [CredentialEntry] -> Value
toEncoding :: CredentialEntry -> Encoding
$ctoEncoding :: CredentialEntry -> Encoding
toJSON :: CredentialEntry -> Value
$ctoJSON :: CredentialEntry -> Value
ToJSON)