interface SubtleCrypto { decrypt ( algorithm : | AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams , key : CryptoKey , data : BufferSource , ) : Promise < ArrayBuffer > ; deriveBits ( algorithm : | AlgorithmIdentifier | EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params , baseKey : CryptoKey , length : number , ) : Promise < ArrayBuffer > ; deriveKey ( algorithm : | AlgorithmIdentifier | EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params , baseKey : CryptoKey , derivedKeyType : | AlgorithmIdentifier | HkdfParams | Pbkdf2Params | AesDerivedKeyParams | HmacImportParams , extractable : boolean , keyUsages : KeyUsage [] , ) : Promise < CryptoKey > ; digest ( algorithm : AlgorithmIdentifier , data : BufferSource , ) : Promise < ArrayBuffer > ; encrypt ( algorithm : | AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams , key : CryptoKey , data : BufferSource , ) : Promise < ArrayBuffer > ; exportKey ( format : "jwk" , key : CryptoKey ) : Promise < JsonWebKey > ; exportKey ( format : "raw" | "pkcs8" | "spki" , key : CryptoKey , ) : Promise < ArrayBuffer > ; exportKey ( format : KeyFormat , key : CryptoKey , ) : Promise < ArrayBuffer | JsonWebKey > ; generateKey ( algorithm : "Ed25519" , extractable : boolean , keyUsages : readonly (
"sign" | "verify" )
[] , ) : Promise < CryptoKeyPair > ; generateKey ( algorithm : RsaHashedKeyGenParams | EcKeyGenParams , extractable : boolean , keyUsages : readonly KeyUsage [] , ) : Promise < CryptoKeyPair > ; generateKey ( algorithm : Pbkdf2Params | AesKeyGenParams | HmacKeyGenParams , extractable : boolean , keyUsages : readonly KeyUsage [] , ) : Promise < CryptoKey > ; generateKey ( algorithm : AlgorithmIdentifier , extractable : boolean , keyUsages : KeyUsage [] , ) : Promise < CryptoKey | CryptoKeyPair > ; importKey ( format : "jwk" , keyData : JsonWebKey , algorithm : | AlgorithmIdentifier | HmacImportParams | RsaHashedImportParams | EcKeyImportParams | AesKeyAlgorithm , extractable : boolean , keyUsages : readonly KeyUsage [] , ) : Promise < CryptoKey > ; importKey ( format : "raw" | "pkcs8" | "spki" , keyData : BufferSource , algorithm : | AlgorithmIdentifier | HmacImportParams | RsaHashedImportParams | EcKeyImportParams | AesKeyAlgorithm , extractable : boolean , keyUsages : KeyUsage [] , ) : Promise < CryptoKey > ; sign ( algorithm : AlgorithmIdentifier | RsaPssParams | EcdsaParams , key : CryptoKey , data : BufferSource , ) : Promise < ArrayBuffer > ; unwrapKey ( format : KeyFormat , wrappedKey : BufferSource , unwrappingKey : CryptoKey , unwrapAlgorithm : | AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams , unwrappedKeyAlgorithm : | AlgorithmIdentifier | HmacImportParams | RsaHashedImportParams | EcKeyImportParams | AesKeyAlgorithm , extractable : boolean , keyUsages : KeyUsage [] , ) : Promise < CryptoKey > ; verify ( algorithm : AlgorithmIdentifier | RsaPssParams | EcdsaParams , key : CryptoKey , signature : BufferSource , data : BufferSource , ) : Promise < boolean > ; wrapKey ( format : KeyFormat , key : CryptoKey , wrappingKey : CryptoKey , wrapAlgorithm : | AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams , ) : Promise < ArrayBuffer > ; } Defined in node_modules/typescript/lib/lib.dom.d.ts:21834 Defined in node_modules/typescript/lib/lib.dom.d.ts:21867 Methodsdigest digest ( algorithm : AlgorithmIdentifier , data : BufferSource ) : Promise < ArrayBuffer > Returns Promise < ArrayBuffer > Defined in node_modules/typescript/lib/lib.dom.d.ts:21842 export Key exportKey ( format : "jwk" , key : CryptoKey ) : Promise < JsonWebKey > Defined in node_modules/typescript/lib/lib.dom.d.ts:21846 exportKey ( format : "raw" | "pkcs8" | "spki" , key : CryptoKey , ) : Promise < ArrayBuffer > Parameters format : "raw" | "pkcs8" | "spki" key : CryptoKey Returns Promise < ArrayBuffer > Defined in node_modules/typescript/lib/lib.dom.d.ts:21847 exportKey ( format : KeyFormat , key : CryptoKey ) : Promise < ArrayBuffer | JsonWebKey > Returns Promise < ArrayBuffer | JsonWebKey > Defined in node_modules/typescript/lib/lib.dom.d.ts:21848 generate Key generateKey ( algorithm : "Ed25519" , extractable : boolean , keyUsages : readonly ("sign" | "verify" )[] , ) : Promise < CryptoKeyPair > Parameters algorithm : "Ed25519" extractable : boolean keyUsages : readonly ("sign" | "verify" )[] Defined in node_modules/typescript/lib/lib.dom.d.ts:21850 generateKey ( algorithm : RsaHashedKeyGenParams | EcKeyGenParams , extractable : boolean , keyUsages : readonly KeyUsage [] , ) : Promise < CryptoKeyPair > Defined in node_modules/typescript/lib/lib.dom.d.ts:21851 generateKey ( algorithm : Pbkdf2Params | AesKeyGenParams | HmacKeyGenParams , extractable : boolean , keyUsages : readonly KeyUsage [] , ) : Promise < CryptoKey > Defined in node_modules/typescript/lib/lib.dom.d.ts:21852 generateKey ( algorithm : AlgorithmIdentifier , extractable : boolean , keyUsages : KeyUsage [] , ) : Promise < CryptoKey | CryptoKeyPair > Defined in node_modules/typescript/lib/lib.dom.d.ts:21853 import Key importKey ( format : "jwk" , keyData : JsonWebKey , algorithm : | AlgorithmIdentifier | HmacImportParams | RsaHashedImportParams | EcKeyImportParams | AesKeyAlgorithm , extractable : boolean , keyUsages : readonly KeyUsage [] , ) : Promise < CryptoKey > Defined in node_modules/typescript/lib/lib.dom.d.ts:21855 importKey ( format : "raw" | "pkcs8" | "spki" , keyData : BufferSource , algorithm : | AlgorithmIdentifier | HmacImportParams | RsaHashedImportParams | EcKeyImportParams | AesKeyAlgorithm , extractable : boolean , keyUsages : KeyUsage [] , ) : Promise < CryptoKey > Defined in node_modules/typescript/lib/lib.dom.d.ts:21856
This Web Crypto API interface provides a number of low-level cryptographic functions. It is accessed via the Crypto.subtle properties available in a window context (via Window.crypto). Available only in secure contexts.
MDN Reference