W3cubDocs

/Deno

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

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

Methods

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

© 2018–2021 the Deno authors
https://doc.deno.land/deno/stable/~/SubtleCrypto