Commit Graph

5 Commits

Author SHA1 Message Date
Kingsley Yung
2982929210 script: Add new KeyFormat and KeyUsage for modern algorithms (#40857)
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>
2025-11-28 03:55:10 +00:00
Kingsley Yung
1ec01cc25d script: Housekeeping WebIDL dictionaries of WebCrypto API (#40652)
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>
2025-11-15 10:17:19 +00:00
Kingsley Yung
f3d5617349 script: Check whether the generated crypto key has empty usages (#39328)
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>
2025-09-16 17:23:42 +00:00
Josh Matthews
bd9bb77295 script_bindings: Assert that serializable/transferable types have accurate WebIDL annotations (#38615)
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>
2025-08-13 08:36:04 +00:00
Josh Matthews
af8d7c2de7 script: Move code generation and webidl files to new script_bindings crate. (#35157)
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2025-01-24 20:47:43 +00:00