google / google/webcrypto.dart
Validate JWK for HmacSecretKey Class
- Dominant language
- Dart
- Stars
- 116
- Forks
- 110
- Avg merge
- 6d 8h
- Merged PRs (30d)
- 9
Description
Our goal is to make the API hard to use incorrectly. For the `HmacSecretKey` class we would want to validate the properties on `importJsonWebKey` against imported JWK to reduce the risk of accidentally using incorrect JWK. Below are a few options suggested by @jonasfj:
1. Make properties on `importJsonWebKey` optional, and validate them when present.
2. Make the properties `required` and validate with `jwk`.
We can try a mix for different parameters and we have a consensus of requiring the `alg` property to make it consistent with other JWK imports.
However, note that the [RFC 7517](https://datatracker.ietf.org/doc/html/rfc7517#section-4.4) states that the `alg` property is indeed optional and this should be kept into consideration while drafting a permanent solution for `webcrypto.dart`.
I will post my discovery here and would love to hear opinions on the same.
Contributor guide
Assessment
This issue has not been assessed yet.