Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

SubtleCrypto

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.

interface SubtleCrypto {
decrypt(
key: CryptoKey,
): Promise<ArrayBuffer>;
deriveBits(
baseKey: CryptoKey,
length: number,
): Promise<ArrayBuffer>;
deriveKey(
baseKey: CryptoKey,
extractable: boolean,
keyUsages: KeyUsage[],
): Promise<CryptoKey>;
deriveKey(
baseKey: CryptoKey,
extractable: boolean,
keyUsages: Iterable<KeyUsage>,
): Promise<CryptoKey>;
digest(algorithm: AlgorithmIdentifier, data: BufferSource): Promise<ArrayBuffer>;
encrypt(
key: CryptoKey,
): Promise<ArrayBuffer>;
exportKey(format: "jwk", key: CryptoKey): Promise<JsonWebKey>;
exportKey(format: Exclude<KeyFormat, "jwk">, key: CryptoKey): Promise<ArrayBuffer>;
generateKey(
extractable: boolean,
keyUsages: ReadonlyArray<KeyUsage>,
): Promise<CryptoKeyPair>;
generateKey(
extractable: boolean,
keyUsages: ReadonlyArray<KeyUsage>,
): Promise<CryptoKey>;
generateKey(
extractable: boolean,
keyUsages: KeyUsage[],
): Promise<CryptoKeyPair | CryptoKey>;
generateKey(
extractable: boolean,
keyUsages: ReadonlyArray<KeyUsage>,
): Promise<CryptoKeyPair>;
generateKey(
extractable: boolean,
keyUsages: ReadonlyArray<KeyUsage>,
): Promise<CryptoKey>;
generateKey(
extractable: boolean,
keyUsages: Iterable<KeyUsage>,
): Promise<CryptoKeyPair | CryptoKey>;
importKey(
format: "jwk",
keyData: JsonWebKey,
extractable: boolean,
keyUsages: ReadonlyArray<KeyUsage>,
): Promise<CryptoKey>;
importKey(
format: Exclude<KeyFormat, "jwk">,
keyData: BufferSource,
extractable: boolean,
keyUsages: KeyUsage[],
): Promise<CryptoKey>;
importKey(
format: "jwk",
keyData: JsonWebKey,
extractable: boolean,
keyUsages: ReadonlyArray<KeyUsage>,
): Promise<CryptoKey>;
importKey(
format: Exclude<KeyFormat, "jwk">,
keyData: BufferSource,
extractable: boolean,
keyUsages: Iterable<KeyUsage>,
): Promise<CryptoKey>;
sign(
key: CryptoKey,
): Promise<ArrayBuffer>;
unwrapKey(
format: KeyFormat,
wrappedKey: BufferSource,
unwrappingKey: CryptoKey,
extractable: boolean,
keyUsages: KeyUsage[],
): Promise<CryptoKey>;
unwrapKey(
format: KeyFormat,
wrappedKey: BufferSource,
unwrappingKey: CryptoKey,
extractable: boolean,
keyUsages: Iterable<KeyUsage>,
): Promise<CryptoKey>;
verify(
key: CryptoKey,
signature: BufferSource,
): Promise<boolean>;
wrapKey(
format: KeyFormat,
key: CryptoKey,
wrappingKey: CryptoKey,
): Promise<ArrayBuffer>;
}
var SubtleCrypto: {
prototype: SubtleCrypto;
new (): SubtleCrypto;
}
;

§Methods

§
decrypt(
key: CryptoKey,
): Promise<ArrayBuffer>
[src]
§
deriveBits(
baseKey: CryptoKey,
length: number,
): Promise<ArrayBuffer>
[src]
§
deriveKey(
baseKey: CryptoKey,
extractable: boolean,
keyUsages: KeyUsage[],
): Promise<CryptoKey>
[src]
§
deriveKey(
baseKey: CryptoKey,
extractable: boolean,
keyUsages: Iterable<KeyUsage>,
): Promise<CryptoKey>
[src]
§
digest(algorithm: AlgorithmIdentifier, data: BufferSource): Promise<ArrayBuffer>
[src]
§
encrypt(
key: CryptoKey,
): Promise<ArrayBuffer>
[src]
§
exportKey(format: "jwk", key: CryptoKey): Promise<JsonWebKey>
[src]
§
exportKey(format: Exclude<KeyFormat, "jwk">, key: CryptoKey): Promise<ArrayBuffer>
[src]
§
generateKey(
extractable: boolean,
keyUsages: ReadonlyArray<KeyUsage>,
): Promise<CryptoKeyPair>
[src]
§
generateKey(
extractable: boolean,
keyUsages: ReadonlyArray<KeyUsage>,
): Promise<CryptoKey>
[src]
§
generateKey(
extractable: boolean,
keyUsages: KeyUsage[],
): Promise<CryptoKeyPair | CryptoKey>
[src]
§
generateKey(
extractable: boolean,
keyUsages: ReadonlyArray<KeyUsage>,
): Promise<CryptoKeyPair>
[src]
§
generateKey(
extractable: boolean,
keyUsages: ReadonlyArray<KeyUsage>,
): Promise<CryptoKey>
[src]
§
generateKey(
extractable: boolean,
keyUsages: Iterable<KeyUsage>,
): Promise<CryptoKeyPair | CryptoKey>
[src]
§
importKey(
format: "jwk",
keyData: JsonWebKey,
extractable: boolean,
keyUsages: ReadonlyArray<KeyUsage>,
): Promise<CryptoKey>
[src]
§
importKey(
format: Exclude<KeyFormat, "jwk">,
keyData: BufferSource,
extractable: boolean,
keyUsages: KeyUsage[],
): Promise<CryptoKey>
[src]
§
importKey(
format: "jwk",
keyData: JsonWebKey,
extractable: boolean,
keyUsages: ReadonlyArray<KeyUsage>,
): Promise<CryptoKey>
[src]
§
importKey(
format: Exclude<KeyFormat, "jwk">,
keyData: BufferSource,
extractable: boolean,
keyUsages: Iterable<KeyUsage>,
): Promise<CryptoKey>
[src]
§
sign(
key: CryptoKey,
): Promise<ArrayBuffer>
[src]
§
unwrapKey(
format: KeyFormat,
wrappedKey: BufferSource,
unwrappingKey: CryptoKey,
extractable: boolean,
keyUsages: KeyUsage[],
): Promise<CryptoKey>
[src]
§
unwrapKey(
format: KeyFormat,
wrappedKey: BufferSource,
unwrappingKey: CryptoKey,
extractable: boolean,
keyUsages: Iterable<KeyUsage>,
): Promise<CryptoKey>
[src]
§
verify(
key: CryptoKey,
signature: BufferSource,
): Promise<boolean>
[src]
§
wrapKey(
format: KeyFormat,
key: CryptoKey,
wrappingKey: CryptoKey,
): Promise<ArrayBuffer>
[src]