Skip to content

Commit

Permalink
Make return types of SubtleCrypto methods more specific (#388)
Browse files Browse the repository at this point in the history
Also, reformat the WebIDL.
  • Loading branch information
twiss authored Dec 19, 2024
1 parent 90feb1e commit 0ac8c1b
Showing 1 changed file with 71 additions and 46 deletions.
117 changes: 71 additions & 46 deletions spec/Overview.html
Original file line number Diff line number Diff line change
Expand Up @@ -1231,52 +1231,77 @@ <h2>SubtleCrypto interface</h2>

[SecureContext,Exposed=(Window,Worker)]
interface SubtleCrypto {
Promise&lt;any> encrypt(AlgorithmIdentifier algorithm,
CryptoKey key,
BufferSource data);
Promise&lt;any> decrypt(AlgorithmIdentifier algorithm,
CryptoKey key,
BufferSource data);
Promise&lt;any> sign(AlgorithmIdentifier algorithm,
CryptoKey key,
BufferSource data);
Promise&lt;any> verify(AlgorithmIdentifier algorithm,
CryptoKey key,
BufferSource signature,
BufferSource data);
Promise&lt;any> digest(AlgorithmIdentifier algorithm,
BufferSource data);

Promise&lt;any> generateKey(AlgorithmIdentifier algorithm,
boolean extractable,
sequence&lt;KeyUsage> keyUsages );
Promise&lt;any> deriveKey(AlgorithmIdentifier algorithm,
CryptoKey baseKey,
AlgorithmIdentifier derivedKeyType,
boolean extractable,
sequence&lt;KeyUsage> keyUsages );
Promise&lt;ArrayBuffer> deriveBits(AlgorithmIdentifier algorithm,
CryptoKey baseKey,
optional unsigned long? length = null);

Promise&lt;CryptoKey> importKey(KeyFormat format,
(BufferSource or JsonWebKey) keyData,
AlgorithmIdentifier algorithm,
boolean extractable,
sequence&lt;KeyUsage> keyUsages );
Promise&lt;any> exportKey(KeyFormat format, CryptoKey key);

Promise&lt;any> wrapKey(KeyFormat format,
CryptoKey key,
CryptoKey wrappingKey,
AlgorithmIdentifier wrapAlgorithm);
Promise&lt;CryptoKey> unwrapKey(KeyFormat format,
BufferSource wrappedKey,
CryptoKey unwrappingKey,
AlgorithmIdentifier unwrapAlgorithm,
AlgorithmIdentifier unwrappedKeyAlgorithm,
boolean extractable,
sequence&lt;KeyUsage> keyUsages );
Promise&lt;ArrayBuffer> encrypt(
AlgorithmIdentifier algorithm,
CryptoKey key,
BufferSource data
);
Promise&lt;ArrayBuffer> decrypt(
AlgorithmIdentifier algorithm,
CryptoKey key,
BufferSource data
);
Promise&lt;ArrayBuffer> sign(
AlgorithmIdentifier algorithm,
CryptoKey key,
BufferSource data
);
Promise&lt;boolean> verify(
AlgorithmIdentifier algorithm,
CryptoKey key,
BufferSource signature,
BufferSource data
);
Promise&lt;ArrayBuffer> digest(
AlgorithmIdentifier algorithm,
BufferSource data
);

Promise&lt;(CryptoKey or CryptoKeyPair)> generateKey(
AlgorithmIdentifier algorithm,
boolean extractable,
sequence&lt;KeyUsage> keyUsages
);
Promise&lt;CryptoKey> deriveKey(
AlgorithmIdentifier algorithm,
CryptoKey baseKey,
AlgorithmIdentifier derivedKeyType,
boolean extractable,
sequence&lt;KeyUsage> keyUsages
);
Promise&lt;ArrayBuffer> deriveBits(
AlgorithmIdentifier algorithm,
CryptoKey baseKey,
optional unsigned long? length = null
);

Promise&lt;CryptoKey> importKey(
KeyFormat format,
(BufferSource or JsonWebKey) keyData,
AlgorithmIdentifier algorithm,
boolean extractable,
sequence&lt;KeyUsage> keyUsages
);
Promise&lt;(ArrayBuffer or JsonWebKey)> exportKey(
KeyFormat format,
CryptoKey key
);

Promise&lt;ArrayBuffer> wrapKey(
KeyFormat format,
CryptoKey key,
CryptoKey wrappingKey,
AlgorithmIdentifier wrapAlgorithm
);
Promise&lt;CryptoKey> unwrapKey(
KeyFormat format,
BufferSource wrappedKey,
CryptoKey unwrappingKey,
AlgorithmIdentifier unwrapAlgorithm,
AlgorithmIdentifier unwrappedKeyAlgorithm,
boolean extractable,
sequence&lt;KeyUsage> keyUsages
);
};
</pre>
<div class=note>
Expand Down

0 comments on commit 0ac8c1b

Please sign in to comment.