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

Add support for X.509 and a website #2

Merged
merged 61 commits into from
Dec 6, 2023
Merged

Add support for X.509 and a website #2

merged 61 commits into from
Dec 6, 2023

Conversation

MicahParks
Copy link
Owner

No description provided.

Micah Parks and others added 30 commits November 12, 2023 14:09
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.
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.
@MicahParks MicahParks merged commit 30b57c3 into master Dec 6, 2023
@MicahParks MicahParks deleted the x509 branch December 6, 2023 01:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant