mirror of
https://github.com/denoland/deno.git
synced 2024-12-01 16:51:13 -05:00
3f9187c366
Co-authored-by: Yacine Hmito yacinehmito@users.noreply.github.com
57 lines
1.2 KiB
TypeScript
57 lines
1.2 KiB
TypeScript
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
|
|
|
|
/// <reference no-default-lib="true" />
|
|
/// <reference lib="esnext" />
|
|
|
|
declare var crypto: Crypto;
|
|
|
|
declare interface Crypto {
|
|
readonly subtle: SubtleCrypto;
|
|
getRandomValues<
|
|
T extends
|
|
| Int8Array
|
|
| Int16Array
|
|
| Int32Array
|
|
| Uint8Array
|
|
| Uint16Array
|
|
| Uint32Array
|
|
| Uint8ClampedArray
|
|
| Float32Array
|
|
| Float64Array
|
|
| DataView
|
|
| null,
|
|
>(
|
|
array: T,
|
|
): T;
|
|
randomUUID(): string;
|
|
}
|
|
|
|
interface Algorithm {
|
|
name: string;
|
|
}
|
|
|
|
/** 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 {
|
|
digest(
|
|
algorithm: AlgorithmIdentifier,
|
|
data:
|
|
| Int8Array
|
|
| Int16Array
|
|
| Int32Array
|
|
| Uint8Array
|
|
| Uint16Array
|
|
| Uint32Array
|
|
| Uint8ClampedArray
|
|
| Float32Array
|
|
| Float64Array
|
|
| DataView
|
|
| ArrayBuffer,
|
|
): Promise<ArrayBuffer>;
|
|
}
|
|
|
|
declare var SubtleCrypto: {
|
|
prototype: SubtleCrypto;
|
|
new (): SubtleCrypto;
|
|
};
|
|
|
|
type AlgorithmIdentifier = string | Algorithm;
|