jsaddle-dom-0.10.0.0: src/JSDOM/Generated/PublicKeyCredentialCreationOptionsJSON.hs
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from webauthn-4 (webref). Do not edit.
module JSDOM.Generated.PublicKeyCredentialCreationOptionsJSON
(newPublicKeyCredentialCreationOptionsJSON, setRp, getRp, setUser, getUser, setChallenge, getChallenge, setPubKeyCredParams, getPubKeyCredParams, setTimeout, getTimeout, getTimeoutUnsafe, getTimeoutUnchecked, setExcludeCredentials, getExcludeCredentials, getExcludeCredentialsUnsafe, getExcludeCredentialsUnchecked, setAuthenticatorSelection, getAuthenticatorSelection, getAuthenticatorSelectionUnsafe, getAuthenticatorSelectionUnchecked, setHints, getHints, getHintsUnsafe, getHintsUnchecked, setAttestation, getAttestation, getAttestationUnsafe, getAttestationUnchecked, setAttestationFormats, getAttestationFormats, getAttestationFormatsUnsafe, getAttestationFormatsUnchecked, setExtensions, getExtensions, getExtensionsUnsafe, getExtensionsUnchecked, PublicKeyCredentialCreationOptionsJSON(..), gTypePublicKeyCredentialCreationOptionsJSON)
where
import Prelude ((.), (==), (>>=), (<$>), (++), Bool(..), Maybe(..), IO, Int, Word, Double, Float)
import qualified Prelude as P
import Control.Monad (void)
import Control.Lens.Operators ((^.))
import Language.Javascript.JSaddle (JSM, JSVal, JSString, toJSVal, valToBool, valToNumber, js, jss, jsf, jsg, new, function, asyncFunction, jsUndefined, jsNull)
import JSDOM.Types
import qualified JSDOM.Types as Types
import JSDOM.EventTargetClosures (EventName, unsafeEventName, unsafeEventNameAsync)
import JSDOM.Generated.Enums
-- | <https://w3c.github.io/webauthn/#dictdef-publickeycredentialcreationoptionsjson PublicKeyCredentialCreationOptionsJSON specification>
newPublicKeyCredentialCreationOptionsJSON :: (MonadDOM m, ToJSString challenge) => PublicKeyCredentialRpEntity -> PublicKeyCredentialUserEntityJSON -> challenge -> [PublicKeyCredentialParameters] -> m PublicKeyCredentialCreationOptionsJSON
newPublicKeyCredentialCreationOptionsJSON rp user challenge pubKeyCredParams = liftDOM ((((new (jsg "Object") () >>= \o -> (o ^. jss "rp" (toJSVal rp)) P.>> (o ^. jss "user" (toJSVal user)) P.>> (o ^. jss "challenge" (toJSVal challenge)) P.>> (o ^. jss "pubKeyCredParams" (toJSVal pubKeyCredParams)) P.>> P.return o)) >>= fromJSValUnchecked))
-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialcreationoptionsjson-rp PublicKeyCredentialCreationOptionsJSON.rp specification>
setRp :: (MonadDOM m) => PublicKeyCredentialCreationOptionsJSON -> PublicKeyCredentialRpEntity -> m ()
setRp self val = liftDOM (void (self ^. jss "rp" (toJSVal val)))
-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialcreationoptionsjson-rp PublicKeyCredentialCreationOptionsJSON.rp specification>
getRp :: (MonadDOM m) => PublicKeyCredentialCreationOptionsJSON -> m PublicKeyCredentialRpEntity
getRp self = liftDOM (((self ^. js "rp") >>= fromJSValUnchecked))
-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialcreationoptionsjson-user PublicKeyCredentialCreationOptionsJSON.user specification>
setUser :: (MonadDOM m) => PublicKeyCredentialCreationOptionsJSON -> PublicKeyCredentialUserEntityJSON -> m ()
setUser self val = liftDOM (void (self ^. jss "user" (toJSVal val)))
-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialcreationoptionsjson-user PublicKeyCredentialCreationOptionsJSON.user specification>
getUser :: (MonadDOM m) => PublicKeyCredentialCreationOptionsJSON -> m PublicKeyCredentialUserEntityJSON
getUser self = liftDOM (((self ^. js "user") >>= fromJSValUnchecked))
-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialcreationoptionsjson-challenge PublicKeyCredentialCreationOptionsJSON.challenge specification>
setChallenge :: (MonadDOM m, ToJSString val) => PublicKeyCredentialCreationOptionsJSON -> val -> m ()
setChallenge self val = liftDOM (void (self ^. jss "challenge" (toJSVal val)))
-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialcreationoptionsjson-challenge PublicKeyCredentialCreationOptionsJSON.challenge specification>
getChallenge :: (MonadDOM m, FromJSString result) => PublicKeyCredentialCreationOptionsJSON -> m result
getChallenge self = liftDOM (((self ^. js "challenge") >>= fromJSValUnchecked))
-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialcreationoptionsjson-pubkeycredparams PublicKeyCredentialCreationOptionsJSON.pubKeyCredParams specification>
setPubKeyCredParams :: (MonadDOM m) => PublicKeyCredentialCreationOptionsJSON -> [PublicKeyCredentialParameters] -> m ()
setPubKeyCredParams self val = liftDOM (void (self ^. jss "pubKeyCredParams" (toJSVal val)))
-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialcreationoptionsjson-pubkeycredparams PublicKeyCredentialCreationOptionsJSON.pubKeyCredParams specification>
getPubKeyCredParams :: (MonadDOM m) => PublicKeyCredentialCreationOptionsJSON -> m [PublicKeyCredentialParameters]
getPubKeyCredParams self = liftDOM (((self ^. js "pubKeyCredParams") >>= fromJSValUnchecked))
-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialcreationoptionsjson-timeout PublicKeyCredentialCreationOptionsJSON.timeout specification>
setTimeout :: (MonadDOM m) => PublicKeyCredentialCreationOptionsJSON -> Word -> m ()
setTimeout self val = liftDOM (void (self ^. jss "timeout" (toJSVal val)))
-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialcreationoptionsjson-timeout PublicKeyCredentialCreationOptionsJSON.timeout specification>
getTimeout :: (MonadDOM m) => PublicKeyCredentialCreationOptionsJSON -> m (Maybe Word)
getTimeout self = liftDOM (((self ^. js "timeout") >>= fromJSValUnchecked))
-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialcreationoptionsjson-timeout PublicKeyCredentialCreationOptionsJSON.timeout specification>
getTimeoutUnsafe :: (MonadDOM m, HasCallStack) => PublicKeyCredentialCreationOptionsJSON -> m Word
getTimeoutUnsafe self = liftDOM ((((self ^. js "timeout") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialcreationoptionsjson-timeout PublicKeyCredentialCreationOptionsJSON.timeout specification>
getTimeoutUnchecked :: (MonadDOM m) => PublicKeyCredentialCreationOptionsJSON -> m Word
getTimeoutUnchecked self = liftDOM ((P.round <$> ((self ^. js "timeout") >>= valToNumber)))
-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialcreationoptionsjson-excludecredentials PublicKeyCredentialCreationOptionsJSON.excludeCredentials specification>
setExcludeCredentials :: (MonadDOM m) => PublicKeyCredentialCreationOptionsJSON -> [PublicKeyCredentialDescriptorJSON] -> m ()
setExcludeCredentials self val = liftDOM (void (self ^. jss "excludeCredentials" (toJSVal val)))
-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialcreationoptionsjson-excludecredentials PublicKeyCredentialCreationOptionsJSON.excludeCredentials specification>
getExcludeCredentials :: (MonadDOM m) => PublicKeyCredentialCreationOptionsJSON -> m (Maybe [PublicKeyCredentialDescriptorJSON])
getExcludeCredentials self = liftDOM (((self ^. js "excludeCredentials") >>= fromJSValUnchecked))
-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialcreationoptionsjson-excludecredentials PublicKeyCredentialCreationOptionsJSON.excludeCredentials specification>
getExcludeCredentialsUnsafe :: (MonadDOM m, HasCallStack) => PublicKeyCredentialCreationOptionsJSON -> m [PublicKeyCredentialDescriptorJSON]
getExcludeCredentialsUnsafe self = liftDOM ((((self ^. js "excludeCredentials") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialcreationoptionsjson-excludecredentials PublicKeyCredentialCreationOptionsJSON.excludeCredentials specification>
getExcludeCredentialsUnchecked :: (MonadDOM m) => PublicKeyCredentialCreationOptionsJSON -> m [PublicKeyCredentialDescriptorJSON]
getExcludeCredentialsUnchecked self = liftDOM (((self ^. js "excludeCredentials") >>= fromJSValUnchecked))
-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialcreationoptionsjson-authenticatorselection PublicKeyCredentialCreationOptionsJSON.authenticatorSelection specification>
setAuthenticatorSelection :: (MonadDOM m) => PublicKeyCredentialCreationOptionsJSON -> AuthenticatorSelectionCriteria -> m ()
setAuthenticatorSelection self val = liftDOM (void (self ^. jss "authenticatorSelection" (toJSVal val)))
-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialcreationoptionsjson-authenticatorselection PublicKeyCredentialCreationOptionsJSON.authenticatorSelection specification>
getAuthenticatorSelection :: (MonadDOM m) => PublicKeyCredentialCreationOptionsJSON -> m (Maybe AuthenticatorSelectionCriteria)
getAuthenticatorSelection self = liftDOM (((self ^. js "authenticatorSelection") >>= fromJSValUnchecked))
-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialcreationoptionsjson-authenticatorselection PublicKeyCredentialCreationOptionsJSON.authenticatorSelection specification>
getAuthenticatorSelectionUnsafe :: (MonadDOM m, HasCallStack) => PublicKeyCredentialCreationOptionsJSON -> m AuthenticatorSelectionCriteria
getAuthenticatorSelectionUnsafe self = liftDOM ((((self ^. js "authenticatorSelection") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialcreationoptionsjson-authenticatorselection PublicKeyCredentialCreationOptionsJSON.authenticatorSelection specification>
getAuthenticatorSelectionUnchecked :: (MonadDOM m) => PublicKeyCredentialCreationOptionsJSON -> m AuthenticatorSelectionCriteria
getAuthenticatorSelectionUnchecked self = liftDOM (((self ^. js "authenticatorSelection") >>= fromJSValUnchecked))
-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialcreationoptionsjson-hints PublicKeyCredentialCreationOptionsJSON.hints specification>
setHints :: (MonadDOM m, ToJSString val) => PublicKeyCredentialCreationOptionsJSON -> [val] -> m ()
setHints self val = liftDOM (void (self ^. jss "hints" (toJSVal val)))
-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialcreationoptionsjson-hints PublicKeyCredentialCreationOptionsJSON.hints specification>
getHints :: (MonadDOM m, FromJSString result) => PublicKeyCredentialCreationOptionsJSON -> m (Maybe [result])
getHints self = liftDOM (((self ^. js "hints") >>= fromJSValUnchecked))
-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialcreationoptionsjson-hints PublicKeyCredentialCreationOptionsJSON.hints specification>
getHintsUnsafe :: (MonadDOM m, HasCallStack, FromJSString result) => PublicKeyCredentialCreationOptionsJSON -> m [result]
getHintsUnsafe self = liftDOM ((((self ^. js "hints") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialcreationoptionsjson-hints PublicKeyCredentialCreationOptionsJSON.hints specification>
getHintsUnchecked :: (MonadDOM m, FromJSString result) => PublicKeyCredentialCreationOptionsJSON -> m [result]
getHintsUnchecked self = liftDOM (((self ^. js "hints") >>= fromJSValUnchecked))
-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialcreationoptionsjson-attestation PublicKeyCredentialCreationOptionsJSON.attestation specification>
setAttestation :: (MonadDOM m, ToJSString val) => PublicKeyCredentialCreationOptionsJSON -> val -> m ()
setAttestation self val = liftDOM (void (self ^. jss "attestation" (toJSVal val)))
-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialcreationoptionsjson-attestation PublicKeyCredentialCreationOptionsJSON.attestation specification>
getAttestation :: (MonadDOM m, FromJSString result) => PublicKeyCredentialCreationOptionsJSON -> m (Maybe result)
getAttestation self = liftDOM (((self ^. js "attestation") >>= fromMaybeJSString))
-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialcreationoptionsjson-attestation PublicKeyCredentialCreationOptionsJSON.attestation specification>
getAttestationUnsafe :: (MonadDOM m, HasCallStack, FromJSString result) => PublicKeyCredentialCreationOptionsJSON -> m result
getAttestationUnsafe self = liftDOM ((((self ^. js "attestation") >>= fromMaybeJSString) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialcreationoptionsjson-attestation PublicKeyCredentialCreationOptionsJSON.attestation specification>
getAttestationUnchecked :: (MonadDOM m, FromJSString result) => PublicKeyCredentialCreationOptionsJSON -> m result
getAttestationUnchecked self = liftDOM (((self ^. js "attestation") >>= fromJSValUnchecked))
-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialcreationoptionsjson-attestationformats PublicKeyCredentialCreationOptionsJSON.attestationFormats specification>
setAttestationFormats :: (MonadDOM m, ToJSString val) => PublicKeyCredentialCreationOptionsJSON -> [val] -> m ()
setAttestationFormats self val = liftDOM (void (self ^. jss "attestationFormats" (toJSVal val)))
-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialcreationoptionsjson-attestationformats PublicKeyCredentialCreationOptionsJSON.attestationFormats specification>
getAttestationFormats :: (MonadDOM m, FromJSString result) => PublicKeyCredentialCreationOptionsJSON -> m (Maybe [result])
getAttestationFormats self = liftDOM (((self ^. js "attestationFormats") >>= fromJSValUnchecked))
-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialcreationoptionsjson-attestationformats PublicKeyCredentialCreationOptionsJSON.attestationFormats specification>
getAttestationFormatsUnsafe :: (MonadDOM m, HasCallStack, FromJSString result) => PublicKeyCredentialCreationOptionsJSON -> m [result]
getAttestationFormatsUnsafe self = liftDOM ((((self ^. js "attestationFormats") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialcreationoptionsjson-attestationformats PublicKeyCredentialCreationOptionsJSON.attestationFormats specification>
getAttestationFormatsUnchecked :: (MonadDOM m, FromJSString result) => PublicKeyCredentialCreationOptionsJSON -> m [result]
getAttestationFormatsUnchecked self = liftDOM (((self ^. js "attestationFormats") >>= fromJSValUnchecked))
-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialcreationoptionsjson-extensions PublicKeyCredentialCreationOptionsJSON.extensions specification>
setExtensions :: (MonadDOM m) => PublicKeyCredentialCreationOptionsJSON -> AuthenticationExtensionsClientInputsJSON -> m ()
setExtensions self val = liftDOM (void (self ^. jss "extensions" (toJSVal val)))
-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialcreationoptionsjson-extensions PublicKeyCredentialCreationOptionsJSON.extensions specification>
getExtensions :: (MonadDOM m) => PublicKeyCredentialCreationOptionsJSON -> m (Maybe AuthenticationExtensionsClientInputsJSON)
getExtensions self = liftDOM (((self ^. js "extensions") >>= fromJSValUnchecked))
-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialcreationoptionsjson-extensions PublicKeyCredentialCreationOptionsJSON.extensions specification>
getExtensionsUnsafe :: (MonadDOM m, HasCallStack) => PublicKeyCredentialCreationOptionsJSON -> m AuthenticationExtensionsClientInputsJSON
getExtensionsUnsafe self = liftDOM ((((self ^. js "extensions") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialcreationoptionsjson-extensions PublicKeyCredentialCreationOptionsJSON.extensions specification>
getExtensionsUnchecked :: (MonadDOM m) => PublicKeyCredentialCreationOptionsJSON -> m AuthenticationExtensionsClientInputsJSON
getExtensionsUnchecked self = liftDOM (((self ^. js "extensions") >>= fromJSValUnchecked))