Changes 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723
  1. Changes
  2. =======
  3. v1.2.25 23 May 2022
  4. [Bug Fixes][Security]
  5. * [jwe] An old bug from at least 7 years ago existed in handling AES-CBC unpadding,
  6. where the unpad operation might remove more bytes than necessary (#744)
  7. This affects all jwx code that is available before v2.0.2 and v1.2.25.
  8. v1.2.24 05 May 2022
  9. [Security]
  10. * Upgrade golang.org/x/crypto (#724)
  11. v1.2.23 13 Apr 2022
  12. [Bug fixes]
  13. * [jwk] jwk.AutoRefresh had a race condition when `Configure()` was
  14. called concurrently (#686)
  15. (It has been patched correctly, but we may come back to revisit
  16. the design choices in the near future)
  17. v1.2.22 08 Apr 2022
  18. [Bug fixes]
  19. * [jws] jws.Verify was ignoring the `b64` header when it was present
  20. in the protected headers (#681). Now the following should work:
  21. jws.Sign(..., jws.WithDetachedPayload(payload))
  22. // previously payload had to be base64 encoded
  23. jws.Verify(..., jws.WithDetachedPayload(payload))
  24. (note: v2 branch was not affected)
  25. v1.2.21 30 Mar 2022
  26. [Bug fixes]
  27. * [jwk] RSA keys without p and q can now be parsed.
  28. v1.2.20 03 Mar 2022
  29. [Miscellaneous]
  30. * Dependency on golang.org/x/crypto has been upgraded to
  31. v0.0.0-20220214200702-86341886e292 to address
  32. https://nvd.nist.gov/vuln/detail/CVE-2020-14040 (#598)
  33. v1.2.19 22 Feb 2022
  34. [New Feature]
  35. * [jwk] jwk.Parse (and (jwk.AutoRefresh).Configure) can accept a new
  36. option `jwk.WithIgnoreParseError(bool)`, which allows users to ignore
  37. errors during parsing of each key contained in the JWKS, allowing
  38. you to "skip" invalid keys.
  39. This option should not be used lightly, as it hides the presence of
  40. possibly faulty keys. However, this can be an escape hatch if you are
  41. faced with a faulty JWKS that you do not control.
  42. v1.2.18 23 Jan 2022
  43. [Bug fixes]
  44. * [jwe] When presented with jwk.Key with a key ID, the jwe encryption
  45. code path did not assign this key ID to the resulting data structure.
  46. This has been fixed, and now the key ID is properly applied to the
  47. `kid` field.
  48. * [jws] Use for `crypto.Signer`s were implemented for signing, but verification was
  49. never properly implemented. This has been fixed.
  50. [Miscellaneous]
  51. * [jws] Because of fixes to code path that deals with `crypto.Signer`s, we are
  52. now able to fully integrate with Cloud services, such as Google's Cloud KMS
  53. and AWS KMS, that provide key management and signing payloads
  54. An implementation for these are available at https://github.com/jwx-go/crypto-signer.
  55. Suppot `crypto.Signer` in JWE encryption has not been implemented.
  56. v1.2.17 12 Jan 2022
  57. [Miscellaneous]
  58. * Re-release v1.2.16 as v1.2.17 because of an error in the release process.
  59. The code is exactly the same as what v1.2.16 intended to release.
  60. v1.2.16 has been retracted in go.mod.
  61. v1.2.16 12 Jan 2022
  62. THIS VERSION HAS BEEN RETRACTED. PLEASE USE v1.2.17
  63. [Bug Fixes]
  64. * Peviously, `jws.Sign()` could not create a signed payload with
  65. detached and unencoded payload, even when the documentation said it could.
  66. Now you may use the `jws.Sign()` in the following way to create
  67. a JWS message with detached, unencoded state:
  68. hdrs := jws.NewHeaders()
  69. hdrs.Set("b64", false)
  70. hdrs.Set("crit", "b64")
  71. jws.Sign(nil, alg, key, jws.WithDetachedPayload(payload), jws.WithHeaders(hdrs))
  72. Notice the use of `nil` for the first parameter, and the use of
  73. `jws.WithDetachedPayload()`.
  74. We realize this is not exactly a clean API, but this is currently the
  75. only way to implement this in a backward-compatible fashion. Most likely
  76. this will change in a future major version.
  77. [Miscellaneous]
  78. * `jws.WithDetachedPayload()` is now of type `jws.SignVerifyOption`, which
  79. satisfies both `jws.SignOption` and `jws.VerifyOption`
  80. v1.2.15 07 Jan 2022
  81. [New Features]
  82. * `(jwk.AutoRefresh).Remove()` has been implemented.
  83. [Bug Fixes]
  84. * ES256K is now included in the list of JWS inferred algorithms, if it's
  85. enabled via -tags jwx_es256k
  86. [Miscellaneous]
  87. * `jwt.Parse` has been improved for efficiency and has more tests to
  88. cover corner cases.
  89. * Documentation fixes
  90. v1.2.14 22 Dec 2021
  91. [New Features]
  92. * `jwk.Fetch()` and `(*jwk.AutoRefresh).Configure()` can now take `jwk.Whitelist`
  93. object to check for the validity of a url to be fetched
  94. * `jws.VerifyAuto()` has been added to verify payloads that can be verified
  95. using the JWK set provided in the "jku" field. This function is purposely
  96. separated from the `jws.Verify()` function because 1) the required parameters
  97. are different, and 2) Users MUST be aware that they are doing a totally
  98. different operation than a regular `jws.Verify()`
  99. * `(jwk.AutoRefresh).IsRegistered()` has been added.
  100. [Bug fixes]
  101. * `jws.SignMulti()` has been fixed to assign the "kid" field of the key used
  102. for signing the payload
  103. * `jws.SignMulti()` has been fixed to respect the "kid" field of the protected
  104. header, not the public header
  105. v1.2.13 07 Dec 2021
  106. [New Features]
  107. * `jwt` package now has a `Builder` that may make it easier to programmatically
  108. create a JWT for some users.
  109. * `jwt` errors now can be distinguished between validation errors and others.
  110. Use `jwt.IsValidationError()` to check if it's a validation error, and then
  111. use `errors.Is()` to check if it's one of the known (oft-used) errors
  112. v1.2.12 01 Dec 2021
  113. [New Features]
  114. * `jwk.Set` can now parse private parameters. For example, after parsing
  115. a JWKS serialized as `{"foo": "bar", "keys": [...]}`, users can get to
  116. the value of `"foo"` by calling `set.Field("foo")`
  117. * `jwk.Set` now has `Set()` method to set field values.
  118. v1.2.11 14 Nov 2021
  119. [Security Fix]
  120. * It was reported that since v1.2.6, it was possible to craft
  121. a special JSON object to bypass JWT verification via `jwt.Parse`.
  122. If you relied on this module to perform all the verification,
  123. upgrade is strongly recommended.
  124. v1.2.10 09 Nov 2021
  125. [Bug fixes]
  126. * Parsing OpenID claims were not working for some fields.
  127. This was caused by the same problem as the problem fixed in v1.2.9.
  128. Proper tests have been added.
  129. v1.2.9 26 Oct 2021
  130. [Bug fixes]
  131. * Parsing `key_ops` for JWKs which was broken in v1.2.8 has been fixed.
  132. v1.2.8 21 Oct 2021
  133. [Miscellaneous]
  134. * `jws.Message`, `jws.Signature`, `jws.Headers` have been reworked
  135. to allow JSON messages to be verified correctly. The problem can
  136. be caused when protected headers are serialized one way (perhaps
  137. `{"c":3","a":1,"b":2}` was used before being base64-encoded) but
  138. the Go serialization differed from it (Go serializes in alphabetical
  139. order: `{"a":1,"b":2,"c":3}`)
  140. Messages serialized in compact form do NOT suffer from the
  141. same problem.
  142. This is close to fixes that went in v1.2.2. It boils down to the
  143. fact that once deserialized, the JWS messages lose part of its
  144. information (namely, the raw, original protected header value),
  145. and neither users nor the developers of this library should
  146. rely on it.
  147. * Code generation has be refactored. The main go.mod should now
  148. have slightly less dependencies.
  149. v1.2.7 26 Sep 2021
  150. [New features]
  151. * `jwt.InferAlgorithmFromKey()` option is now available to "guess"
  152. the algorithm used to verify the JWS signature on a JWT using
  153. a JWKS (key set). This allows you to match JWKs that do not have
  154. the `alg` field populated.
  155. We understand that some providers do not provide the `alg` field,
  156. which is a nuisance to users. But from a purely security minded PoV,
  157. we don't think that this "try until something works" approach is a
  158. good one, even if there are no known exploits. This is why the
  159. default `jwt.Parse` mechanism is unchanged, and an explicit option
  160. has been added.
  161. * Types `jwt.KeySetProvider` and `jwk.KeySetProviderFunc` have been
  162. added. Along with `jwt.WithKeySetProvider()` option, `jwt.Parse`
  163. can now choose the `jwk.Set` to use for signature verification
  164. dynamically using the UNVERFIEID token as a clue.
  165. You should NOT trust the token information too much. For example,
  166. DO NOT directly use values from the token as verificatin parameters
  167. (such as the signature algorithm)
  168. * `jwt.WithValidator()` has been added to allow users pass in aribtrary
  169. validation code to the `jwt.Validate()` method.
  170. It is also now possible to pass in a `context.Context` object to
  171. `jwt.Validate()` using `jwt.WithContext()` option.
  172. [Miscellaneous]
  173. * Make the error messages when `jwt.ParseRequest` fails a bit better.
  174. * Moved around documentation within the repository
  175. * Validation logic for `jwt.Validate()` has been refactored to use the
  176. new `jwt.Validator` mechanism
  177. v1.2.6 24 Aug 2021
  178. [New features]
  179. * Support `crypto.Signer` keys for RSA, ECDSA, and EdDSA family
  180. of signatures in `jws.Sign`
  181. [Miscellaneous]
  182. * `jwx.GuessFormat()` now requires the presense of both `payload` and
  183. `signatures` keys for it to guess that a JSON object is a JWS message.
  184. * Slightly enhance `jwt.Parse()` performance.
  185. v1.2.5 04 Aug 2021
  186. [New features]
  187. * Implement RFC7797. The value of the header field `b64` changes
  188. how the payload is treated in JWS
  189. * Implement detached payloads for JWS
  190. * Implement (jwk.AutoRefresh).ErrorSink() to register a channel
  191. where you can receive errors from fetches and parses that occur during
  192. JWK(s) retrieval.
  193. v1.2.4 15 Jul 2021
  194. [Bug fixes]
  195. * We had the same off-by-one in another place and jumped the gun on
  196. releasing a new version. At least we were making mistakes uniformally :/
  197. `(jwk.Set).Remove` should finally be fixed.
  198. [New features]
  199. * `(jwk.Set).Clone()` has been added.
  200. v1.2.3 15 Jul 2021
  201. [Bug fixes]
  202. * jwk.Set incorrectly removed 2 elements instead of one.
  203. [Miscellaneous]
  204. * github.com/goccy/go-json has been upgraded to v0.7.4
  205. v1.2.2 13 Jul 2021
  206. [Deprecation notice]
  207. * `(jwe.Message).Decrypt()` will be removed from the API upon the next
  208. major release.
  209. [Bug Fixes]
  210. * `jwe.Decrypt` and `(jwe.Message).Decrypt()` failed to decrypt even
  211. with the correct message contents when used along with `jwe.RegisterCustomField`
  212. [New features]
  213. JWX
  214. * Add GuessFormat() function to guess what the payload is.
  215. JWT
  216. * Options `jwt.WithMinDelta()`, `jwt.WithMaxDelta()` have been added.
  217. These can be used to compare time-based fields in the JWT object.
  218. * Option `jwt.WithRequiredClaim()` has been added. This can be used
  219. to check that JWT contains the given claim.
  220. * `jwt.Parse` now understands payloads that have been encrypted _and_ signed.
  221. This is more in line with the RFC than the previous implementation, but
  222. due to the fact that it requires a couple of extra unmarshaling, it may
  223. add some amount of overhead.
  224. * `jwt.Serializer` has been added as an easy wrapper to perform multiple
  225. levels of serializations (e.g. apply JWS, then JWE)
  226. JWE
  227. * Option `jwe.WithMessage()` has been added. This allows the user to
  228. obtain both the decrypted payload _and_ the raw `*jwe.Message` in one
  229. go when `jwe.Decrypt()` is called
  230. * Option `jwe.WithPostParser()`, along with `jwe.PostParser` and `jwe.PostParseFunc`
  231. has been added. This allows advanced users to hook into the `jwe.Decrypt()`
  232. process. The hook is called right after the JWE message has been parsed,
  233. but before the actual decryption has taken place.
  234. * `(jwe.Message).Decrypt()` has been marked for deprecation in a next major release.
  235. JWS
  236. * Option `jwe.WithMessage()` has been added. This allows the user to
  237. obtain both the verified payload _and_ the raw `*jws.Message` in one
  238. go when `jws.Verify()` is called
  239. * Options to `jws.Sign()` are not of type `jws.SignOption`. There should be
  240. no user-visible effects unless you were storing these somewhere.
  241. v1.2.1 02 Jun 2021
  242. [New features]
  243. * Option `jwt.WithTypedClaim()` and `jwk.WithTypedField()` have been added.
  244. They allow a per-object custom conversion from their JSON representation
  245. to a Go object, much like `RegisterCustomField`.
  246. The difference is that whereas `RegisterCustomField` has global effect,
  247. these typed fields only take effect in the call where the option was
  248. explicitly passed.
  249. `jws` and `jwe` does not have these options because
  250. (1) JWS and JWE messages don't generally carry much in terms of custom data
  251. (2) This requires changes in function signatures.
  252. Only use these options when you absolutely need to. While it is a powerful
  253. tool, they do have many caveats, and abusing these features will have
  254. negative effects. See the documentation for details
  255. v1.2.0 30 Apr 2021
  256. This is a security fix release with minor incompatibilities from earlier version
  257. with regards to the behavior of `jwt.Verify()` function
  258. [Security Fix]
  259. * `jwt.Verify()` had improperly used the `"alg"` header from the JWS message
  260. when `jwt.WithKeySet()` option was used (potentially allowing exploits
  261. described in https://auth0.com/blog/critical-vulnerabilities-in-json-web-token-libraries/.
  262. This has been fixed by ONLY trusting the keys that you provide and
  263. using the `"alg"` header from the keys themselves. (#375, #381)
  264. As a side effect, `jwt.WithKeySet()` requires that all applicable keys
  265. to contain a valid `"alg"` header. Without this we cannot safely choose a key to use,
  266. and hence verification will fail.
  267. The requirement for the `"alg"` header on keys is an INCOMPATIBLE behavior.
  268. This may break existing code, if the key does not already have an `"alg"` header.
  269. [New features]
  270. * `jwt.Settings()` and `jwt.WithFlattenAudience(bool)` has been added
  271. to control how the "aud" claim is serialized into JSON. When this
  272. is enabled, all JWTs with a single "aud" claim will serialize
  273. the field as a single string, instead of an array of strings with
  274. a single element, i.e.:
  275. // jwt.WithFlattenAudience(true)
  276. {"aud": "foo"}
  277. // jwt.WithFlattenAudience(false)
  278. {"aud": ["foo"]}
  279. This setting has a global effect.
  280. [Buf fixes]
  281. * jwt.Validate now returns true if the value in `nbf` field is exactly
  282. the same as what the clock returns (e.g. token.nbf == time.Now())
  283. v1.1.7 02 Apr 2021
  284. [New features]
  285. * `jwk.New` `jwk.Parse`, `jwk.ParseKey` can now take a Certificate in
  286. ASN.1 DER format in PEM encoding to create a JWK.
  287. [Bug fixes]
  288. * Protect `jwk.New()` from invalid RSA/ECDSA keys (#360, #361)
  289. [Miscellaneous]
  290. * Removed "internal/blackmagic" and separated it to its own repository.
  291. * Removed unused "marshal proxy" objects in jwt
  292. * Added FAQ in `jwt` package
  293. v1.1.6 28 Mar 2021
  294. [Bug fixes]
  295. * When an object (e.g. JWT) has a null value and `AsMap()` is called,
  296. `github.com/lestrrat-go/iter` would panic.
  297. This should be fixed in `github.com/lestrrat-go/iter@v1.0.1` and
  298. the dependency has been updated accordingly
  299. [Miscellaneous]
  300. * Added How-to style docs under `docs/`
  301. * github.com/goccy/go-json dependency has been updated to v0.4.8
  302. v1.1.5 12 Mar 2021
  303. This is a security fix release. The JWT validation could be skipped
  304. for empty values. Upgrade recommended
  305. [Security Fix]
  306. * JWT validation could be skipped for empty fields (#352).
  307. [Bug fixes]
  308. * Allow setting JWT "typ" fields to any value (#351).
  309. * Remove stray replace directive in cmd/jwx/go.mod (#349)
  310. v1.1.4 02 Mar 2021
  311. [New features]
  312. * jwt.ParseRequest, jwt.ParseHeader, jwt.ParseForm have been added.
  313. They are convenience functions to parse JWTs out of a HTTP request.
  314. [Miscellaneous]
  315. * Fix jwt.Equals() so that comparison between values containing time.Time
  316. actually work
  317. * ES256K has been made non-default. You must enable it using a build tag
  318. go build -tags jwx_es256k ...
  319. Your program will still compile without this tag, but it will return
  320. an error during runtime, when ES256K is encountered.
  321. This feature is still experimental.
  322. v1.1.3 22 Feb 2021
  323. [New features]
  324. * Implemented ES256K signing (#337)
  325. This feature should be considered experimental
  326. [Miscellaneous]
  327. * Bump minimum required version to go1.15
  328. * Fix examples, bench, and cmd/jwx accidentally requiring go1.16
  329. * Dependencies for "github.com/goccy/go-json" has been upgraded to
  330. v0.4.7
  331. v1.1.2 16 Feb 2021
  332. [New features]
  333. * `RegisterCustomField()` has been added, which allows users to
  334. specify a private claim/field/header to decode into a particular
  335. object of choice, instead of map[string]interface{} or []interface{} (#332, #333)
  336. [Bug fixes]
  337. * Failures for `jwk.Key.MarshalJSON()` were not properly reported (#330, #331)
  338. [Miscellaneous]
  339. * `jwe.Encrypt()` now takes options. This should not matter unless you
  340. were somehow depending on its method signature.
  341. * Dependencies for "github.com/goccy/go-json" has been upgraded to
  342. v0.4.2
  343. v1.1.1 05 Feb 2021
  344. [New features]
  345. * Command line tool `jwx` has ben completely reworked, and it is
  346. now actually useful.
  347. * JWKs can now be serialized into PEM files with ASN.1 DER format
  348. data, which is useful when you need to work between JSON and PEM
  349. data formats.
  350. * Constants in jwa package now have can be listed via functions
  351. in each category.
  352. * jwe.Encrypt and jwe.Decrypt can now handle jwk.Key objects
  353. v1.1.0 31 Jan 2021
  354. v1.1.0 is a release that attempts to fix as many of the quirky APIs
  355. that survived the API breaking change of v0.9.x -> v1.0.0. This is
  356. hopefully the last releases that change backwards compatibility
  357. in a major way, at least for some time to come.
  358. It is unfortunate that we need to introduce API changes, but we
  359. keep learning how the library is being used and the pain points
  360. of using this library. Most of the times these pain points are
  361. things that we initially did not think about, which in turn
  362. requires us to rethink of the API.
  363. If you do not wish to spend the time fixing your usage, make sure
  364. you have your go.mod set up to not automatically track the latest
  365. changes.
  366. However, if you do decide to use the latest version, we believe
  367. the API is more uniform across packages, and generally is easier
  368. to understand. We hope this library helps some of you out there.
  369. [BREAKING CHANGES]
  370. * `jwk.Parse(io.Reader)`, `jws.Parse(io.Reader)`, `jwt.Parse(io.Reader)`,
  371. have all been changed to `Parse([]byte)`. To use an `io.Reader`,
  372. use `ParseReader(io.Reader)`. `jwe.Parse` already took `[]byte`, so
  373. has not been changed.
  374. With this change, all four package `jwe`, `jwk`, `jws`, and `jwt` follow
  375. the same API design, which should make things easier to navigate:
  376. Parse([]byte)
  377. ParseString(string)
  378. ParseReader(io.Reader)
  379. * `jwk.Set` is now an interface, not a struct. `jwk.Set` now has a
  380. well-defined API to access and modify the `jwk.Key` objects that it holds.
  381. Add(jwk.Key) bool
  382. Clear()
  383. Get(int) (jwk.Key, bool)
  384. Index(jwk.Key) int
  385. Len() int
  386. LookupKeyID() (jwk.Key, bool) // Read the section about it below
  387. Remove(jwk.Key) bool
  388. Iterate(context.Context) KeyIterator
  389. * `(jwk.Set).LookupKeyID()` no longer returns an array of `jwk.Key`.
  390. Instead, only the first key matching the given key ID will be returned.
  391. If you need to work with multiple keys, use `(jwk.Set).Iterate()` or
  392. `(jwk.Set).Get()` to look for matching keys.
  393. * `jwk.PublicKeyOf()` has been renamed to `jwk.PublicRawKeyOf()`,
  394. which converts raw keys (e.g. `rsa.PrivateKey`) to their public
  395. counter part (e.g. `rsa.PublicKey`)
  396. `jwk.PublicKeyOf()` is now used to get the public counter part of
  397. `jwk.Key` objects (e.g. `jwk.RSAPrivateKey` to `jwk.RSAPublicKey`)
  398. `jwk.PublicSetOf()` has been added to get a new `jwk.Set` but with
  399. all keys transformed to public keys via `jwk.PublicKeyOf()`
  400. * `jwk.FetchXXXX` functions have been removed. `jwk.Fetch()` remains, but
  401. it now takes `context.Context`, and doesn't support retrieving files
  402. from the local file system. See `ReadFile()` for that.
  403. * `jws.VerifyWithJKU()`, `jws.VerifyWithJWK()`, `jwk.VerifyWithJWKSet()`
  404. have all been removed, but `jwk.VerifySet(jwk.Set)` has been added.
  405. * `jws.SplitCompact(io.Reader)` has been changd to `jws.SplitCompact([]byte)`
  406. Similar to `Parse()`, `SplitCompactReader(io.Reader)` and `SplitCompactString(string)`
  407. have been added
  408. * `jws.SignLiteral` has been removed.
  409. * `jws.PayloadSigner` has been removed (but should not matter, because
  410. this as internal-use only anyways)
  411. * `jwe.WithPrettyJSONFormat` has been renamed to `jwe.WithPrettyFormat`
  412. * `jwt.Verify` has been removed. Use `jwt.Parse()` aloing with the `jwt.WithVerify()`
  413. option to perform signature verification. Validation of verified data
  414. can be performed via `(jwt.Token).Validate()` method, which has been available
  415. since v1.0.6
  416. * Package `buffer` has been removed. This package should have been an internal
  417. package to start with, but it was left because it had been incorporated
  418. in the public API in our initial versions.
  419. * `(jwk.Key).Get(jwk.X509CertChainKey)` no longer returns a `jwk.CertificateChain`.
  420. Instead it returns a raw []*x509.Certificate.
  421. * `(jwt.Token).Size() has been removed.
  422. * `jwt.WithOpenIDClaims()` has been removed. Use `jwt.WithToken(openid.New())` instead.
  423. [New Features]
  424. * `jwe.ReadFile(string)`, `jwk.ReadFile(string)`, `jws.ReadFile(string)`, and
  425. `jwt.ReadFile(string)` have been added. In the future, we plan to introduce
  426. a `WithFS` option so you can read from an arbitrary file system, but this cannot
  427. be added while we keep go < 1.16 compatibility. If you want something like that,
  428. you will need to put an adapter over the jwx for the time being.
  429. * `(jwk.Key).PublicKey()` has been added. This method creates a corresponding
  430. public key, with all fields (except those that shouldn't be) copied over.
  431. This allows you to easily create a public key of a private key with the
  432. same "kid" attribute.
  433. * Both `jws.Verify` and `jws.Sign` methods can now handle `jwk.Key` objects, on
  434. top of raw keys (e.g. rsa.PrivateKey). You no longer need to conver the
  435. `jwk.Key` objects that you have in to raw keys before using these functions.
  436. * `(jws.Header).Remove(string)`, `(jwk.Key).Remove(string)`, and
  437. `(jwt.Token).Remove(string)` have been added. `jwe.Header` already had a `Remove()`
  438. method, so it has not been changed.
  439. * `(jwk.Key).Clone() has been added.
  440. [Miscellaneous]
  441. * Default branch for the repository is now `main`.
  442. * Options have been reworked. In most instances, option types should now reflect
  443. better the contexts in which they can be used. For example, `jwk` now has
  444. `AutoRefreshOption` and `FetchOption` instead of a single `Option`.
  445. * JSON marshaling should be 10~30% faster by default (though they may take
  446. more allocations to achieve this).
  447. However, if performance is really bogging you down, you can try to enable
  448. the optional module github.com/goccy/go-json by enabling the "jwx_goccy" tag
  449. go build -tags jwx_goccy ...
  450. In some cases you get an extra 40~50% performance improvement in serailization
  451. https://github.com/lestrrat-go/jwx/pull/314#issue-560594020
  452. https://github.com/lestrrat-go/jwx/pull/314#issuecomment-766343888
  453. * Location for examples and benchmarks have changed: Now examples/ and bench/
  454. are their respective locations, and they are each a standalone module,
  455. so that in case we need extra imports (such as the case in examples)
  456. they do not interfere with users who just want to include jwx in their projects.
  457. v1.0.8 15 Jan 2021
  458. [New features]
  459. * Fixed `jws.Message` and `jws.Signature` to be properly formatted when
  460. marshaled into JSON. In the same manner, `json.Unmarshal` should also
  461. work as expected.
  462. * Added API to programatically manipulate `jws.Message` and `jws.Signature`
  463. [Miscellaneous]
  464. * The order of keys are now consistent as when used with `json.Marshal`.
  465. Previously some objects used their own ordering, but now the code goes
  466. through one extra roundtrip of `json.Unmarshal`/`json.Marshal` to preserve
  467. compatible behavior. This *may* lead to slightly slower performance if
  468. you are performing `json.Marshal` over and over in very quick succession.
  469. Please file an issue if you have real world cases where the change
  470. causes problems for you.
  471. * Added more examples in various places.
  472. * Tests runs have been sped up for the most oft used cases
  473. v1.0.7 11 Jan 2021
  474. [New features]
  475. * Added jwk.AutoRefresh, which is a tool to periodically refresh JWKS. (#265)
  476. * Added experimental ed25519 support (#252)
  477. [Bug fixes]
  478. * Fix `Set()` method for jwk Keys to properly accept either `jwk.KeyUsageType`
  479. or a simple string.
  480. [Miscellaneous]
  481. * Updated dependencies
  482. * Changed options to use github.com/lestrrat-go/option
  483. * Various typos, unused annotations, etc, have been fixed by contributors
  484. * Nobody except for the author really should care, but the underlying
  485. `pdebug` utility, which is used for print debugging, has been
  486. upgraded to v3, which should stop parallel test execution from throwing
  487. an error when run with -race
  488. v1.0.6 17 Dec 2020
  489. * Fix ECDHES ciphers where padding in AAD et al was creating
  490. incomptabile values with jose tool
  491. * Also fix ECDH-ES cek handling (#248)
  492. * Implement direct key encoding (#213, #249)
  493. * Allow JWT tokens to use default JWK if only one key is given
  494. and the JWT does not necessarily specifies a key (#214)
  495. * Deprecate jwt.Verify and introduce jwt.Validate. JWS verification
  496. used the term Verify, which was confusing when users wanted to
  497. validate the JWT token itself. (#220)
  498. * JWT library optins have been explicitly typed as ValidationOption
  499. and ParseOption (#220, #223)
  500. * Add jwx.DecoderSettings and jwx.WithUseNumber option to globally
  501. change how jwx parses JSON objects (#222)
  502. * Encode x5c field as base64 with padding (#244)
  503. * Add more interoperability tests against jose tool.
  504. * Special thanks to anatol and imirkin!
  505. v1.0.5 - 28 Sep 2020
  506. * Reinstate PrivateParams() method in jws and jwe packages.
  507. These used to be available until v1.0.0, but somehow got lost during the
  508. big change.
  509. As a workaround for users of versions 1.0.0 to 1.0.4, you could have
  510. achieved the same thing using AsMap() methods, albeit with a slight
  511. performance penality (#205, #206)
  512. v1.0.4 - 15 Aug 2020
  513. * Fix jwt.WithOpenIDClaims(). Looks like something got lost along
  514. the way, and it never really worked. (#201 #202)
  515. v1.0.3 - 08 Jul 2020
  516. * `jws.Sign`, and therefore `jwt.Sign` now accept `jwk.Key` as the
  517. key to use for signature. (#199)
  518. * `jwt.Sign` could sometimes return a nil error when setting bad
  519. values to the protected header failed (#195)
  520. * More golangci-lint cleanup (#193)
  521. v1.0.2 - 07 May 2020
  522. * Since 1.0.0, we took some time to play the test coverage game.
  523. The coverage is around 30% better, and we _did_ uncover some
  524. inconsistencies in the API, which got promptly fixed.
  525. But I'm tired of the coverage game for the time being. PR's welcome!
  526. * Add jwk.AssignKeyID to automatically assign a `kid` field to a JWK
  527. * Fix jwe.Encrypt / jwe.Decrypt to properly look at the `zip` field
  528. * Change jwe.Message accessors to return []byte, not buffer.Buffer
  529. v1.0.1 - 04 May 2020
  530. * Normalize all JWK serialization to use padding-less base64 encoding (#185)
  531. * Fix edge case unmarshaling openid.AddressClaim within a openid.Token
  532. * Fix edge case unmarshaling jwe.Message
  533. * Export JWK key-specific constants, such as jwk.RSANKey, jwk.SymmetricOctetsKey, etc
  534. * Remove some unused code
  535. v1.0.0 - 03 May 2020
  536. * All packages (`jws`, `jwe`, `jwk`, `jwt`) have all been reworked from
  537. the ground-up.
  538. * These packages now hide the actual implementation of the main structs behind an interface.
  539. * Header/Token structs must now be instantiated using proper constructors
  540. (most notably, json.Unmarshal will miserably fail if you just pass
  541. and empty interface via `xxx.Token` or similar)
  542. * Token/Header interfaces are now more or less standardized.
  543. The following API should be consistent between all relevant packages:
  544. * New()
  545. * Get()
  546. * Set()
  547. * Remove()
  548. * Iterate()
  549. * Walk()
  550. * AsMap()
  551. * Oft-used fields are no longer directly accessible:
  552. e.g. `token.KeyID = v` is no longer valid. You must set using `Set`
  553. (and `Remove`, if you are removing it), and use either `Get` or
  554. one of the utility methods such as `token.KeyID()`
  555. * Many helper functions and structs have been unexported. They were never
  556. meant to be anything useful for end-users, and hopefully it does not
  557. cause any problems.
  558. * Most errors type/instances have been removed from the public API
  559. * `jwt` package can now work with different token types, such as OpenID tokens.
  560. * `token.Sign` and `token.Verify` have been changed from methods to
  561. package functions `jwt.Sign` and `jwt.Verify`, to allow different
  562. types of tokens to be passed to the same logic.
  563. * Added a custom token type in `openid` sub-package to make it easier to
  564. work with OpenID claims
  565. * `jwt.Parse` (and its siblings) now accept `jwt.WithOpenIDClaims()`
  566. * `jwe` API has been reworked:
  567. * `MultiEncrypt` has been removed.
  568. * Serializer structs have been removed. Now you just need to call
  569. `jwe.Compact` or `jwe.JSON`
  570. * `jwk` API has been reworked:
  571. * `jwk.ParseKey` has been added
  572. * `jwk.Materialize` has been renamed to `Raw()`. A new corresponding
  573. method to initialize the key from a raw key (RSA/ECDSA/byte keys)
  574. called `FromRaw()` has also been added, which makes a nice pair.
  575. * `jws` API has been reworked
  576. * CI has been changed from Travis CI to Github Actions, and tests now
  577. include linting via `golangci-lint`
  578. v0.9.2 - 15 Apr 2020
  579. * Maintenance release to protect users from upcoming breaking changes
  580. v0.9.1 - 27 Feb 2020
  581. * Fix error wrapping in certain cases
  582. * Add Claims(), Walk(), and AsMap() to iterate claims, as well as
  583. getting the entire data out as a single map
  584. * Work with alternate base64 encodings when decoding
  585. v0.9.0 - 22 May 2019
  586. * Start tagging versions for good measure.