jwx: [NOTICE] Changes for v1.1.0 (BREAKING CHANGES! PLEASE TEST)

Tracker issue for v1.1.0, which is planned to introduce breaking changes. Development is being done in https://github.com/lestrrat-go/jwx/tree/develop/v1.1.0

Planned Breaking Changes

  • Remove all Parse(io.Reader), ParseBytes([]byte), and ParseString(string) methods (closes #291)
    • Add Parse([]byte) and ParseReader(io.Reader) methods
    • Remove jws.ParseVerify
  • Change jwk.Set to a an interface (closes #293)
    • Change API to allow mutation. Add(jwk.Key), Remove(jwk.Key), Clear(), etc. (note: treat it as a “set”; don’t create lookups, because “kid” is not guaranteed to be there)
    • Fix JSON marshaling
    • (jwk.Set).LookupKeyID(string) returns the first jwk.Key matching the “kid”. If multiple kids are available, use (jwk.Set).Iterate(context.Context)
  • Remove jwk.PublicKeyOf(rawKey)
    • Add jwk.PublicRawKeyOf(rawKey)
    • Add jwk.PublicKeyOf(jwk.Key)
    • Add jwk.PublicSetOf(jwk.Set)
    • Change (jwk.Key).PublicKey() to return a jwk.Key. Implement it in all applicable key types
    • Make key.PublicKey() return a key with all fields (except for those explicitly not allowed) copied from the original key.
  • Remove jws.VerifyXXXX.
    • Allow jws.Verify() to take a raw key or a jwk.Key
    • Add jws.VerifySet([]byte, jwk.Set)
  • Remove jwk.FetchXXXX methods. Only jwk.Fetch() remains.
    • Reuse jwk.Fetch() from jwk.AutoRefresh.
    • Reclassify WithHTTPClient() as FetchOption
    • Rename WithRefreshBackoff() to WithFetchBackoff()
  • Add ReadFile() to all packages, to read from local file system. On go >= 1.16 , io/fs should be supported, so you could even embed your jwk in your compiled program
  • Remove jws.SplitCompact(io.Reader) (NEW!)
    • Add jws.SplitCompact([]byte)
    • Add jws.SplitCompactReader(io.Reader)
  • Remove jws.SignLiteral
  • Change options to jws.SignMulti
  • Change jwe.WithPrettyJSONFormat to jwe.WithPrettyFormat, and its return type to jws.SerializerOption
  • Remove buffer.Buffer

Miscellaneous

  • switch default branch to main
  • Optimizations
    • Optimize (jwk.Set).MarshalJSON (36% reduction in memory allocation)
    • Optimize (jwt.Token).MarshalJSON
    • Optimize (jws.Header).MarshalJSON
    • Optimize (jwe.Header).MarshalJSON

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 18 (6 by maintainers)

Commits related to this issue

Most upvoted comments

Not at all. The changes are straightforward and documented in the Changes file.

Cool. Now, Immagonnagotobed… brain fried for the day.

well deserved! I’m just starting out my day (I live in Toronto, Canada)

I went into a frenzy and implemented everything in a day. So much for shooting for April.

I guess it’s time I stop and take some feedback.

I just want to have some fresh eyes, and to that extent I’m just going to call on some people who have recently contributed to this repository in one form or the other. I will also ask from my Twitter account if anybody is interested.

So…

@sonard (sorry for the typo!) @anatol @imirkin @shaunco @gbolo

If any of you have some spare time, will you please check out the proposed changes in this issue, and the changes in #306? You absolutely do no have to feel obligated to do this for me, but if you do take the time to review, thank you very much in advance.