-
-
Notifications
You must be signed in to change notification settings - Fork 13
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
Add support for X.509 and a website #2
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Updated the `marshal.go` and `constants.go` files to provide additional validation for JSON Web Keys. This includes validation for use ("use"), key operation ("key_ops") and an X.509 Certificate's validity period. Adjusted the handling of the aforementioned attributes to work with JWKOptions. This allows more granular control over the JSON Web Keys. Enhancements in validation contribute to more streamlined and error-free JWK processing, whereas options manipulation enables customization for various use cases.
This commit refines error types in `marshal.go` for more specific error handling situations, specifically related to getting the X5U URI and validating a JSON Web Key (JWK). In addition, a `Validate()` function was included in the JWK interface for standardizing validation. Adjustments were made to `JWKValidateOptions`, adding explanations to each validation criteria and reorganizing the structure for clarity. The `GetX5U` function was implemented, providing a default way to obtain and validate X.509 certificate from the X5U URI. The function handles HTTP requests and potential timeout, addressing both network and parsing-related errors, thereby providing comprehensive error handling. These changes enable more specific errors to be thrown according to the problem encountered, which will greatly enhance debugging and issue tracking. Furthermore, it introduces the capacity to perform validation within the JWK structure, leading to improved data integrity and reliability.
This reverts commit d28c10a.
…rvation in comparison
In this commit, a new test case has been written for the NewJWKFromRawJSON function in jwk_test.go. This was done in order to increase the efficiency of code testing and ensure that the function correctly creates a JSON Web Key (JWK) from a given raw JSON string, handling potential errors appropriately. Various ID constants previously declared in multiple places within the test functions have also been brought up and declared globally for better readability and code structure. Changes were also made to include the 'alg' attribute to the `edExpected` constant.
…s not used elsewhere in these specific test cases. Instead of introducing unnecessary variables, we should utilize the blank identifier ('_') when we don't care about the returned data. This effectively consumes the returned value without declaring and utilizing memory space for it, and also makes it clear to other developers who might maintain the code in the future that we intentionally disregarded this returned data.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.