module JSDOM.Generated.SubtleCrypto
(encrypt, encrypt_, decrypt, decrypt_, sign, sign_, verify,
verify_, digest, digest_, deriveKey, deriveKey_, deriveBits,
deriveBits_, generateKey, generateKey_, importKey, importKey_,
exportKey, exportKey_, wrapKey, wrapKey_, unwrapKey, unwrapKey_,
SubtleCrypto(..), gTypeSubtleCrypto)
where
import Prelude ((.), (==), (>>=), return, IO, Int, Float, Double, Bool(..), Maybe, maybe, fromIntegral, round, realToFrac, fmap, Show, Read, Eq, Ord, Maybe(..))
import qualified Prelude (error)
import Data.Typeable (Typeable)
import Data.Traversable (mapM)
import Language.Javascript.JSaddle (JSM(..), JSVal(..), JSString, strictEqual, toJSVal, valToStr, valToNumber, valToBool, js, jss, jsf, jsg, function, asyncFunction, new, array, jsUndefined, (!), (!!))
import Data.Int (Int64)
import Data.Word (Word, Word64)
import JSDOM.Types
import Control.Applicative ((<$>))
import Control.Monad (void)
import Control.Lens.Operators ((^.))
import JSDOM.EventTargetClosures (EventName, unsafeEventName)
import JSDOM.Enums
encrypt ::
(MonadDOM m, ToJSString algorithm, IsBufferSource data') =>
SubtleCrypto -> algorithm -> CryptoKey -> data' -> m JSVal
encrypt self algorithm key data'
= liftDOM
(((self ^. jsf "encrypt"
[toJSVal algorithm, toJSVal key, toJSVal data'])
>>= readPromise)
>>= toJSVal)
encrypt_ ::
(MonadDOM m, ToJSString algorithm, IsBufferSource data') =>
SubtleCrypto -> algorithm -> CryptoKey -> data' -> m ()
encrypt_ self algorithm key data'
= liftDOM
(void
(self ^. jsf "encrypt"
[toJSVal algorithm, toJSVal key, toJSVal data']))
decrypt ::
(MonadDOM m, ToJSString algorithm, IsBufferSource data') =>
SubtleCrypto -> algorithm -> CryptoKey -> data' -> m JSVal
decrypt self algorithm key data'
= liftDOM
(((self ^. jsf "decrypt"
[toJSVal algorithm, toJSVal key, toJSVal data'])
>>= readPromise)
>>= toJSVal)
decrypt_ ::
(MonadDOM m, ToJSString algorithm, IsBufferSource data') =>
SubtleCrypto -> algorithm -> CryptoKey -> data' -> m ()
decrypt_ self algorithm key data'
= liftDOM
(void
(self ^. jsf "decrypt"
[toJSVal algorithm, toJSVal key, toJSVal data']))
sign ::
(MonadDOM m, ToJSString algorithm, IsBufferSource data') =>
SubtleCrypto -> algorithm -> CryptoKey -> data' -> m JSVal
sign self algorithm key data'
= liftDOM
(((self ^. jsf "sign"
[toJSVal algorithm, toJSVal key, toJSVal data'])
>>= readPromise)
>>= toJSVal)
sign_ ::
(MonadDOM m, ToJSString algorithm, IsBufferSource data') =>
SubtleCrypto -> algorithm -> CryptoKey -> data' -> m ()
sign_ self algorithm key data'
= liftDOM
(void
(self ^. jsf "sign"
[toJSVal algorithm, toJSVal key, toJSVal data']))
verify ::
(MonadDOM m, ToJSString algorithm, IsBufferSource signature,
IsBufferSource data') =>
SubtleCrypto ->
algorithm -> CryptoKey -> signature -> data' -> m JSVal
verify self algorithm key signature data'
= liftDOM
(((self ^. jsf "verify"
[toJSVal algorithm, toJSVal key, toJSVal signature, toJSVal data'])
>>= readPromise)
>>= toJSVal)
verify_ ::
(MonadDOM m, ToJSString algorithm, IsBufferSource signature,
IsBufferSource data') =>
SubtleCrypto ->
algorithm -> CryptoKey -> signature -> data' -> m ()
verify_ self algorithm key signature data'
= liftDOM
(void
(self ^. jsf "verify"
[toJSVal algorithm, toJSVal key, toJSVal signature,
toJSVal data']))
digest ::
(MonadDOM m, ToJSString algorithm, IsBufferSource data') =>
SubtleCrypto -> algorithm -> data' -> m JSVal
digest self algorithm data'
= liftDOM
(((self ^. jsf "digest" [toJSVal algorithm, toJSVal data']) >>=
readPromise)
>>= toJSVal)
digest_ ::
(MonadDOM m, ToJSString algorithm, IsBufferSource data') =>
SubtleCrypto -> algorithm -> data' -> m ()
digest_ self algorithm data'
= liftDOM
(void (self ^. jsf "digest" [toJSVal algorithm, toJSVal data']))
deriveKey ::
(MonadDOM m, ToJSString algorithm, ToJSString derivedKeyType) =>
SubtleCrypto ->
algorithm ->
CryptoKey -> derivedKeyType -> Bool -> [CryptoKeyUsage] -> m JSVal
deriveKey self algorithm baseKey derivedKeyType extractable
keyUsages
= liftDOM
(((self ^. jsf "deriveKey"
[toJSVal algorithm, toJSVal baseKey, toJSVal derivedKeyType,
toJSVal extractable, toJSVal (array keyUsages)])
>>= readPromise)
>>= toJSVal)
deriveKey_ ::
(MonadDOM m, ToJSString algorithm, ToJSString derivedKeyType) =>
SubtleCrypto ->
algorithm ->
CryptoKey -> derivedKeyType -> Bool -> [CryptoKeyUsage] -> m ()
deriveKey_ self algorithm baseKey derivedKeyType extractable
keyUsages
= liftDOM
(void
(self ^. jsf "deriveKey"
[toJSVal algorithm, toJSVal baseKey, toJSVal derivedKeyType,
toJSVal extractable, toJSVal (array keyUsages)]))
deriveBits ::
(MonadDOM m, ToJSString algorithm) =>
SubtleCrypto -> algorithm -> CryptoKey -> Word -> m ArrayBuffer
deriveBits self algorithm baseKey length
= liftDOM
(((self ^. jsf "deriveBits"
[toJSVal algorithm, toJSVal baseKey, toJSVal length])
>>= readPromise)
>>= fromJSValUnchecked)
deriveBits_ ::
(MonadDOM m, ToJSString algorithm) =>
SubtleCrypto -> algorithm -> CryptoKey -> Word -> m ()
deriveBits_ self algorithm baseKey length
= liftDOM
(void
(self ^. jsf "deriveBits"
[toJSVal algorithm, toJSVal baseKey, toJSVal length]))
generateKey ::
(MonadDOM m, ToJSString algorithm) =>
SubtleCrypto -> algorithm -> Bool -> [CryptoKeyUsage] -> m JSVal
generateKey self algorithm extractable keyUsages
= liftDOM
(((self ^. jsf "generateKey"
[toJSVal algorithm, toJSVal extractable,
toJSVal (array keyUsages)])
>>= readPromise)
>>= toJSVal)
generateKey_ ::
(MonadDOM m, ToJSString algorithm) =>
SubtleCrypto -> algorithm -> Bool -> [CryptoKeyUsage] -> m ()
generateKey_ self algorithm extractable keyUsages
= liftDOM
(void
(self ^. jsf "generateKey"
[toJSVal algorithm, toJSVal extractable,
toJSVal (array keyUsages)]))
importKey ::
(MonadDOM m, ToJSString format, IsKeyData keyData,
ToJSString algorithm) =>
SubtleCrypto ->
format ->
keyData -> algorithm -> Bool -> [CryptoKeyUsage] -> m CryptoKey
importKey self format keyData algorithm extractable keyUsages
= liftDOM
(((self ^. jsf "importKey"
[toJSVal format, toJSVal keyData, toJSVal algorithm,
toJSVal extractable, toJSVal (array keyUsages)])
>>= readPromise)
>>= fromJSValUnchecked)
importKey_ ::
(MonadDOM m, ToJSString format, IsKeyData keyData,
ToJSString algorithm) =>
SubtleCrypto ->
format -> keyData -> algorithm -> Bool -> [CryptoKeyUsage] -> m ()
importKey_ self format keyData algorithm extractable keyUsages
= liftDOM
(void
(self ^. jsf "importKey"
[toJSVal format, toJSVal keyData, toJSVal algorithm,
toJSVal extractable, toJSVal (array keyUsages)]))
exportKey ::
(MonadDOM m, ToJSString format) =>
SubtleCrypto -> format -> CryptoKey -> m JSVal
exportKey self format key
= liftDOM
(((self ^. jsf "exportKey" [toJSVal format, toJSVal key]) >>=
readPromise)
>>= toJSVal)
exportKey_ ::
(MonadDOM m, ToJSString format) =>
SubtleCrypto -> format -> CryptoKey -> m ()
exportKey_ self format key
= liftDOM
(void (self ^. jsf "exportKey" [toJSVal format, toJSVal key]))
wrapKey ::
(MonadDOM m, ToJSString format, ToJSString wrapAlgorithm) =>
SubtleCrypto ->
format -> CryptoKey -> CryptoKey -> wrapAlgorithm -> m JSVal
wrapKey self format key wrappingKey wrapAlgorithm
= liftDOM
(((self ^. jsf "wrapKey"
[toJSVal format, toJSVal key, toJSVal wrappingKey,
toJSVal wrapAlgorithm])
>>= readPromise)
>>= toJSVal)
wrapKey_ ::
(MonadDOM m, ToJSString format, ToJSString wrapAlgorithm) =>
SubtleCrypto ->
format -> CryptoKey -> CryptoKey -> wrapAlgorithm -> m ()
wrapKey_ self format key wrappingKey wrapAlgorithm
= liftDOM
(void
(self ^. jsf "wrapKey"
[toJSVal format, toJSVal key, toJSVal wrappingKey,
toJSVal wrapAlgorithm]))
unwrapKey ::
(MonadDOM m, ToJSString format, IsBufferSource wrappedKey,
ToJSString unwrapAlgorithm, ToJSString unwrappedKeyAlgorithm) =>
SubtleCrypto ->
format ->
wrappedKey ->
CryptoKey ->
unwrapAlgorithm ->
unwrappedKeyAlgorithm -> Bool -> [CryptoKeyUsage] -> m CryptoKey
unwrapKey self format wrappedKey unwrappingKey unwrapAlgorithm
unwrappedKeyAlgorithm extractable keyUsages
= liftDOM
(((self ^. jsf "unwrapKey"
[toJSVal format, toJSVal wrappedKey, toJSVal unwrappingKey,
toJSVal unwrapAlgorithm, toJSVal unwrappedKeyAlgorithm,
toJSVal extractable, toJSVal (array keyUsages)])
>>= readPromise)
>>= fromJSValUnchecked)
unwrapKey_ ::
(MonadDOM m, ToJSString format, IsBufferSource wrappedKey,
ToJSString unwrapAlgorithm, ToJSString unwrappedKeyAlgorithm) =>
SubtleCrypto ->
format ->
wrappedKey ->
CryptoKey ->
unwrapAlgorithm ->
unwrappedKeyAlgorithm -> Bool -> [CryptoKeyUsage] -> m ()
unwrapKey_ self format wrappedKey unwrappingKey unwrapAlgorithm
unwrappedKeyAlgorithm extractable keyUsages
= liftDOM
(void
(self ^. jsf "unwrapKey"
[toJSVal format, toJSVal wrappedKey, toJSVal unwrappingKey,
toJSVal unwrapAlgorithm, toJSVal unwrappedKeyAlgorithm,
toJSVal extractable, toJSVal (array keyUsages)]))