DevToys icon indicating copy to clipboard operation
DevToys copied to clipboard

JWT encoding/decoding improvements

Open micahmo opened this issue 2 years ago • 1 comments

Pull request type

Please check the type of change your PR introduces:

  • [x] Bugfix
  • [x] New feature or enhancement
  • [ ] UI change (please include screenshot!)
  • [ ] Code style update (formatting, renaming)
  • [ ] Refactoring (no functional changes, no api changes)
  • [ ] Build related changes
  • [ ] Documentation content changes
  • [ ] Internationalization and localization
  • [ ] Other (please describe):

What is the current behavior?

Issue Number: N/A

What is the new behavior?

This PR includes a few improvements to JWT encoding/decoding.

  • Allow encoding tokens with RSA private keys
  • Make the header field readonly in encoding mode (since it doesn't currently affect the output, although that could be a future enhancement)
  • Allow validating signature with a certificate containing a public key
  • Fix an issue where the saved token algorithm was not loaded correctly

Other information

Quality check

Before creating this PR:

  • [x] Did you follow the code style guideline as described in CONTRIBUTING.md
  • [x] Did you build the app and test your changes?
  • [ ] Did you check for accessibility? On Windows, you can use Accessibility Insights for this.
  • [ ] Did you verify that the change work in Release build configuration
  • [x] Did you verify that all unit tests pass
  • [ ] If necessary and if possible, did you verify your changes on:
    • [x] Windows
    • [ ] macOS (DevToys 2.0)
    • [ ] Linux (DevToys 2.0)

micahmo avatar Jun 13 '23 04:06 micahmo

@btiteux , as you own this tool and know better about JWT than I do, could you please take a look at this PR? :)

veler avatar Jun 14 '23 01:06 veler