jsaddle-dom-0.10.0.0: src/JSDOM/Generated/PublicKeyCredentialCreationOptions.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.PublicKeyCredentialCreationOptions
(newPublicKeyCredentialCreationOptions, 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, PublicKeyCredentialCreationOptions(..), gTypePublicKeyCredentialCreationOptions)
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-publickeycredentialcreationoptions PublicKeyCredentialCreationOptions specification>
newPublicKeyCredentialCreationOptions :: (MonadDOM m, IsBufferSource challenge) => PublicKeyCredentialRpEntity -> PublicKeyCredentialUserEntity -> challenge -> [PublicKeyCredentialParameters] -> m PublicKeyCredentialCreationOptions
newPublicKeyCredentialCreationOptions 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-publickeycredentialcreationoptions-rp PublicKeyCredentialCreationOptions.rp specification>
setRp :: (MonadDOM m) => PublicKeyCredentialCreationOptions -> PublicKeyCredentialRpEntity -> m ()
setRp self val = liftDOM (void (self ^. jss "rp" (toJSVal val)))
-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialcreationoptions-rp PublicKeyCredentialCreationOptions.rp specification>
getRp :: (MonadDOM m) => PublicKeyCredentialCreationOptions -> m PublicKeyCredentialRpEntity
getRp self = liftDOM (((self ^. js "rp") >>= fromJSValUnchecked))
-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialcreationoptions-user PublicKeyCredentialCreationOptions.user specification>
setUser :: (MonadDOM m) => PublicKeyCredentialCreationOptions -> PublicKeyCredentialUserEntity -> m ()
setUser self val = liftDOM (void (self ^. jss "user" (toJSVal val)))
-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialcreationoptions-user PublicKeyCredentialCreationOptions.user specification>
getUser :: (MonadDOM m) => PublicKeyCredentialCreationOptions -> m PublicKeyCredentialUserEntity
getUser self = liftDOM (((self ^. js "user") >>= fromJSValUnchecked))
-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialcreationoptions-challenge PublicKeyCredentialCreationOptions.challenge specification>
setChallenge :: (MonadDOM m, IsBufferSource val) => PublicKeyCredentialCreationOptions -> val -> m ()
setChallenge self val = liftDOM (void (self ^. jss "challenge" (toJSVal val)))
-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialcreationoptions-challenge PublicKeyCredentialCreationOptions.challenge specification>
getChallenge :: (MonadDOM m) => PublicKeyCredentialCreationOptions -> m BufferSource
getChallenge self = liftDOM (((self ^. js "challenge") >>= fromJSValUnchecked))
-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialcreationoptions-pubkeycredparams PublicKeyCredentialCreationOptions.pubKeyCredParams specification>
setPubKeyCredParams :: (MonadDOM m) => PublicKeyCredentialCreationOptions -> [PublicKeyCredentialParameters] -> m ()
setPubKeyCredParams self val = liftDOM (void (self ^. jss "pubKeyCredParams" (toJSVal val)))
-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialcreationoptions-pubkeycredparams PublicKeyCredentialCreationOptions.pubKeyCredParams specification>
getPubKeyCredParams :: (MonadDOM m) => PublicKeyCredentialCreationOptions -> m [PublicKeyCredentialParameters]
getPubKeyCredParams self = liftDOM (((self ^. js "pubKeyCredParams") >>= fromJSValUnchecked))
-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialcreationoptions-timeout PublicKeyCredentialCreationOptions.timeout specification>
setTimeout :: (MonadDOM m) => PublicKeyCredentialCreationOptions -> Word -> m ()
setTimeout self val = liftDOM (void (self ^. jss "timeout" (toJSVal val)))
-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialcreationoptions-timeout PublicKeyCredentialCreationOptions.timeout specification>
getTimeout :: (MonadDOM m) => PublicKeyCredentialCreationOptions -> m (Maybe Word)
getTimeout self = liftDOM (((self ^. js "timeout") >>= fromJSValUnchecked))
-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialcreationoptions-timeout PublicKeyCredentialCreationOptions.timeout specification>
getTimeoutUnsafe :: (MonadDOM m, HasCallStack) => PublicKeyCredentialCreationOptions -> m Word
getTimeoutUnsafe self = liftDOM ((((self ^. js "timeout") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialcreationoptions-timeout PublicKeyCredentialCreationOptions.timeout specification>
getTimeoutUnchecked :: (MonadDOM m) => PublicKeyCredentialCreationOptions -> m Word
getTimeoutUnchecked self = liftDOM ((P.round <$> ((self ^. js "timeout") >>= valToNumber)))
-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialcreationoptions-excludecredentials PublicKeyCredentialCreationOptions.excludeCredentials specification>
setExcludeCredentials :: (MonadDOM m) => PublicKeyCredentialCreationOptions -> [PublicKeyCredentialDescriptor] -> m ()
setExcludeCredentials self val = liftDOM (void (self ^. jss "excludeCredentials" (toJSVal val)))
-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialcreationoptions-excludecredentials PublicKeyCredentialCreationOptions.excludeCredentials specification>
getExcludeCredentials :: (MonadDOM m) => PublicKeyCredentialCreationOptions -> m (Maybe [PublicKeyCredentialDescriptor])
getExcludeCredentials self = liftDOM (((self ^. js "excludeCredentials") >>= fromJSValUnchecked))
-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialcreationoptions-excludecredentials PublicKeyCredentialCreationOptions.excludeCredentials specification>
getExcludeCredentialsUnsafe :: (MonadDOM m, HasCallStack) => PublicKeyCredentialCreationOptions -> m [PublicKeyCredentialDescriptor]
getExcludeCredentialsUnsafe self = liftDOM ((((self ^. js "excludeCredentials") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialcreationoptions-excludecredentials PublicKeyCredentialCreationOptions.excludeCredentials specification>
getExcludeCredentialsUnchecked :: (MonadDOM m) => PublicKeyCredentialCreationOptions -> m [PublicKeyCredentialDescriptor]
getExcludeCredentialsUnchecked self = liftDOM (((self ^. js "excludeCredentials") >>= fromJSValUnchecked))
-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialcreationoptions-authenticatorselection PublicKeyCredentialCreationOptions.authenticatorSelection specification>
setAuthenticatorSelection :: (MonadDOM m) => PublicKeyCredentialCreationOptions -> AuthenticatorSelectionCriteria -> m ()
setAuthenticatorSelection self val = liftDOM (void (self ^. jss "authenticatorSelection" (toJSVal val)))
-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialcreationoptions-authenticatorselection PublicKeyCredentialCreationOptions.authenticatorSelection specification>
getAuthenticatorSelection :: (MonadDOM m) => PublicKeyCredentialCreationOptions -> m (Maybe AuthenticatorSelectionCriteria)
getAuthenticatorSelection self = liftDOM (((self ^. js "authenticatorSelection") >>= fromJSValUnchecked))
-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialcreationoptions-authenticatorselection PublicKeyCredentialCreationOptions.authenticatorSelection specification>
getAuthenticatorSelectionUnsafe :: (MonadDOM m, HasCallStack) => PublicKeyCredentialCreationOptions -> m AuthenticatorSelectionCriteria
getAuthenticatorSelectionUnsafe self = liftDOM ((((self ^. js "authenticatorSelection") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialcreationoptions-authenticatorselection PublicKeyCredentialCreationOptions.authenticatorSelection specification>
getAuthenticatorSelectionUnchecked :: (MonadDOM m) => PublicKeyCredentialCreationOptions -> m AuthenticatorSelectionCriteria
getAuthenticatorSelectionUnchecked self = liftDOM (((self ^. js "authenticatorSelection") >>= fromJSValUnchecked))
-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialcreationoptions-hints PublicKeyCredentialCreationOptions.hints specification>
setHints :: (MonadDOM m, ToJSString val) => PublicKeyCredentialCreationOptions -> [val] -> m ()
setHints self val = liftDOM (void (self ^. jss "hints" (toJSVal val)))
-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialcreationoptions-hints PublicKeyCredentialCreationOptions.hints specification>
getHints :: (MonadDOM m, FromJSString result) => PublicKeyCredentialCreationOptions -> m (Maybe [result])
getHints self = liftDOM (((self ^. js "hints") >>= fromJSValUnchecked))
-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialcreationoptions-hints PublicKeyCredentialCreationOptions.hints specification>
getHintsUnsafe :: (MonadDOM m, HasCallStack, FromJSString result) => PublicKeyCredentialCreationOptions -> m [result]
getHintsUnsafe self = liftDOM ((((self ^. js "hints") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialcreationoptions-hints PublicKeyCredentialCreationOptions.hints specification>
getHintsUnchecked :: (MonadDOM m, FromJSString result) => PublicKeyCredentialCreationOptions -> m [result]
getHintsUnchecked self = liftDOM (((self ^. js "hints") >>= fromJSValUnchecked))
-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialcreationoptions-attestation PublicKeyCredentialCreationOptions.attestation specification>
setAttestation :: (MonadDOM m, ToJSString val) => PublicKeyCredentialCreationOptions -> val -> m ()
setAttestation self val = liftDOM (void (self ^. jss "attestation" (toJSVal val)))
-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialcreationoptions-attestation PublicKeyCredentialCreationOptions.attestation specification>
getAttestation :: (MonadDOM m, FromJSString result) => PublicKeyCredentialCreationOptions -> m (Maybe result)
getAttestation self = liftDOM (((self ^. js "attestation") >>= fromMaybeJSString))
-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialcreationoptions-attestation PublicKeyCredentialCreationOptions.attestation specification>
getAttestationUnsafe :: (MonadDOM m, HasCallStack, FromJSString result) => PublicKeyCredentialCreationOptions -> m result
getAttestationUnsafe self = liftDOM ((((self ^. js "attestation") >>= fromMaybeJSString) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialcreationoptions-attestation PublicKeyCredentialCreationOptions.attestation specification>
getAttestationUnchecked :: (MonadDOM m, FromJSString result) => PublicKeyCredentialCreationOptions -> m result
getAttestationUnchecked self = liftDOM (((self ^. js "attestation") >>= fromJSValUnchecked))
-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialcreationoptions-attestationformats PublicKeyCredentialCreationOptions.attestationFormats specification>
setAttestationFormats :: (MonadDOM m, ToJSString val) => PublicKeyCredentialCreationOptions -> [val] -> m ()
setAttestationFormats self val = liftDOM (void (self ^. jss "attestationFormats" (toJSVal val)))
-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialcreationoptions-attestationformats PublicKeyCredentialCreationOptions.attestationFormats specification>
getAttestationFormats :: (MonadDOM m, FromJSString result) => PublicKeyCredentialCreationOptions -> m (Maybe [result])
getAttestationFormats self = liftDOM (((self ^. js "attestationFormats") >>= fromJSValUnchecked))
-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialcreationoptions-attestationformats PublicKeyCredentialCreationOptions.attestationFormats specification>
getAttestationFormatsUnsafe :: (MonadDOM m, HasCallStack, FromJSString result) => PublicKeyCredentialCreationOptions -> m [result]
getAttestationFormatsUnsafe self = liftDOM ((((self ^. js "attestationFormats") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialcreationoptions-attestationformats PublicKeyCredentialCreationOptions.attestationFormats specification>
getAttestationFormatsUnchecked :: (MonadDOM m, FromJSString result) => PublicKeyCredentialCreationOptions -> m [result]
getAttestationFormatsUnchecked self = liftDOM (((self ^. js "attestationFormats") >>= fromJSValUnchecked))
-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialcreationoptions-extensions PublicKeyCredentialCreationOptions.extensions specification>
setExtensions :: (MonadDOM m) => PublicKeyCredentialCreationOptions -> AuthenticationExtensionsClientInputs -> m ()
setExtensions self val = liftDOM (void (self ^. jss "extensions" (toJSVal val)))
-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialcreationoptions-extensions PublicKeyCredentialCreationOptions.extensions specification>
getExtensions :: (MonadDOM m) => PublicKeyCredentialCreationOptions -> m (Maybe AuthenticationExtensionsClientInputs)
getExtensions self = liftDOM (((self ^. js "extensions") >>= fromJSValUnchecked))
-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialcreationoptions-extensions PublicKeyCredentialCreationOptions.extensions specification>
getExtensionsUnsafe :: (MonadDOM m, HasCallStack) => PublicKeyCredentialCreationOptions -> m AuthenticationExtensionsClientInputs
getExtensionsUnsafe self = liftDOM ((((self ^. js "extensions") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialcreationoptions-extensions PublicKeyCredentialCreationOptions.extensions specification>
getExtensionsUnchecked :: (MonadDOM m) => PublicKeyCredentialCreationOptions -> m AuthenticationExtensionsClientInputs
getExtensionsUnchecked self = liftDOM (((self ^. js "extensions") >>= fromJSValUnchecked))