SubtleCrypto

js.html.SubtleCrypto (extern class)

The SubtleCrypto interface represents a set of cryptographic primitives. It is available via the Crypto.subtle properties available in a window context (via Window.crypto).

Documentation SubtleCrypto by Mozilla Contributors, licensed under CC-BY-SA 2.5.

See:

Instance Members

Returns a Promise of the encrypted data corresponding to the clear text, algorithm and key given as parameters.

Name Type
algorithm haxe.extern.EitherType<Dynamic, String>
key CryptoKey
data haxe.extern.EitherType<js.lib.ArrayBufferView, js.lib.ArrayBuffer>
Returns
js.lib.Promise<Dynamic>

Returns a Promise of the clear data corresponding to the encrypted text, algorithm and key given as parameters.

Name Type
algorithm haxe.extern.EitherType<Dynamic, String>
key CryptoKey
data haxe.extern.EitherType<js.lib.ArrayBufferView, js.lib.ArrayBuffer>
Returns
js.lib.Promise<Dynamic>

Returns a Promise of the signature corresponding to the text, algorithm and key given as parameters.

Name Type
algorithm haxe.extern.EitherType<Dynamic, String>
key CryptoKey
data haxe.extern.EitherType<js.lib.ArrayBufferView, js.lib.ArrayBuffer>
Returns
js.lib.Promise<Dynamic>

Returns a Promise of a Boolean value indicating if the signature given as parameter matches the text, algorithm and key also given as parameters.

Name Type
algorithm haxe.extern.EitherType<Dynamic, String>
key CryptoKey
signature haxe.extern.EitherType<js.lib.ArrayBufferView, js.lib.ArrayBuffer>
data haxe.extern.EitherType<js.lib.ArrayBufferView, js.lib.ArrayBuffer>
Returns
js.lib.Promise<Dynamic>

Returns a Promise of a digest generated from the algorithm and text given as parameters.

Name Type
algorithm haxe.extern.EitherType<Dynamic, String>
data haxe.extern.EitherType<js.lib.ArrayBufferView, js.lib.ArrayBuffer>
Returns
js.lib.Promise<Dynamic>

generateKey(algorithm: Dynamic, extractable: Bool, keyUsages: Array<String>): js.lib.Promise<Dynamic>

Returns a Promise of a newly generated CryptoKey, for symmetrical algorithms, or a CryptoKeyPair, containing two newly generated keys, for asymmetrical algorithm, that matches the algorithm, the usages and the extractability given as parameters.

Name Type
algorithm Dynamic
extractable Bool
keyUsages Array<String>
Returns
js.lib.Promise<Dynamic>

deriveKey(algorithm: haxe.extern.EitherType<Dynamic, String>, baseKey: CryptoKey, derivedKeyType: haxe.extern.EitherType<Dynamic, String>, extractable: Bool, keyUsages: Array<String>): js.lib.Promise<Dynamic>

Returns a Promise of a newly generated CryptoKey derived from a master key and a specific algorithm given as parameters.

Name Type
algorithm haxe.extern.EitherType<Dynamic, String>
baseKey CryptoKey
derivedKeyType haxe.extern.EitherType<Dynamic, String>
extractable Bool
keyUsages Array<String>
Returns
js.lib.Promise<Dynamic>

deriveBits(algorithm: Dynamic, baseKey: CryptoKey, length: Int): js.lib.Promise<Dynamic>

Returns a Promise of a newly generated buffer of pseudo-random bits derived from a master key and a specific algorithm given as parameters.

Name Type
algorithm Dynamic
baseKey CryptoKey
length Int
Returns
js.lib.Promise<Dynamic>

importKey(format: String, keyData: Dynamic, algorithm: Dynamic, extractable: Bool, keyUsages: Array<String>): js.lib.Promise<Dynamic>

Returns a Promise of a CryptoKey corresponding to the format, the algorithm, the raw key data, the usages and the extractability given as parameters.

Name Type
format String
keyData Dynamic
algorithm Dynamic
extractable Bool
keyUsages Array<String>
Returns
js.lib.Promise<Dynamic>

exportKey(format: String, key: CryptoKey): js.lib.Promise<Dynamic>

Returns a Promise of a buffer containing the key in the format requested.

Name Type
format String
key CryptoKey
Returns
js.lib.Promise<Dynamic>

wrapKey(format: String, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: Dynamic): js.lib.Promise<Dynamic>

Returns a Promise of a wrapped symmetric key for usage (transfer, storage) in insecure environments. The wrapped buffer returned is in the format given in parameters, and contains the key wrapped by the given wrapping key with the given algorithm.

Name Type
format String
key CryptoKey
wrappingKey CryptoKey
wrapAlgorithm Dynamic
Returns
js.lib.Promise<Dynamic>

unwrapKey(format: String, wrappedKey: haxe.extern.EitherType<js.lib.ArrayBufferView, js.lib.ArrayBuffer>, unwrappingKey: CryptoKey, unwrapAlgorithm: haxe.extern.EitherType<Dynamic, String>, unwrappedKeyAlgorithm: haxe.extern.EitherType<Dynamic, String>, extractable: Bool, keyUsages: Array<String>): js.lib.Promise<Dynamic>

Returns a Promise of a CryptoKey corresponding to the wrapped key given in parameter.

Name Type
format String
wrappedKey haxe.extern.EitherType<js.lib.ArrayBufferView, js.lib.ArrayBuffer>
unwrappingKey CryptoKey
unwrapAlgorithm haxe.extern.EitherType<Dynamic, String>
unwrappedKeyAlgorithm haxe.extern.EitherType<Dynamic, String>
extractable Bool
keyUsages Array<String>
Returns
js.lib.Promise<Dynamic>