Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/deno/ext/crypto/lib.deno_crypto.d.ts>SubtleCrypto

A modern runtime for JavaScript and TypeScript.
Go to Latest
interface SubtleCrypto
import { type SubtleCrypto } from "https://deno.land/x/deno@v1.39.0/ext/crypto/lib.deno_crypto.d.ts";

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).

Methods

generateKey(
extractable: boolean,
keyUsages: KeyUsage[],
): Promise<CryptoKeyPair>
generateKey(
extractable: boolean,
keyUsages: KeyUsage[],
): Promise<CryptoKey>
generateKey(
extractable: boolean,
keyUsages: KeyUsage[],
): Promise<CryptoKeyPair | CryptoKey>
importKey(
format: "jwk",
keyData: JsonWebKey,
extractable: boolean,
keyUsages: KeyUsage[],
): Promise<CryptoKey>
importKey(
format: Exclude<KeyFormat, "jwk">,
keyData: BufferSource,
extractable: boolean,
keyUsages: KeyUsage[],
): Promise<CryptoKey>
exportKey(format: "jwk", key: CryptoKey): Promise<JsonWebKey>
exportKey(format: Exclude<KeyFormat, "jwk">, key: CryptoKey): Promise<ArrayBuffer>
sign(): Promise<ArrayBuffer>
verify(): Promise<boolean>
digest(algorithm: AlgorithmIdentifier, data: BufferSource): Promise<ArrayBuffer>
encrypt(): Promise<ArrayBuffer>
decrypt(): Promise<ArrayBuffer>
deriveBits(
baseKey: CryptoKey,
length: number,
): Promise<ArrayBuffer>
deriveKey(): Promise<CryptoKey>
wrapKey(
format: KeyFormat,
key: CryptoKey,
wrappingKey: CryptoKey,
): Promise<ArrayBuffer>
unwrapKey(
format: KeyFormat,
wrappedKey: BufferSource,
unwrappingKey: CryptoKey,
extractable: boolean,
keyUsages: KeyUsage[],
): Promise<CryptoKey>
variable SubtleCrypto
import { SubtleCrypto } from "https://deno.land/x/deno@v1.39.0/ext/crypto/lib.deno_crypto.d.ts";

type

{ readonly prototype: SubtleCrypto; new (): never; }