@@ -1698,13 +1698,47 @@ declare class SubtleCrypto {
1698
1698
// generateKey(algorithm: AesKeyGenParams | HmacKeyGenParams | Pbkdf2Params, extractable: boolean, keyUsages: ReadonlyArray<KeyUsage>): Promise<CryptoKey>;
1699
1699
// generateKey(algorithm: AlgorithmIdentifier, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKeyPair | CryptoKey>;
1700
1700
// importKey(format: "jwk", keyData: JsonWebKey, algorithm: AlgorithmIdentifier | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | AesKeyAlgorithm, extractable: boolean, keyUsages: ReadonlyArray<KeyUsage>): Promise<CryptoKey>;
1701
+ importKey ( format : "jwk" , keyData : JsonWebKey , algorithm : AlgorithmIdentifier | RsaHashedImportParams , extractable : boolean , keyUsages : ReadonlyArray < KeyUsage > ) : Promise < CryptoKey > ;
1701
1702
// importKey(format: Exclude<KeyFormat, "jwk">, keyData: BufferSource, algorithm: AlgorithmIdentifier | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | AesKeyAlgorithm, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKey>;
1702
1703
// sign(algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams, key: CryptoKey, data: BufferSource): Promise<ArrayBuffer>;
1704
+ sign ( algorithm : AlgorithmIdentifier , key : CryptoKey , data : BufferSource ) : Promise < ArrayBuffer > ;
1703
1705
// unwrapKey(format: KeyFormat, wrappedKey: BufferSource, unwrappingKey: CryptoKey, unwrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams, unwrappedKeyAlgorithm: AlgorithmIdentifier | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | AesKeyAlgorithm, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKey>;
1704
1706
// verify(algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams, key: CryptoKey, signature: BufferSource, data: BufferSource): Promise<boolean>;
1707
+ verify ( algorithm : AlgorithmIdentifier , key : CryptoKey , signature : BufferSource , data : BufferSource ) : Promise < boolean > ;
1705
1708
// wrapKey(format: KeyFormat, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams): Promise<ArrayBuffer>;
1706
1709
}
1707
1710
1711
+ interface RsaHashedImportParams extends Algorithm {
1712
+ hash : HashAlgorithmIdentifier ;
1713
+ }
1714
+ type HashAlgorithmIdentifier = AlgorithmIdentifier ;
1715
+
1716
+ interface JsonWebKey {
1717
+ alg ?: string ;
1718
+ crv ?: string ;
1719
+ d ?: string ;
1720
+ dp ?: string ;
1721
+ dq ?: string ;
1722
+ e ?: string ;
1723
+ ext ?: boolean ;
1724
+ k ?: string ;
1725
+ key_ops ?: string [ ] ;
1726
+ kty ?: string ;
1727
+ n ?: string ;
1728
+ oth ?: RsaOtherPrimesInfo [ ] ;
1729
+ p ?: string ;
1730
+ q ?: string ;
1731
+ qi ?: string ;
1732
+ use ?: string ;
1733
+ x ?: string ;
1734
+ y ?: string ;
1735
+ }
1736
+
1737
+ interface RsaOtherPrimesInfo {
1738
+ d ?: string ;
1739
+ r ?: string ;
1740
+ t ?: string ;
1741
+ }
1708
1742
1709
1743
/**
1710
1744
* The Crypto interface as [specified by WHATWG](https://w3c.github.io/webcrypto/#crypto-interface)
@@ -1731,3 +1765,33 @@ declare var Crypto: {
1731
1765
*/
1732
1766
declare var crypto : Crypto ;
1733
1767
1768
+ /**
1769
+ * The CryptoKey dictionary of the Web Crypto API represents a cryptographic key.
1770
+ * Available only in secure contexts.
1771
+ *
1772
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey)
1773
+ */
1774
+ interface CryptoKey {
1775
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/algorithm) */
1776
+ readonly algorithm : KeyAlgorithm ;
1777
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/extractable) */
1778
+ readonly extractable : boolean ;
1779
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/type) */
1780
+ readonly type : KeyType ;
1781
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/usages) */
1782
+ readonly usages : KeyUsage [ ] ;
1783
+ }
1784
+
1785
+ declare var CryptoKey : {
1786
+ prototype : CryptoKey ;
1787
+ new ( ) : CryptoKey ;
1788
+ } ;
1789
+
1790
+
1791
+ interface KeyAlgorithm {
1792
+ name : string ;
1793
+ }
1794
+
1795
+ type KeyFormat = "jwk" | "pkcs8" | "raw" | "spki" ;
1796
+ type KeyType = "private" | "public" | "secret" ;
1797
+ type KeyUsage = "decrypt" | "deriveBits" | "deriveKey" | "encrypt" | "sign" | "unwrapKey" | "verify" | "wrapKey" ;
0 commit comments