github lestrrat-go/jwx v1.0.0

latest releases: v1.2.29, v2.0.21, v2.0.20...
3 years ago

This marks a major revamp of the old code base, and in general has many improvements over the quirks from older versions. Please beware that the API has significantly changed, and breaks backwards compatibility. If you were previously using this library, then you WILL have to change how you use it.

Thanks to the many contributors who pointed out mistakes, and nudged me to take a hard look at the code to improve it in ways that I previously didn't immediately see.

v1.0.0 - 03 May 2020
  * All packages (`jws`, `jwe`, `jwk`, `jwt`) have all been reworked from
    the ground-up.
    * These packages now hide the actual implementation of the main structs behind an interface.
    * Header/Token structs must now be instantiated using proper constructors
      (most notably, json.Unmarshal will miserably fail if you just pass
       and empty interface via `xxx.Token` or similar)
    * Token/Header interfaces are now more or less standardized.
      The following API should be consistent between all relevant packages:
      * New()
      * Get()
      * Set()
      * Remove()
      * Iterate()
      * Walk()
      * AsMap()
    * Oft-used fields are no longer directly accessible:
      e.g. `token.KeyID = v` is no longer valid. You must set using `Set`
      (and `Remove`, if you are removing it), and use either `Get` or
      one of the utility methods such as `token.KeyID()`
    * Many helper functions and structs have been unexported. They were never
      meant to be anything useful for end-users, and hopefully it does not
      cause any problems.
    * Most errors type/instances have been removed from the public API
  * `jwt` package can now work with different token types, such as OpenID tokens.
    * `token.Sign` and `token.Verify` have been changed from methods to
      package functions `jwt.Sign` and `jwt.Verify`, to allow different
      types of tokens to be passed to the same logic.
    * Added a custom token type in `openid` sub-package to make it easier to
      work with OpenID claims
    * `jwt.Parse` (and its siblings) now accept `jwt.WithOpenIDClaims()`
  * `jwe` API has been reworked:
    * `MultiEncrypt` has been removed.
    * Serializer structs have been removed. Now you just need to call
      `jwe.Compact` or `jwe.JSON`
  * `jwk` API has been reworked:
    * `jwk.ParseKey` has been added
    * `jwk.Materialize` has been renamed to `Raw()`. A new corresponding
      method to initialize the key from a raw key (RSA/ECDSA/byte keys)
      called `FromRaw()` has also been added, which makes a nice pair.
  * `jws` API has been reworked
  * CI has been changed from Travis CI to Github Actions, and tests now
    include linting via `golangci-lint`

Don't miss a new jwx release

NewReleases is sending notifications on new releases.