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.
class SubtleCrypto | globals module | Bun BuildDocsReferenceGuidesBlogDiscord/Globals/SubtleCryptoMdecryptMderiveBitsMderiveKeyMdigestMencryptMexportKeyMgenerateKeyMimportKeyMsignMunwrapKeyMverifyMwrapKey BuildDocsReferenceGuidesBlogDiscord /Globals/SubtleCryptoMdecryptMderiveBitsMderiveKeyMdigestMencryptMexportKeyMgenerateKeyMimportKeyMsignMunwrapKeyMverifyMwrapKey decrypt(algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams,key: CryptoKey,data: BufferSource): PromiseArrayBuffer>; deriveBits(algorithm: AlgorithmIdentifier | EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params,baseKey: CryptoKey,length?: null | number): PromiseArrayBuffer>; deriveKey(algorithm: AlgorithmIdentifier | EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params,baseKey: CryptoKey,derivedKeyType: AlgorithmIdentifier | HkdfParams | Pbkdf2Params | AesDerivedKeyParams | HmacImportParams,extractable: boolean,keyUsages: KeyUsage[]): PromiseCryptoKey>; deriveKey(algorithm: AlgorithmIdentifier | EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params,baseKey: CryptoKey,derivedKeyType: AlgorithmIdentifier | HkdfParams | Pbkdf2Params | AesDerivedKeyParams | HmacImportParams,extractable: boolean,keyUsages: IterableKeyUsage>): PromiseCryptoKey>; digest(algorithm: AlgorithmIdentifier,data: BufferSource): PromiseArrayBuffer>; encrypt(algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams,key: CryptoKey,data: BufferSource): PromiseArrayBuffer>; exportKey(format: 'jwk',key: CryptoKey): PromiseJsonWebKey>; exportKey(format: 'spki' | 'pkcs8' | 'raw',key: CryptoKey): PromiseArrayBuffer>;exportKey(format: KeyFormat,key: CryptoKey): PromiseArrayBuffer | JsonWebKey>;generateKey(algorithm: 'Ed25519' | { name: 'Ed25519' },extractable: boolean,keyUsages: readonly 'sign' | 'verify'[]): PromiseCryptoKeyPair>; generateKey(algorithm: RsaHashedKeyGenParams | EcKeyGenParams,extractable: boolean,keyUsages: readonly KeyUsage[]): PromiseCryptoKeyPair>;generateKey(algorithm: Pbkdf2Params | AesKeyGenParams | HmacKeyGenParams,extractable: boolean,keyUsages: readonly KeyUsage[]): PromiseCryptoKey>;generateKey(algorithm: AlgorithmIdentifier,extractable: boolean,keyUsages: KeyUsage[]): PromiseCryptoKeyPair | CryptoKey>;generateKey(algorithm: AlgorithmIdentifier,extractable: boolean,keyUsages: IterableKeyUsage>): PromiseCryptoKeyPair | CryptoKey>;importKey(format: 'jwk',keyData: JsonWebKey,algorithm: AlgorithmIdentifier | HmacImportParams | RsaHashedImportParams | EcKeyImportParams | AesKeyAlgorithm,extractable: boolean,keyUsages: readonly KeyUsage[]): PromiseCryptoKey>; importKey(format: 'spki' | 'pkcs8' | 'raw',keyData: BufferSource,algorithm: AlgorithmIdentifier | HmacImportParams | RsaHashedImportParams | EcKeyImportParams | AesKeyAlgorithm,extractable: boolean,keyUsages: KeyUsage[]): PromiseCryptoKey>;importKey(format: 'spki' | 'pkcs8' | 'raw',keyData: BufferSource,algorithm: AlgorithmIdentifier | HmacImportParams | RsaHashedImportParams | EcKeyImportParams | AesKeyAlgorithm,extractable: boolean,keyUsages: IterableKeyUsage>): PromiseCryptoKey>;sign(algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams,key: CryptoKey,data: BufferSource): PromiseArrayBuffer>; unwrapKey(format: KeyFormat,wrappedKey: BufferSource,unwrappingKey: CryptoKey,unwrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams,unwrappedKeyAlgorithm: AlgorithmIdentifier | HmacImportParams | RsaHashedImportParams | EcKeyImportParams | AesKeyAlgorithm,extractable: boolean,keyUsages: KeyUsage[]): PromiseCryptoKey>; unwrapKey(format: KeyFormat,wrappedKey: BufferSource,unwrappingKey: CryptoKey,unwrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams,unwrappedKeyAlgorithm: AlgorithmIdentifier | HmacImportParams | RsaHashedImportParams | EcKeyImportParams | AesKeyAlgorithm,extractable: boolean,keyUsages: IterableKeyUsage>): PromiseCryptoKey>; verify(algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams,key: CryptoKey,signature: BufferSource,data: BufferSource): Promiseboolean>; wrapKey(format: KeyFormat,key: CryptoKey,wrappingKey: CryptoKey,wrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams): PromiseArrayBuffer>;
Search the reference...
/
class
SubtleCryptoclass SubtleCryptoResources
ReferenceDocsGuidesDiscordMerch StoreGitHubBlogToolkit
RuntimePackage managerTest runnerBundlerPackage runnerProject
Bun 1.0Bun 1.1Bun 1.2Bun 1.3RoadmapContributingLicenseBaked with ❤️ in San Francisco
We're hiring →class SubtleCrypto | globals module | Bun,AI智能索引,全网链接索引,智能导航,网页索引
- 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](https://developer.mozilla.org/docs/Web/API/SubtleCrypto)