diff options
Diffstat (limited to 'extensions/crypto/lib.deno_crypto.d.ts')
-rw-r--r-- | extensions/crypto/lib.deno_crypto.d.ts | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/extensions/crypto/lib.deno_crypto.d.ts b/extensions/crypto/lib.deno_crypto.d.ts index 854696676..c787f5e3c 100644 --- a/extensions/crypto/lib.deno_crypto.d.ts +++ b/extensions/crypto/lib.deno_crypto.d.ts @@ -6,7 +6,7 @@ declare var crypto: Crypto; declare interface Crypto { - readonly subtle: null; + readonly subtle: SubtleCrypto; getRandomValues< T extends | Int8Array @@ -25,3 +25,33 @@ declare interface Crypto { ): 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; |