module Test.Marionette.WebAuthn where
import Data.Aeson.Types
import Data.Text (Text)
import GHC.Generics (Generic)
import Prelude
newtype AuthenticatorId = AuthenticatorId Text
deriving stock (Int -> AuthenticatorId -> ShowS
[AuthenticatorId] -> ShowS
AuthenticatorId -> String
(Int -> AuthenticatorId -> ShowS)
-> (AuthenticatorId -> String)
-> ([AuthenticatorId] -> ShowS)
-> Show AuthenticatorId
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> AuthenticatorId -> ShowS
showsPrec :: Int -> AuthenticatorId -> ShowS
$cshow :: AuthenticatorId -> String
show :: AuthenticatorId -> String
$cshowList :: [AuthenticatorId] -> ShowS
showList :: [AuthenticatorId] -> ShowS
Show, AuthenticatorId -> AuthenticatorId -> Bool
(AuthenticatorId -> AuthenticatorId -> Bool)
-> (AuthenticatorId -> AuthenticatorId -> Bool)
-> Eq AuthenticatorId
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: AuthenticatorId -> AuthenticatorId -> Bool
== :: AuthenticatorId -> AuthenticatorId -> Bool
$c/= :: AuthenticatorId -> AuthenticatorId -> Bool
/= :: AuthenticatorId -> AuthenticatorId -> Bool
Eq, (forall x. AuthenticatorId -> Rep AuthenticatorId x)
-> (forall x. Rep AuthenticatorId x -> AuthenticatorId)
-> Generic AuthenticatorId
forall x. Rep AuthenticatorId x -> AuthenticatorId
forall x. AuthenticatorId -> Rep AuthenticatorId x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. AuthenticatorId -> Rep AuthenticatorId x
from :: forall x. AuthenticatorId -> Rep AuthenticatorId x
$cto :: forall x. Rep AuthenticatorId x -> AuthenticatorId
to :: forall x. Rep AuthenticatorId x -> AuthenticatorId
Generic)
deriving newtype (Maybe AuthenticatorId
Value -> Parser [AuthenticatorId]
Value -> Parser AuthenticatorId
(Value -> Parser AuthenticatorId)
-> (Value -> Parser [AuthenticatorId])
-> Maybe AuthenticatorId
-> FromJSON AuthenticatorId
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser AuthenticatorId
parseJSON :: Value -> Parser AuthenticatorId
$cparseJSONList :: Value -> Parser [AuthenticatorId]
parseJSONList :: Value -> Parser [AuthenticatorId]
$comittedField :: Maybe AuthenticatorId
omittedField :: Maybe AuthenticatorId
FromJSON, [AuthenticatorId] -> Value
[AuthenticatorId] -> Encoding
AuthenticatorId -> Bool
AuthenticatorId -> Value
AuthenticatorId -> Encoding
(AuthenticatorId -> Value)
-> (AuthenticatorId -> Encoding)
-> ([AuthenticatorId] -> Value)
-> ([AuthenticatorId] -> Encoding)
-> (AuthenticatorId -> Bool)
-> ToJSON AuthenticatorId
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: AuthenticatorId -> Value
toJSON :: AuthenticatorId -> Value
$ctoEncoding :: AuthenticatorId -> Encoding
toEncoding :: AuthenticatorId -> Encoding
$ctoJSONList :: [AuthenticatorId] -> Value
toJSONList :: [AuthenticatorId] -> Value
$ctoEncodingList :: [AuthenticatorId] -> Encoding
toEncodingList :: [AuthenticatorId] -> Encoding
$comitField :: AuthenticatorId -> Bool
omitField :: AuthenticatorId -> Bool
ToJSON)
newtype CredentialId = CredentialId Text
deriving stock (Int -> CredentialId -> ShowS
[CredentialId] -> ShowS
CredentialId -> String
(Int -> CredentialId -> ShowS)
-> (CredentialId -> String)
-> ([CredentialId] -> ShowS)
-> Show CredentialId
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CredentialId -> ShowS
showsPrec :: Int -> CredentialId -> ShowS
$cshow :: CredentialId -> String
show :: CredentialId -> String
$cshowList :: [CredentialId] -> ShowS
showList :: [CredentialId] -> ShowS
Show, CredentialId -> CredentialId -> Bool
(CredentialId -> CredentialId -> Bool)
-> (CredentialId -> CredentialId -> Bool) -> Eq CredentialId
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CredentialId -> CredentialId -> Bool
== :: CredentialId -> CredentialId -> Bool
$c/= :: CredentialId -> CredentialId -> Bool
/= :: CredentialId -> CredentialId -> Bool
Eq, (forall x. CredentialId -> Rep CredentialId x)
-> (forall x. Rep CredentialId x -> CredentialId)
-> Generic CredentialId
forall x. Rep CredentialId x -> CredentialId
forall x. CredentialId -> Rep CredentialId x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. CredentialId -> Rep CredentialId x
from :: forall x. CredentialId -> Rep CredentialId x
$cto :: forall x. Rep CredentialId x -> CredentialId
to :: forall x. Rep CredentialId x -> CredentialId
Generic)
deriving newtype (Maybe CredentialId
Value -> Parser [CredentialId]
Value -> Parser CredentialId
(Value -> Parser CredentialId)
-> (Value -> Parser [CredentialId])
-> Maybe CredentialId
-> FromJSON CredentialId
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser CredentialId
parseJSON :: Value -> Parser CredentialId
$cparseJSONList :: Value -> Parser [CredentialId]
parseJSONList :: Value -> Parser [CredentialId]
$comittedField :: Maybe CredentialId
omittedField :: Maybe CredentialId
FromJSON, [CredentialId] -> Value
[CredentialId] -> Encoding
CredentialId -> Bool
CredentialId -> Value
CredentialId -> Encoding
(CredentialId -> Value)
-> (CredentialId -> Encoding)
-> ([CredentialId] -> Value)
-> ([CredentialId] -> Encoding)
-> (CredentialId -> Bool)
-> ToJSON CredentialId
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: CredentialId -> Value
toJSON :: CredentialId -> Value
$ctoEncoding :: CredentialId -> Encoding
toEncoding :: CredentialId -> Encoding
$ctoJSONList :: [CredentialId] -> Value
toJSONList :: [CredentialId] -> Value
$ctoEncodingList :: [CredentialId] -> Encoding
toEncodingList :: [CredentialId] -> Encoding
$comitField :: CredentialId -> Bool
omitField :: CredentialId -> Bool
ToJSON)
data VirtualAuthenticator = VirtualAuthenticator
{ VirtualAuthenticator -> Text
protocol :: Text
, VirtualAuthenticator -> Text
transport :: Text
, VirtualAuthenticator -> Bool
hasResidentKey :: Bool
, VirtualAuthenticator -> Bool
hasUserVerification :: Bool
, VirtualAuthenticator -> Bool
isUserConsenting :: Bool
, VirtualAuthenticator -> Bool
isUserVerified :: Bool
, VirtualAuthenticator -> Maybe [Text]
extensions :: Maybe [Text]
, VirtualAuthenticator -> Maybe Bool
uvm :: Maybe Bool
}
deriving stock (Int -> VirtualAuthenticator -> ShowS
[VirtualAuthenticator] -> ShowS
VirtualAuthenticator -> String
(Int -> VirtualAuthenticator -> ShowS)
-> (VirtualAuthenticator -> String)
-> ([VirtualAuthenticator] -> ShowS)
-> Show VirtualAuthenticator
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> VirtualAuthenticator -> ShowS
showsPrec :: Int -> VirtualAuthenticator -> ShowS
$cshow :: VirtualAuthenticator -> String
show :: VirtualAuthenticator -> String
$cshowList :: [VirtualAuthenticator] -> ShowS
showList :: [VirtualAuthenticator] -> ShowS
Show, VirtualAuthenticator -> VirtualAuthenticator -> Bool
(VirtualAuthenticator -> VirtualAuthenticator -> Bool)
-> (VirtualAuthenticator -> VirtualAuthenticator -> Bool)
-> Eq VirtualAuthenticator
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: VirtualAuthenticator -> VirtualAuthenticator -> Bool
== :: VirtualAuthenticator -> VirtualAuthenticator -> Bool
$c/= :: VirtualAuthenticator -> VirtualAuthenticator -> Bool
/= :: VirtualAuthenticator -> VirtualAuthenticator -> Bool
Eq, (forall x. VirtualAuthenticator -> Rep VirtualAuthenticator x)
-> (forall x. Rep VirtualAuthenticator x -> VirtualAuthenticator)
-> Generic VirtualAuthenticator
forall x. Rep VirtualAuthenticator x -> VirtualAuthenticator
forall x. VirtualAuthenticator -> Rep VirtualAuthenticator x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. VirtualAuthenticator -> Rep VirtualAuthenticator x
from :: forall x. VirtualAuthenticator -> Rep VirtualAuthenticator x
$cto :: forall x. Rep VirtualAuthenticator x -> VirtualAuthenticator
to :: forall x. Rep VirtualAuthenticator x -> VirtualAuthenticator
Generic)
instance ToJSON VirtualAuthenticator where
toJSON :: VirtualAuthenticator -> Value
toJSON = Options -> VirtualAuthenticator -> Value
forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
genericToJSON Options
defaultOptions{omitNothingFields = True}
data Credential = Credential
{ Credential -> CredentialId
credentialId :: CredentialId
, Credential -> Bool
isResidentCredential :: Bool
, Credential -> Text
rpId :: Text
, Credential -> Text
privateKey :: Text
, Credential -> Maybe Text
userHandle :: Maybe Text
, Credential -> Int
signCount :: Int
}
deriving stock (Int -> Credential -> ShowS
[Credential] -> ShowS
Credential -> String
(Int -> Credential -> ShowS)
-> (Credential -> String)
-> ([Credential] -> ShowS)
-> Show Credential
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Credential -> ShowS
showsPrec :: Int -> Credential -> ShowS
$cshow :: Credential -> String
show :: Credential -> String
$cshowList :: [Credential] -> ShowS
showList :: [Credential] -> ShowS
Show, Credential -> Credential -> Bool
(Credential -> Credential -> Bool)
-> (Credential -> Credential -> Bool) -> Eq Credential
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Credential -> Credential -> Bool
== :: Credential -> Credential -> Bool
$c/= :: Credential -> Credential -> Bool
/= :: Credential -> Credential -> Bool
Eq, (forall x. Credential -> Rep Credential x)
-> (forall x. Rep Credential x -> Credential) -> Generic Credential
forall x. Rep Credential x -> Credential
forall x. Credential -> Rep Credential x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. Credential -> Rep Credential x
from :: forall x. Credential -> Rep Credential x
$cto :: forall x. Rep Credential x -> Credential
to :: forall x. Rep Credential x -> Credential
Generic)
deriving anyclass (Maybe Credential
Value -> Parser [Credential]
Value -> Parser Credential
(Value -> Parser Credential)
-> (Value -> Parser [Credential])
-> Maybe Credential
-> FromJSON Credential
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser Credential
parseJSON :: Value -> Parser Credential
$cparseJSONList :: Value -> Parser [Credential]
parseJSONList :: Value -> Parser [Credential]
$comittedField :: Maybe Credential
omittedField :: Maybe Credential
FromJSON)
instance ToJSON Credential where
toJSON :: Credential -> Value
toJSON = Options -> Credential -> Value
forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
genericToJSON Options
defaultOptions{omitNothingFields = True}