The specification of Modern Algorithms in the Web Cryptography API
(https://wicg.github.io/webcrypto-modern-algos/) adds new key formats
and key usages to support modern cryptographic algorithms.
This patch adds those new key formats and key usages, preparing for the
implementation of the new algorithms.
Testing: No behavioral changes in existing cryptographic algorithms.
Existing tests suffice.
Fixes: Part of #40687
---------
Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>
Housekeeping of WebIDL dictionaries of WebCrypto API, including:
- Add/Fix spec links in `SubtleCrypto.webidl` and `CryptoKey.webidl`.
- Sort dictionaries in `subtlecrypto.webidl` based on the spec.
- Sort the `subtle` structs in `subtlecrypto.rs`, based on the spec.
- Reduce unneeded visibility of those `subtle` structs.
Testing: No behavioral change. Existing tests suffice.
Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>
The WebCryptoAPI spec requires that when we generate crypto keys by the
generateKey method of SubtleCrypto interface we have to check whether
the usages is empty. If the usages is empty, throw a SyntaxError.
FYI, Step 9 of
https://w3c.github.io/webcrypto/#SubtleCrypto-method-generateKey
We have not yet implemented this logic, and this patch implements it.
Testing: Pass WPT tests that were expected to fail.
---------
Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>
These changes add compile-time assertions that:
* any type that implements the Serializable/Transferable trait has a
`[Serializable]` or `[Transferable]` annotation in the interface WebIDL
* any WebIDL interface with the `[Serializable]` or `[Transferable]`
annotation implements the corresponding trait
This is useful because it means that WebIDL definitions will be less
confusing if you're trying to figure out whether Servo supports
serializing/transferring a particular interface type. It also makes
fixing #21715 in the future a little bit easier, because the annotations
will remain up to date.
Testing: compile-time only; no point in writing tests for this since it
involves webidl codegen.
---------
Signed-off-by: Josh Matthews <josh@joshmatthews.net>