SubtleCrypto

package js.html

Available on js

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 also:

Methods

decrypt(algorithm:EitherType<Dynamic, String>, key:CryptoKey, data:EitherType<ArrayBufferView, ArrayBuffer>):Promise<Dynamic>

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

Throws:

null

DOMError

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

deriveBits(algorithm:String, baseKey:CryptoKey, length:Int):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.

Throws:

null

DOMError

deriveKey(algorithm:EitherType<Dynamic, String>, baseKey:CryptoKey, derivedKeyType:EitherType<Dynamic, String>, extractable:Bool, keyUsages:Array<String>):Promise<Dynamic>

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

Throws:

null

DOMError

digest(algorithm:EitherType<Dynamic, String>, data:EitherType<ArrayBufferView, ArrayBuffer>):Promise<Dynamic>

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

Throws:

null

DOMError

encrypt(algorithm:EitherType<Dynamic, String>, key:CryptoKey, data:EitherType<ArrayBufferView, ArrayBuffer>):Promise<Dynamic>

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

Throws:

null

DOMError

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

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

Throws:

null

DOMError

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

generateKey(algorithm:String, extractable:Bool, keyUsages:Array<String>):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.

Throws:

null

DOMError

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

importKey(format:String, keyData:Dynamic, algorithm:String, extractable:Bool, keyUsages:Array<String>):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.

Throws:

null

DOMError

sign(algorithm:EitherType<Dynamic, String>, key:CryptoKey, data:EitherType<ArrayBufferView, ArrayBuffer>):Promise<Dynamic>

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

Throws:

null

DOMError

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

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

Throws:

null

DOMError

verify(algorithm:EitherType<Dynamic, String>, key:CryptoKey, signature:EitherType<ArrayBufferView, ArrayBuffer>, data:EitherType<ArrayBufferView, ArrayBuffer>):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.

Throws:

null

DOMError

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

wrapKey(format:String, key:CryptoKey, wrappingKey:CryptoKey, wrapAlgorithm:String):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.

Throws:

null

DOMError

© 2005–2020 Haxe Foundation
Licensed under a MIT license.
https://api.haxe.org/js/html/SubtleCrypto.html