module JSDOM.Generated.WebKitSubtleCrypto
(encrypt, encrypt_, decrypt, decrypt_, sign, sign_, verify,
verify_, digest, digest_, generateKey, generateKey_, importKey,
importKey_, exportKey, exportKey_, wrapKey, wrapKey_, unwrapKey,
unwrapKey_, WebKitSubtleCrypto(..), gTypeWebKitSubtleCrypto)
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, IsCryptoOperationData data') =>
WebKitSubtleCrypto ->
algorithm -> CryptoKey -> [data'] -> m ArrayBuffer
encrypt self algorithm key data'
= liftDOM
(((self ^. jsf "encrypt"
[toJSVal algorithm, toJSVal key, toJSVal (array data')])
>>= readPromise)
>>= fromJSValUnchecked)
encrypt_ ::
(MonadDOM m, ToJSString algorithm, IsCryptoOperationData data') =>
WebKitSubtleCrypto -> algorithm -> CryptoKey -> [data'] -> m ()
encrypt_ self algorithm key data'
= liftDOM
(void
(self ^. jsf "encrypt"
[toJSVal algorithm, toJSVal key, toJSVal (array data')]))
decrypt ::
(MonadDOM m, ToJSString algorithm, IsCryptoOperationData data') =>
WebKitSubtleCrypto ->
algorithm -> CryptoKey -> [data'] -> m ArrayBuffer
decrypt self algorithm key data'
= liftDOM
(((self ^. jsf "decrypt"
[toJSVal algorithm, toJSVal key, toJSVal (array data')])
>>= readPromise)
>>= fromJSValUnchecked)
decrypt_ ::
(MonadDOM m, ToJSString algorithm, IsCryptoOperationData data') =>
WebKitSubtleCrypto -> algorithm -> CryptoKey -> [data'] -> m ()
decrypt_ self algorithm key data'
= liftDOM
(void
(self ^. jsf "decrypt"
[toJSVal algorithm, toJSVal key, toJSVal (array data')]))
sign ::
(MonadDOM m, ToJSString algorithm, IsCryptoOperationData data') =>
WebKitSubtleCrypto ->
algorithm -> CryptoKey -> [data'] -> m ArrayBuffer
sign self algorithm key data'
= liftDOM
(((self ^. jsf "sign"
[toJSVal algorithm, toJSVal key, toJSVal (array data')])
>>= readPromise)
>>= fromJSValUnchecked)
sign_ ::
(MonadDOM m, ToJSString algorithm, IsCryptoOperationData data') =>
WebKitSubtleCrypto -> algorithm -> CryptoKey -> [data'] -> m ()
sign_ self algorithm key data'
= liftDOM
(void
(self ^. jsf "sign"
[toJSVal algorithm, toJSVal key, toJSVal (array data')]))
verify ::
(MonadDOM m, ToJSString algorithm, IsCryptoOperationData signature,
IsCryptoOperationData data') =>
WebKitSubtleCrypto ->
algorithm -> CryptoKey -> signature -> [data'] -> m Bool
verify self algorithm key signature data'
= liftDOM
(((self ^. jsf "verify"
[toJSVal algorithm, toJSVal key, toJSVal signature,
toJSVal (array data')])
>>= readPromise)
>>= valToBool)
verify_ ::
(MonadDOM m, ToJSString algorithm, IsCryptoOperationData signature,
IsCryptoOperationData data') =>
WebKitSubtleCrypto ->
algorithm -> CryptoKey -> signature -> [data'] -> m ()
verify_ self algorithm key signature data'
= liftDOM
(void
(self ^. jsf "verify"
[toJSVal algorithm, toJSVal key, toJSVal signature,
toJSVal (array data')]))
digest ::
(MonadDOM m, ToJSString algorithm, IsCryptoOperationData data') =>
WebKitSubtleCrypto -> algorithm -> [data'] -> m ArrayBuffer
digest self algorithm data'
= liftDOM
(((self ^. jsf "digest" [toJSVal algorithm, toJSVal (array data')])
>>= readPromise)
>>= fromJSValUnchecked)
digest_ ::
(MonadDOM m, ToJSString algorithm, IsCryptoOperationData data') =>
WebKitSubtleCrypto -> algorithm -> [data'] -> m ()
digest_ self algorithm data'
= liftDOM
(void
(self ^. jsf "digest" [toJSVal algorithm, toJSVal (array data')]))
generateKey ::
(MonadDOM m, ToJSString algorithm) =>
WebKitSubtleCrypto ->
algorithm -> Bool -> [CryptoKeyUsage] -> m CryptoKeyOrKeyPair
generateKey self algorithm extractable keyUsages
= liftDOM
(((self ^. jsf "generateKey"
[toJSVal algorithm, toJSVal extractable,
toJSVal (array keyUsages)])
>>= readPromise)
>>= fromJSValUnchecked)
generateKey_ ::
(MonadDOM m, ToJSString algorithm) =>
WebKitSubtleCrypto -> 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, IsCryptoOperationData keyData,
ToJSString algorithm) =>
WebKitSubtleCrypto ->
format ->
keyData ->
Maybe 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, IsCryptoOperationData keyData,
ToJSString algorithm) =>
WebKitSubtleCrypto ->
format ->
keyData -> Maybe 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) =>
WebKitSubtleCrypto -> format -> CryptoKey -> m ArrayBuffer
exportKey self format key
= liftDOM
(((self ^. jsf "exportKey" [toJSVal format, toJSVal key]) >>=
readPromise)
>>= fromJSValUnchecked)
exportKey_ ::
(MonadDOM m, ToJSString format) =>
WebKitSubtleCrypto -> format -> CryptoKey -> m ()
exportKey_ self format key
= liftDOM
(void (self ^. jsf "exportKey" [toJSVal format, toJSVal key]))
wrapKey ::
(MonadDOM m, ToJSString format, ToJSString wrapAlgorithm) =>
WebKitSubtleCrypto ->
format -> CryptoKey -> CryptoKey -> wrapAlgorithm -> m ArrayBuffer
wrapKey self format key wrappingKey wrapAlgorithm
= liftDOM
(((self ^. jsf "wrapKey"
[toJSVal format, toJSVal key, toJSVal wrappingKey,
toJSVal wrapAlgorithm])
>>= readPromise)
>>= fromJSValUnchecked)
wrapKey_ ::
(MonadDOM m, ToJSString format, ToJSString wrapAlgorithm) =>
WebKitSubtleCrypto ->
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, IsCryptoOperationData wrappedKey,
ToJSString unwrapAlgorithm, ToJSString unwrappedKeyAlgorithm) =>
WebKitSubtleCrypto ->
format ->
wrappedKey ->
CryptoKey ->
unwrapAlgorithm ->
Maybe 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, IsCryptoOperationData wrappedKey,
ToJSString unwrapAlgorithm, ToJSString unwrappedKeyAlgorithm) =>
WebKitSubtleCrypto ->
format ->
wrappedKey ->
CryptoKey ->
unwrapAlgorithm ->
Maybe 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)]))