Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing type definitions in webcryptoapi.dart #273

Open
Schwusch opened this issue Jul 17, 2024 · 1 comment
Open

Missing type definitions in webcryptoapi.dart #273

Schwusch opened this issue Jul 17, 2024 · 1 comment

Comments

@Schwusch
Copy link

In 1.0.0, some SubtleCrypto methods have untyped parameters, thus making them hard to use:
E.g. importKey():
image

Before 1.0.0, it was possible to figure out and pass KeyAlgorithm(name: 'AES-GCM') as the algorithm argument. This class is however gone in 1.0.0.
Other missing definition examples are AesGcmParams, which was useful for SubtleCrypto.encrypt()/ SubtleCrypto.decrypt().
Current implementation of AlgorithmIdentifier is a simple typedef:

typedef AlgorithmIdentifier = JSAny;
@srujzs
Copy link
Contributor

srujzs commented Jul 17, 2024

Hmm, this may be a bug with the Web IDL but not sure.

KeyAlgorithm is defined but never used in the IDL except as a superinterface: https://github.com/w3c/webref/blob/5308f9a9c0914d765fcbbb55f7d01d313ae37eda/ed/idl/WebCryptoAPI.idl#L25. The subinterfaces are never referred to either.

7604578 uses the MDN compatibility data to avoid emitting experimental/nonstandard APIs. MDN doesn't contain compatibility data for dictionaries, so we depend on whether or not its used by a non-experimental/standard API to determine if we should emit the dictionary. Here, KeyAlgorithm is never actually used except as a superinterface, and the subinterfaces are never used either: https://github.com/w3c/webref/blob/5308f9a9c0914d765fcbbb55f7d01d313ae37eda/ed/idl/WebCryptoAPI.idl#L25. The case is the same with AesGcmParams: https://github.com/w3c/webref/blob/5308f9a9c0914d765fcbbb55f7d01d313ae37eda/ed/idl/WebCryptoAPI.idl#L206.

We could instead choose to only not emit dictionaries that are explicitly used by experimental/nonstandard APIs, and that may cover this, but it also may mean we're including some dictionary types that are subject to change often.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

2 participants