{-# LANGUAGE StandaloneDeriving #-}
module Crypto.WebAuthn.Metadata.Statement.Types
( MetadataStatement (..),
PNGBytes (..),
WebauthnAttestationType (..),
)
where
import Crypto.WebAuthn.Internal.ToJSONOrphans (PrettyHexByteString (PrettyHexByteString))
import qualified Crypto.WebAuthn.Metadata.FidoRegistry as Registry
import qualified Crypto.WebAuthn.Metadata.Statement.WebIDL as StatementIDL
import qualified Crypto.WebAuthn.Metadata.UAF as UAF
import Data.Aeson (ToJSON)
import qualified Data.ByteString as BS
import Data.List.NonEmpty (NonEmpty)
import Data.Text (Text)
import Data.Word (Word32)
import qualified Data.X509 as X509
import GHC.Generics (Generic)
import GHC.Word (Word16)
data MetadataStatement = MetadataStatement
{
:: Text,
MetadataStatement -> Text
msDescription :: Text,
MetadataStatement -> Maybe AlternativeDescriptions
msAlternativeDescriptions :: Maybe StatementIDL.AlternativeDescriptions,
MetadataStatement -> Word32
msAuthenticatorVersion :: Word32,
MetadataStatement -> NonEmpty Version
msUpv :: NonEmpty UAF.Version,
MetadataStatement -> NonEmpty AuthenticationAlgorithm
msAuthenticationAlgorithms :: NonEmpty Registry.AuthenticationAlgorithm,
MetadataStatement -> NonEmpty PublicKeyRepresentationFormat
msPublicKeyAlgAndEncodings :: NonEmpty Registry.PublicKeyRepresentationFormat,
MetadataStatement -> NonEmpty WebauthnAttestationType
msAttestationTypes :: NonEmpty WebauthnAttestationType,
MetadataStatement -> NonEmpty VerificationMethodANDCombinations
msUserVerificationDetails :: NonEmpty StatementIDL.VerificationMethodANDCombinations,
MetadataStatement -> NonEmpty KeyProtectionType
msKeyProtection :: NonEmpty Registry.KeyProtectionType,
MetadataStatement -> Maybe Bool
msIsKeyRestricted :: Maybe Bool,
MetadataStatement -> Maybe Bool
msIsFreshUserVerificationRequired :: Maybe Bool,
MetadataStatement -> NonEmpty MatcherProtectionType
msMatcherProtection :: NonEmpty Registry.MatcherProtectionType,
MetadataStatement -> Maybe Word16
msCryptoStrength :: Maybe Word16,
MetadataStatement -> NonEmpty AuthenticatorAttachmentHint
msAttachmentHint :: NonEmpty Registry.AuthenticatorAttachmentHint,
MetadataStatement -> [TransactionConfirmationDisplayType]
msTcDisplay :: [Registry.TransactionConfirmationDisplayType],
MetadataStatement -> Maybe Text
msTcDisplayContentType :: Maybe Text,
MetadataStatement
-> Maybe (NonEmpty DisplayPNGCharacteristicsDescriptor)
msTcDisplayPNGCharacteristics :: Maybe (NonEmpty StatementIDL.DisplayPNGCharacteristicsDescriptor),
MetadataStatement -> NonEmpty SignedCertificate
msAttestationRootCertificates :: NonEmpty X509.SignedCertificate,
MetadataStatement -> Maybe PNGBytes
msIcon :: Maybe PNGBytes,
MetadataStatement -> Maybe (NonEmpty ExtensionDescriptor)
msSupportedExtensions :: Maybe (NonEmpty StatementIDL.ExtensionDescriptor),
MetadataStatement -> Maybe AuthenticatorGetInfo
msAuthenticatorGetInfo :: Maybe StatementIDL.AuthenticatorGetInfo
}
deriving (MetadataStatement -> MetadataStatement -> Bool
(MetadataStatement -> MetadataStatement -> Bool)
-> (MetadataStatement -> MetadataStatement -> Bool)
-> Eq MetadataStatement
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: MetadataStatement -> MetadataStatement -> Bool
== :: MetadataStatement -> MetadataStatement -> Bool
$c/= :: MetadataStatement -> MetadataStatement -> Bool
/= :: MetadataStatement -> MetadataStatement -> Bool
Eq, Int -> MetadataStatement -> ShowS
[MetadataStatement] -> ShowS
MetadataStatement -> String
(Int -> MetadataStatement -> ShowS)
-> (MetadataStatement -> String)
-> ([MetadataStatement] -> ShowS)
-> Show MetadataStatement
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> MetadataStatement -> ShowS
showsPrec :: Int -> MetadataStatement -> ShowS
$cshow :: MetadataStatement -> String
show :: MetadataStatement -> String
$cshowList :: [MetadataStatement] -> ShowS
showList :: [MetadataStatement] -> ShowS
Show, (forall x. MetadataStatement -> Rep MetadataStatement x)
-> (forall x. Rep MetadataStatement x -> MetadataStatement)
-> Generic MetadataStatement
forall x. Rep MetadataStatement x -> MetadataStatement
forall x. MetadataStatement -> Rep MetadataStatement x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. MetadataStatement -> Rep MetadataStatement x
from :: forall x. MetadataStatement -> Rep MetadataStatement x
$cto :: forall x. Rep MetadataStatement x -> MetadataStatement
to :: forall x. Rep MetadataStatement x -> MetadataStatement
Generic)
deriving instance ToJSON MetadataStatement
newtype PNGBytes = PNGBytes {PNGBytes -> ByteString
unPNGBytes :: BS.ByteString}
deriving newtype (PNGBytes -> PNGBytes -> Bool
(PNGBytes -> PNGBytes -> Bool)
-> (PNGBytes -> PNGBytes -> Bool) -> Eq PNGBytes
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PNGBytes -> PNGBytes -> Bool
== :: PNGBytes -> PNGBytes -> Bool
$c/= :: PNGBytes -> PNGBytes -> Bool
/= :: PNGBytes -> PNGBytes -> Bool
Eq)
deriving (Int -> PNGBytes -> ShowS
[PNGBytes] -> ShowS
PNGBytes -> String
(Int -> PNGBytes -> ShowS)
-> (PNGBytes -> String) -> ([PNGBytes] -> ShowS) -> Show PNGBytes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PNGBytes -> ShowS
showsPrec :: Int -> PNGBytes -> ShowS
$cshow :: PNGBytes -> String
show :: PNGBytes -> String
$cshowList :: [PNGBytes] -> ShowS
showList :: [PNGBytes] -> ShowS
Show, [PNGBytes] -> Value
[PNGBytes] -> Encoding
PNGBytes -> Value
PNGBytes -> Encoding
(PNGBytes -> Value)
-> (PNGBytes -> Encoding)
-> ([PNGBytes] -> Value)
-> ([PNGBytes] -> Encoding)
-> ToJSON PNGBytes
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
$ctoJSON :: PNGBytes -> Value
toJSON :: PNGBytes -> Value
$ctoEncoding :: PNGBytes -> Encoding
toEncoding :: PNGBytes -> Encoding
$ctoJSONList :: [PNGBytes] -> Value
toJSONList :: [PNGBytes] -> Value
$ctoEncodingList :: [PNGBytes] -> Encoding
toEncodingList :: [PNGBytes] -> Encoding
ToJSON) via PrettyHexByteString
data WebauthnAttestationType
= WebauthnAttestationBasic
| WebauthnAttestationAttCA
deriving (WebauthnAttestationType -> WebauthnAttestationType -> Bool
(WebauthnAttestationType -> WebauthnAttestationType -> Bool)
-> (WebauthnAttestationType -> WebauthnAttestationType -> Bool)
-> Eq WebauthnAttestationType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: WebauthnAttestationType -> WebauthnAttestationType -> Bool
== :: WebauthnAttestationType -> WebauthnAttestationType -> Bool
$c/= :: WebauthnAttestationType -> WebauthnAttestationType -> Bool
/= :: WebauthnAttestationType -> WebauthnAttestationType -> Bool
Eq, Int -> WebauthnAttestationType -> ShowS
[WebauthnAttestationType] -> ShowS
WebauthnAttestationType -> String
(Int -> WebauthnAttestationType -> ShowS)
-> (WebauthnAttestationType -> String)
-> ([WebauthnAttestationType] -> ShowS)
-> Show WebauthnAttestationType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> WebauthnAttestationType -> ShowS
showsPrec :: Int -> WebauthnAttestationType -> ShowS
$cshow :: WebauthnAttestationType -> String
show :: WebauthnAttestationType -> String
$cshowList :: [WebauthnAttestationType] -> ShowS
showList :: [WebauthnAttestationType] -> ShowS
Show, (forall x.
WebauthnAttestationType -> Rep WebauthnAttestationType x)
-> (forall x.
Rep WebauthnAttestationType x -> WebauthnAttestationType)
-> Generic WebauthnAttestationType
forall x. Rep WebauthnAttestationType x -> WebauthnAttestationType
forall x. WebauthnAttestationType -> Rep WebauthnAttestationType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. WebauthnAttestationType -> Rep WebauthnAttestationType x
from :: forall x. WebauthnAttestationType -> Rep WebauthnAttestationType x
$cto :: forall x. Rep WebauthnAttestationType x -> WebauthnAttestationType
to :: forall x. Rep WebauthnAttestationType x -> WebauthnAttestationType
Generic)
deriving instance ToJSON WebauthnAttestationType