packages feed

ghcjs-dom-javascript-0.10.0.0: src/GHCJS/DOM/JSFFI/Generated/SubtleCrypto.hs

{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ForeignFunctionInterface, JavaScriptFFI #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from webcrypto-2 (webref). Do not edit.
module GHCJS.DOM.JSFFI.Generated.SubtleCrypto
       (js_decrypt, js_deriveBits, js_deriveKey, js_digest, js_encrypt, js_exportKey, js_generateKey, js_importKey, js_sign, js_unwrapKey, js_verify, js_wrapKey, decrypt, decrypt_, deriveBits, deriveBits_, deriveKey, deriveKey_, digest, digest_, encrypt, encrypt_, exportKey, exportKey_, generateKey, generateKey_, importKey, importKey_, sign, sign_, unwrapKey, unwrapKey_, verify, verify_, wrapKey, wrapKey_, SubtleCrypto(..), gTypeSubtleCrypto)
       where
import Prelude ((.), (==), (>>=), (<$>), (++), Bool(..), Maybe(..), IO, Int, Word, Double, Float)
import qualified Prelude as P
import Control.Monad (void)
import GHCJS.Types (JSVal, JSString)
import GHCJS.Foreign (jsUndefined, jsNull)
import GHCJS.DOM.Types
import qualified GHCJS.DOM.Types as Types
import GHCJS.DOM.EventTargetClosures (EventName, unsafeEventName, unsafeEventNameAsync)
import GHCJS.DOM.JSFFI.Generated.Enums

foreign import javascript interruptible "(($1, $2, $3, $4, $c) => { return $1[\"decrypt\"]($2, $3, $4).then(function(s) { $c(null, s);}, function(e) { $c(e, null);}); })"
        js_decrypt :: SubtleCrypto -> AlgorithmIdentifier -> CryptoKey -> BufferSource -> IO (JSVal, ArrayBuffer)
-- | <https://developer.mozilla.org/docs/Web/API/SubtleCrypto/decrypt MDN SubtleCrypto.decrypt documentation>
decrypt :: (MonadDOM m, IsAlgorithmIdentifier algorithm, IsBufferSource data') => SubtleCrypto -> algorithm -> CryptoKey -> data' -> m ArrayBuffer
decrypt self algorithm key data' = liftDOM (((js_decrypt (self) (Types.toAlgorithmIdentifier algorithm) (key) (Types.toBufferSource data')) >>= checkPromiseResult))

-- | <https://developer.mozilla.org/docs/Web/API/SubtleCrypto/decrypt MDN SubtleCrypto.decrypt documentation>
decrypt_ :: (MonadDOM m, IsAlgorithmIdentifier algorithm, IsBufferSource data') => SubtleCrypto -> algorithm -> CryptoKey -> data' -> m ()
decrypt_ self algorithm key data' = liftDOM (void (((js_decrypt (self) (Types.toAlgorithmIdentifier algorithm) (key) (Types.toBufferSource data')) >>= checkPromiseResult)))

foreign import javascript interruptible "(($1, $2, $3, $4, $c) => { return $1[\"deriveBits\"]($2, $3, $4).then(function(s) { $c(null, s);}, function(e) { $c(e, null);}); })"
        js_deriveBits :: SubtleCrypto -> AlgorithmIdentifier -> CryptoKey -> JSVal -> IO (JSVal, ArrayBuffer)
-- | <https://developer.mozilla.org/docs/Web/API/SubtleCrypto/deriveBits MDN SubtleCrypto.deriveBits documentation>
deriveBits :: (MonadDOM m, IsAlgorithmIdentifier algorithm) => SubtleCrypto -> algorithm -> CryptoKey -> Maybe Word -> m ArrayBuffer
deriveBits self algorithm baseKey length = liftDOM ((((toJSVal length) >>= \a4' -> js_deriveBits (self) (Types.toAlgorithmIdentifier algorithm) (baseKey) a4') >>= checkPromiseResult))

-- | <https://developer.mozilla.org/docs/Web/API/SubtleCrypto/deriveBits MDN SubtleCrypto.deriveBits documentation>
deriveBits_ :: (MonadDOM m, IsAlgorithmIdentifier algorithm) => SubtleCrypto -> algorithm -> CryptoKey -> Maybe Word -> m ()
deriveBits_ self algorithm baseKey length = liftDOM (void ((((toJSVal length) >>= \a4' -> js_deriveBits (self) (Types.toAlgorithmIdentifier algorithm) (baseKey) a4') >>= checkPromiseResult)))

foreign import javascript interruptible "(($1, $2, $3, $4, $5, $6, $c) => { return $1[\"deriveKey\"]($2, $3, $4, $5, $6).then(function(s) { $c(null, s);}, function(e) { $c(e, null);}); })"
        js_deriveKey :: SubtleCrypto -> AlgorithmIdentifier -> CryptoKey -> AlgorithmIdentifier -> Bool -> JSVal -> IO (JSVal, CryptoKey)
-- | <https://developer.mozilla.org/docs/Web/API/SubtleCrypto/deriveKey MDN SubtleCrypto.deriveKey documentation>
deriveKey :: (MonadDOM m, IsAlgorithmIdentifier algorithm, IsAlgorithmIdentifier derivedKeyType) => SubtleCrypto -> algorithm -> CryptoKey -> derivedKeyType -> Bool -> [KeyUsage] -> m CryptoKey
deriveKey self algorithm baseKey derivedKeyType extractable keyUsages = liftDOM ((((toJSVal keyUsages) >>= \a6' -> js_deriveKey (self) (Types.toAlgorithmIdentifier algorithm) (baseKey) (Types.toAlgorithmIdentifier derivedKeyType) (extractable) a6') >>= checkPromiseResult))

-- | <https://developer.mozilla.org/docs/Web/API/SubtleCrypto/deriveKey MDN SubtleCrypto.deriveKey documentation>
deriveKey_ :: (MonadDOM m, IsAlgorithmIdentifier algorithm, IsAlgorithmIdentifier derivedKeyType) => SubtleCrypto -> algorithm -> CryptoKey -> derivedKeyType -> Bool -> [KeyUsage] -> m ()
deriveKey_ self algorithm baseKey derivedKeyType extractable keyUsages = liftDOM (void ((((toJSVal keyUsages) >>= \a6' -> js_deriveKey (self) (Types.toAlgorithmIdentifier algorithm) (baseKey) (Types.toAlgorithmIdentifier derivedKeyType) (extractable) a6') >>= checkPromiseResult)))

foreign import javascript interruptible "(($1, $2, $3, $c) => { return $1[\"digest\"]($2, $3).then(function(s) { $c(null, s);}, function(e) { $c(e, null);}); })"
        js_digest :: SubtleCrypto -> AlgorithmIdentifier -> BufferSource -> IO (JSVal, ArrayBuffer)
-- | <https://developer.mozilla.org/docs/Web/API/SubtleCrypto/digest MDN SubtleCrypto.digest documentation>
digest :: (MonadDOM m, IsAlgorithmIdentifier algorithm, IsBufferSource data') => SubtleCrypto -> algorithm -> data' -> m ArrayBuffer
digest self algorithm data' = liftDOM (((js_digest (self) (Types.toAlgorithmIdentifier algorithm) (Types.toBufferSource data')) >>= checkPromiseResult))

-- | <https://developer.mozilla.org/docs/Web/API/SubtleCrypto/digest MDN SubtleCrypto.digest documentation>
digest_ :: (MonadDOM m, IsAlgorithmIdentifier algorithm, IsBufferSource data') => SubtleCrypto -> algorithm -> data' -> m ()
digest_ self algorithm data' = liftDOM (void (((js_digest (self) (Types.toAlgorithmIdentifier algorithm) (Types.toBufferSource data')) >>= checkPromiseResult)))

foreign import javascript interruptible "(($1, $2, $3, $4, $c) => { return $1[\"encrypt\"]($2, $3, $4).then(function(s) { $c(null, s);}, function(e) { $c(e, null);}); })"
        js_encrypt :: SubtleCrypto -> AlgorithmIdentifier -> CryptoKey -> BufferSource -> IO (JSVal, ArrayBuffer)
-- | <https://developer.mozilla.org/docs/Web/API/SubtleCrypto/encrypt MDN SubtleCrypto.encrypt documentation>
encrypt :: (MonadDOM m, IsAlgorithmIdentifier algorithm, IsBufferSource data') => SubtleCrypto -> algorithm -> CryptoKey -> data' -> m ArrayBuffer
encrypt self algorithm key data' = liftDOM (((js_encrypt (self) (Types.toAlgorithmIdentifier algorithm) (key) (Types.toBufferSource data')) >>= checkPromiseResult))

-- | <https://developer.mozilla.org/docs/Web/API/SubtleCrypto/encrypt MDN SubtleCrypto.encrypt documentation>
encrypt_ :: (MonadDOM m, IsAlgorithmIdentifier algorithm, IsBufferSource data') => SubtleCrypto -> algorithm -> CryptoKey -> data' -> m ()
encrypt_ self algorithm key data' = liftDOM (void (((js_encrypt (self) (Types.toAlgorithmIdentifier algorithm) (key) (Types.toBufferSource data')) >>= checkPromiseResult)))

foreign import javascript interruptible "(($1, $2, $3, $c) => { return $1[\"exportKey\"]($2, $3).then(function(s) { $c(null, s);}, function(e) { $c(e, null);}); })"
        js_exportKey :: SubtleCrypto -> JSVal -> CryptoKey -> IO (JSVal, ArrayBufferOrJsonWebKey)
-- | <https://developer.mozilla.org/docs/Web/API/SubtleCrypto/exportKey MDN SubtleCrypto.exportKey documentation>
exportKey :: (MonadDOM m) => SubtleCrypto -> KeyFormat -> CryptoKey -> m ArrayBufferOrJsonWebKey
exportKey self format key = liftDOM ((((toJSVal format) >>= \a2' -> js_exportKey (self) a2' (key)) >>= checkPromiseResult))

-- | <https://developer.mozilla.org/docs/Web/API/SubtleCrypto/exportKey MDN SubtleCrypto.exportKey documentation>
exportKey_ :: (MonadDOM m) => SubtleCrypto -> KeyFormat -> CryptoKey -> m ()
exportKey_ self format key = liftDOM (void ((((toJSVal format) >>= \a2' -> js_exportKey (self) a2' (key)) >>= checkPromiseResult)))

foreign import javascript interruptible "(($1, $2, $3, $4, $c) => { return $1[\"generateKey\"]($2, $3, $4).then(function(s) { $c(null, s);}, function(e) { $c(e, null);}); })"
        js_generateKey :: SubtleCrypto -> AlgorithmIdentifier -> Bool -> JSVal -> IO (JSVal, CryptoKeyOrCryptoKeyPair)
-- | <https://developer.mozilla.org/docs/Web/API/SubtleCrypto/generateKey MDN SubtleCrypto.generateKey documentation>
generateKey :: (MonadDOM m, IsAlgorithmIdentifier algorithm) => SubtleCrypto -> algorithm -> Bool -> [KeyUsage] -> m CryptoKeyOrCryptoKeyPair
generateKey self algorithm extractable keyUsages = liftDOM ((((toJSVal keyUsages) >>= \a4' -> js_generateKey (self) (Types.toAlgorithmIdentifier algorithm) (extractable) a4') >>= checkPromiseResult))

-- | <https://developer.mozilla.org/docs/Web/API/SubtleCrypto/generateKey MDN SubtleCrypto.generateKey documentation>
generateKey_ :: (MonadDOM m, IsAlgorithmIdentifier algorithm) => SubtleCrypto -> algorithm -> Bool -> [KeyUsage] -> m ()
generateKey_ self algorithm extractable keyUsages = liftDOM (void ((((toJSVal keyUsages) >>= \a4' -> js_generateKey (self) (Types.toAlgorithmIdentifier algorithm) (extractable) a4') >>= checkPromiseResult)))

foreign import javascript interruptible "(($1, $2, $3, $4, $5, $6, $c) => { return $1[\"importKey\"]($2, $3, $4, $5, $6).then(function(s) { $c(null, s);}, function(e) { $c(e, null);}); })"
        js_importKey :: SubtleCrypto -> JSVal -> BufferSourceOrJsonWebKey -> AlgorithmIdentifier -> Bool -> JSVal -> IO (JSVal, CryptoKey)
-- | <https://developer.mozilla.org/docs/Web/API/SubtleCrypto/importKey MDN SubtleCrypto.importKey documentation>
importKey :: (MonadDOM m, IsBufferSourceOrJsonWebKey keyData, IsAlgorithmIdentifier algorithm) => SubtleCrypto -> KeyFormat -> keyData -> algorithm -> Bool -> [KeyUsage] -> m CryptoKey
importKey self format keyData algorithm extractable keyUsages = liftDOM ((((toJSVal format) >>= \a2' -> (toJSVal keyUsages) >>= \a6' -> js_importKey (self) a2' (Types.toBufferSourceOrJsonWebKey keyData) (Types.toAlgorithmIdentifier algorithm) (extractable) a6') >>= checkPromiseResult))

-- | <https://developer.mozilla.org/docs/Web/API/SubtleCrypto/importKey MDN SubtleCrypto.importKey documentation>
importKey_ :: (MonadDOM m, IsBufferSourceOrJsonWebKey keyData, IsAlgorithmIdentifier algorithm) => SubtleCrypto -> KeyFormat -> keyData -> algorithm -> Bool -> [KeyUsage] -> m ()
importKey_ self format keyData algorithm extractable keyUsages = liftDOM (void ((((toJSVal format) >>= \a2' -> (toJSVal keyUsages) >>= \a6' -> js_importKey (self) a2' (Types.toBufferSourceOrJsonWebKey keyData) (Types.toAlgorithmIdentifier algorithm) (extractable) a6') >>= checkPromiseResult)))

foreign import javascript interruptible "(($1, $2, $3, $4, $c) => { return $1[\"sign\"]($2, $3, $4).then(function(s) { $c(null, s);}, function(e) { $c(e, null);}); })"
        js_sign :: SubtleCrypto -> AlgorithmIdentifier -> CryptoKey -> BufferSource -> IO (JSVal, ArrayBuffer)
-- | <https://developer.mozilla.org/docs/Web/API/SubtleCrypto/sign MDN SubtleCrypto.sign documentation>
sign :: (MonadDOM m, IsAlgorithmIdentifier algorithm, IsBufferSource data') => SubtleCrypto -> algorithm -> CryptoKey -> data' -> m ArrayBuffer
sign self algorithm key data' = liftDOM (((js_sign (self) (Types.toAlgorithmIdentifier algorithm) (key) (Types.toBufferSource data')) >>= checkPromiseResult))

-- | <https://developer.mozilla.org/docs/Web/API/SubtleCrypto/sign MDN SubtleCrypto.sign documentation>
sign_ :: (MonadDOM m, IsAlgorithmIdentifier algorithm, IsBufferSource data') => SubtleCrypto -> algorithm -> CryptoKey -> data' -> m ()
sign_ self algorithm key data' = liftDOM (void (((js_sign (self) (Types.toAlgorithmIdentifier algorithm) (key) (Types.toBufferSource data')) >>= checkPromiseResult)))

foreign import javascript interruptible "(($1, $2, $3, $4, $5, $6, $7, $8, $c) => { return $1[\"unwrapKey\"]($2, $3, $4, $5, $6, $7, $8).then(function(s) { $c(null, s);}, function(e) { $c(e, null);}); })"
        js_unwrapKey :: SubtleCrypto -> JSVal -> BufferSource -> CryptoKey -> AlgorithmIdentifier -> AlgorithmIdentifier -> Bool -> JSVal -> IO (JSVal, CryptoKey)
-- | <https://developer.mozilla.org/docs/Web/API/SubtleCrypto/unwrapKey MDN SubtleCrypto.unwrapKey documentation>
unwrapKey :: (MonadDOM m, IsBufferSource wrappedKey, IsAlgorithmIdentifier unwrapAlgorithm, IsAlgorithmIdentifier unwrappedKeyAlgorithm) => SubtleCrypto -> KeyFormat -> wrappedKey -> CryptoKey -> unwrapAlgorithm -> unwrappedKeyAlgorithm -> Bool -> [KeyUsage] -> m CryptoKey
unwrapKey self format wrappedKey unwrappingKey unwrapAlgorithm unwrappedKeyAlgorithm extractable keyUsages = liftDOM ((((toJSVal format) >>= \a2' -> (toJSVal keyUsages) >>= \a8' -> js_unwrapKey (self) a2' (Types.toBufferSource wrappedKey) (unwrappingKey) (Types.toAlgorithmIdentifier unwrapAlgorithm) (Types.toAlgorithmIdentifier unwrappedKeyAlgorithm) (extractable) a8') >>= checkPromiseResult))

-- | <https://developer.mozilla.org/docs/Web/API/SubtleCrypto/unwrapKey MDN SubtleCrypto.unwrapKey documentation>
unwrapKey_ :: (MonadDOM m, IsBufferSource wrappedKey, IsAlgorithmIdentifier unwrapAlgorithm, IsAlgorithmIdentifier unwrappedKeyAlgorithm) => SubtleCrypto -> KeyFormat -> wrappedKey -> CryptoKey -> unwrapAlgorithm -> unwrappedKeyAlgorithm -> Bool -> [KeyUsage] -> m ()
unwrapKey_ self format wrappedKey unwrappingKey unwrapAlgorithm unwrappedKeyAlgorithm extractable keyUsages = liftDOM (void ((((toJSVal format) >>= \a2' -> (toJSVal keyUsages) >>= \a8' -> js_unwrapKey (self) a2' (Types.toBufferSource wrappedKey) (unwrappingKey) (Types.toAlgorithmIdentifier unwrapAlgorithm) (Types.toAlgorithmIdentifier unwrappedKeyAlgorithm) (extractable) a8') >>= checkPromiseResult)))

foreign import javascript interruptible "(($1, $2, $3, $4, $5, $c) => { return $1[\"verify\"]($2, $3, $4, $5).then(function(s) { $c(null, s);}, function(e) { $c(e, null);}); })"
        js_verify :: SubtleCrypto -> AlgorithmIdentifier -> CryptoKey -> BufferSource -> BufferSource -> IO (JSVal, Bool)
-- | <https://developer.mozilla.org/docs/Web/API/SubtleCrypto/verify MDN SubtleCrypto.verify documentation>
verify :: (MonadDOM m, IsAlgorithmIdentifier algorithm, IsBufferSource signature, IsBufferSource data') => SubtleCrypto -> algorithm -> CryptoKey -> signature -> data' -> m Bool
verify self algorithm key signature data' = liftDOM (((js_verify (self) (Types.toAlgorithmIdentifier algorithm) (key) (Types.toBufferSource signature) (Types.toBufferSource data')) >>= checkPromiseResult))

-- | <https://developer.mozilla.org/docs/Web/API/SubtleCrypto/verify MDN SubtleCrypto.verify documentation>
verify_ :: (MonadDOM m, IsAlgorithmIdentifier algorithm, IsBufferSource signature, IsBufferSource data') => SubtleCrypto -> algorithm -> CryptoKey -> signature -> data' -> m ()
verify_ self algorithm key signature data' = liftDOM (void (((js_verify (self) (Types.toAlgorithmIdentifier algorithm) (key) (Types.toBufferSource signature) (Types.toBufferSource data')) >>= checkPromiseResult)))

foreign import javascript interruptible "(($1, $2, $3, $4, $5, $c) => { return $1[\"wrapKey\"]($2, $3, $4, $5).then(function(s) { $c(null, s);}, function(e) { $c(e, null);}); })"
        js_wrapKey :: SubtleCrypto -> JSVal -> CryptoKey -> CryptoKey -> AlgorithmIdentifier -> IO (JSVal, ArrayBuffer)
-- | <https://developer.mozilla.org/docs/Web/API/SubtleCrypto/wrapKey MDN SubtleCrypto.wrapKey documentation>
wrapKey :: (MonadDOM m, IsAlgorithmIdentifier wrapAlgorithm) => SubtleCrypto -> KeyFormat -> CryptoKey -> CryptoKey -> wrapAlgorithm -> m ArrayBuffer
wrapKey self format key wrappingKey wrapAlgorithm = liftDOM ((((toJSVal format) >>= \a2' -> js_wrapKey (self) a2' (key) (wrappingKey) (Types.toAlgorithmIdentifier wrapAlgorithm)) >>= checkPromiseResult))

-- | <https://developer.mozilla.org/docs/Web/API/SubtleCrypto/wrapKey MDN SubtleCrypto.wrapKey documentation>
wrapKey_ :: (MonadDOM m, IsAlgorithmIdentifier wrapAlgorithm) => SubtleCrypto -> KeyFormat -> CryptoKey -> CryptoKey -> wrapAlgorithm -> m ()
wrapKey_ self format key wrappingKey wrapAlgorithm = liftDOM (void ((((toJSVal format) >>= \a2' -> js_wrapKey (self) a2' (key) (wrappingKey) (Types.toAlgorithmIdentifier wrapAlgorithm)) >>= checkPromiseResult)))