2023-12-15 22:03:04 +01:00
|
|
|
#import <Crypto/CryptoKey.idl>
|
|
|
|
|
2023-12-14 20:56:30 +01:00
|
|
|
typedef (object or DOMString) AlgorithmIdentifier;
|
|
|
|
|
|
|
|
dictionary Algorithm {
|
2024-01-17 21:03:20 +01:00
|
|
|
required DOMString name;
|
2023-12-14 20:56:30 +01:00
|
|
|
};
|
|
|
|
|
2023-12-15 23:40:52 +01:00
|
|
|
enum KeyFormat { "raw", "spki", "pkcs8", "jwk" };
|
|
|
|
|
|
|
|
dictionary RsaOtherPrimesInfo {
|
|
|
|
// The following fields are defined in Section 6.3.2.7 of JSON Web Algorithms
|
|
|
|
DOMString r;
|
|
|
|
DOMString d;
|
|
|
|
DOMString t;
|
|
|
|
};
|
|
|
|
|
2024-09-10 16:21:16 +09:00
|
|
|
dictionary JsonWebKey {
|
2023-12-15 23:40:52 +01:00
|
|
|
// The following fields are defined in Section 3.1 of JSON Web Key
|
|
|
|
DOMString kty;
|
|
|
|
DOMString use;
|
|
|
|
sequence<DOMString> key_ops;
|
|
|
|
DOMString alg;
|
|
|
|
|
|
|
|
// The following fields are defined in JSON Web Key Parameters Registration
|
|
|
|
boolean ext;
|
|
|
|
|
|
|
|
// The following fields are defined in Section 6 of JSON Web Algorithms
|
|
|
|
DOMString crv;
|
|
|
|
DOMString x;
|
|
|
|
DOMString y;
|
|
|
|
DOMString d;
|
|
|
|
DOMString n;
|
|
|
|
DOMString e;
|
|
|
|
DOMString p;
|
|
|
|
DOMString q;
|
|
|
|
DOMString dp;
|
|
|
|
DOMString dq;
|
|
|
|
DOMString qi;
|
|
|
|
sequence<RsaOtherPrimesInfo> oth;
|
|
|
|
DOMString k;
|
|
|
|
};
|
|
|
|
|
2023-10-25 17:27:19 +02:00
|
|
|
// https://w3c.github.io/webcrypto/#subtlecrypto-interface
|
2023-09-03 02:00:01 +12:00
|
|
|
[SecureContext,Exposed=(Window,Worker)]
|
2021-12-13 20:48:27 +00:00
|
|
|
interface SubtleCrypto {
|
2024-03-14 22:39:48 -06:00
|
|
|
Promise<any> encrypt(AlgorithmIdentifier algorithm, CryptoKey key, BufferSource data);
|
2024-03-14 22:47:06 -06:00
|
|
|
Promise<any> decrypt(AlgorithmIdentifier algorithm, CryptoKey key, BufferSource data);
|
2024-03-26 23:53:35 +01:00
|
|
|
Promise<any> sign(AlgorithmIdentifier algorithm, CryptoKey key, BufferSource data);
|
2024-03-27 01:50:25 +01:00
|
|
|
Promise<any> verify(AlgorithmIdentifier algorithm, CryptoKey key, BufferSource signature, BufferSource data);
|
2023-10-25 17:27:19 +02:00
|
|
|
|
2023-12-14 20:56:30 +01:00
|
|
|
Promise<any> digest(AlgorithmIdentifier algorithm, BufferSource data);
|
2023-10-25 17:27:19 +02:00
|
|
|
|
2024-03-27 20:51:18 +01:00
|
|
|
Promise<any> generateKey(AlgorithmIdentifier algorithm, boolean extractable, sequence<KeyUsage> keyUsages);
|
|
|
|
Promise<any> deriveKey(AlgorithmIdentifier algorithm, CryptoKey baseKey, AlgorithmIdentifier derivedKeyType, boolean extractable, sequence<KeyUsage> keyUsages);
|
2024-12-17 16:13:20 +01:00
|
|
|
// FIXME: Promise<ArrayBuffer> deriveBits(AlgorithmIdentifier algorithm, CryptoKey baseKey, optional unsigned long? length = null);
|
|
|
|
Promise<ArrayBuffer> deriveBits(AlgorithmIdentifier algorithm, CryptoKey baseKey, optional unsigned long? length);
|
2023-10-25 17:27:19 +02:00
|
|
|
|
2023-12-15 22:03:04 +01:00
|
|
|
Promise<CryptoKey> importKey(KeyFormat format, (BufferSource or JsonWebKey) keyData, AlgorithmIdentifier algorithm, boolean extractable, sequence<KeyUsage> keyUsages);
|
2024-03-13 21:19:57 -06:00
|
|
|
Promise<any> exportKey(KeyFormat format, CryptoKey key);
|
2023-10-25 17:27:19 +02:00
|
|
|
|
2024-12-14 12:23:52 +01:00
|
|
|
Promise<any> wrapKey(KeyFormat format, CryptoKey key, CryptoKey wrappingKey, AlgorithmIdentifier wrapAlgorithm);
|
|
|
|
Promise<CryptoKey> unwrapKey(KeyFormat format, BufferSource wrappedKey, CryptoKey unwrappingKey, AlgorithmIdentifier unwrapAlgorithm, AlgorithmIdentifier unwrappedKeyAlgorithm, boolean extractable, sequence<KeyUsage> keyUsages);
|
2021-12-13 20:48:27 +00:00
|
|
|
};
|