0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-10-30 09:08:00 -04:00
denoland-deno/extensions/crypto/lib.deno_crypto.d.ts
2021-06-06 12:57:10 +02:00

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;