From bcf78eda1ac4b503f95a231fb018d7f539a4eb36 Mon Sep 17 00:00:00 2001 From: microshine Date: Fri, 25 Jan 2019 15:49:00 +0300 Subject: [PATCH] Add types --- index.d.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 index.d.ts diff --git a/index.d.ts b/index.d.ts new file mode 100644 index 0000000..5687371 --- /dev/null +++ b/index.d.ts @@ -0,0 +1,21 @@ +type NativeCrypto = Crypto; +type NativeSubtleCrypto = SubtleCrypto; +type NativeCryptoKey = CryptoKey; + +declare namespace WebCrypto { + + class Crypto implements NativeCrypto { + public subtle: SubtleCrypto; + public getRandomValues(array: T): T; + } + + class CryptoKey implements NativeCryptoKey { + public algorithm: KeyAlgorithm; + public extractable: boolean; + public type: KeyType; + public usages: KeyUsage[]; + } + +} + +export = WebCrypto;