From fccc52457a90ce00d625c3ed8d5d3443e903a91b Mon Sep 17 00:00:00 2001 From: lestrrat <49281+lestrrat@users.noreply.github.com> Date: Tue, 21 Mar 2023 12:29:06 +0900 Subject: [PATCH] Update v2 (#894) * Update deps * Protect jws.Verify() and jwe.Encrypt() from panic on go1.19+ (#841) * Protect jws.Verify() from panic on go1.19+ * Same problem, but in jwe * Update Changes * fix example (#843) I have a feeling we inadvertently reverted some commit * Action updates, doc tweaks (#844) * Use tparse (#845) * Use tparse * s/all/alltags/ * fix typo (#846) * fix typo (#847) * Bump kentaro-m/auto-assign-action from 1.2.0 to 1.2.4 (#848) Bumps [kentaro-m/auto-assign-action](https://github.com/kentaro-m/auto-assign-action) from 1.2.0 to 1.2.4. - [Release notes](https://github.com/kentaro-m/auto-assign-action/releases) - [Commits](https://github.com/kentaro-m/auto-assign-action/compare/v1.2.0...v1.2.4) --- updated-dependencies: - dependency-name: kentaro-m/auto-assign-action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump codecov/codecov-action from 1 to 3 (#849) Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 1 to 3. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/codecov/codecov-action/compare/v1...v3) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Work with invalid JWT buffers better (#851) * Work with invalid JWT buffers better * spelling * Update Changes * typo * Tweak Changes * Update Changes * Bump github.com/goccy/go-json from 0.9.11 to 0.10.0 (#855) Bumps [github.com/goccy/go-json](https://github.com/goccy/go-json) from 0.9.11 to 0.10.0. - [Release notes](https://github.com/goccy/go-json/releases) - [Changelog](https://github.com/goccy/go-json/blob/master/CHANGELOG.md) - [Commits](https://github.com/goccy/go-json/compare/v0.9.11...v0.10.0) --- updated-dependencies: - dependency-name: github.com/goccy/go-json dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump github.com/lestrrat-go/option from 1.0.0 to 1.0.1 (#858) Bumps [github.com/lestrrat-go/option](https://github.com/lestrrat-go/option) from 1.0.0 to 1.0.1. - [Release notes](https://github.com/lestrrat-go/option/releases) - [Commits](https://github.com/lestrrat-go/option/compare/v1.0.0...v1.0.1) --- updated-dependencies: - dependency-name: github.com/lestrrat-go/option dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump actions/stale from 6 to 7 (#859) Bumps [actions/stale](https://github.com/actions/stale) from 6 to 7. - [Release notes](https://github.com/actions/stale/releases) - [Changelog](https://github.com/actions/stale/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/stale/compare/v6...v7) --- updated-dependencies: - dependency-name: actions/stale dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Tweak v2 tests (#863) * Port changes from #862 * Actually report errors * fix expected result * Unbeknownst to me, benchstat seems to have changed * Update Contribution Guidelines * Fix generated header file comments (#867) The generated file header should match regexp: ^// Code generated .* DO NOT EDIT\.$ See https://golang.org/s/generatedcode. * Remove unused variables in ReadFile (#866) * Bump kentaro-m/auto-assign-action from 1.2.4 to 1.2.5 (#868) Bumps [kentaro-m/auto-assign-action](https://github.com/kentaro-m/auto-assign-action) from 1.2.4 to 1.2.5. - [Release notes](https://github.com/kentaro-m/auto-assign-action/releases) - [Commits](https://github.com/kentaro-m/auto-assign-action/compare/v1.2.4...v1.2.5) --- updated-dependencies: - dependency-name: kentaro-m/auto-assign-action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Update tool deps (#869) * Try updating tools for genjwt * Update genjws * Update genjwe * Update genjwk * Update genjwa * Update genjwk * Updage genoptions * Update genreadfile * Fix PEM armor for EC private keys when encoding (#876) * Incorporate #875 * Test PEM roundtrip for other key types * Use more constants * Bump golang.org/x/crypto from 0.0.0-20220427172511-eb4f295cb31f to 0.6.0 (#871) * Bump golang.org/x/crypto from 0.0.0-20220427172511-eb4f295cb31f to 0.6.0 Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.0.0-20220427172511-eb4f295cb31f to 0.6.0. - [Release notes](https://github.com/golang/crypto/releases) - [Commits](https://github.com/golang/crypto/commits/v0.6.0) --- updated-dependencies: - dependency-name: golang.org/x/crypto dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * run appropriate `go get` and `go mod tidy` all over --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Daisuke Maki * Bump github.com/stretchr/testify from 1.8.1 to 1.8.2 (#873) * Bump github.com/stretchr/testify from 1.8.1 to 1.8.2 Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.8.1 to 1.8.2. - [Release notes](https://github.com/stretchr/testify/releases) - [Commits](https://github.com/stretchr/testify/compare/v1.8.1...v1.8.2) --- updated-dependencies: - dependency-name: github.com/stretchr/testify dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * run appropriate `go get` and `go mod tidy` all over --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Daisuke Maki * Update Changes * Create codeql.yml * Bump golang.org/x/crypto from 0.6.0 to 0.7.0 (#877) * Bump golang.org/x/crypto from 0.6.0 to 0.7.0 Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.6.0 to 0.7.0. - [Release notes](https://github.com/golang/crypto/releases) - [Commits](https://github.com/golang/crypto/compare/v0.6.0...v0.7.0) --- updated-dependencies: - dependency-name: golang.org/x/crypto dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * run go get and make tidy --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Daisuke Maki * Add bazel support (#880) * Attempt to enable bazel * enable bazel building in smoke tests too * tweak order * Add explicit imports * Add deps.bzl * remove unused file reference * Add missing BUILD file * Add missing BUILD file * add missing BUILD.bazel files * add .bazelversion * Add aspect presets * Update Changes/README * Create an auto-merge action for dependabot (#884) * Create an auto-merge action for dependabot * approve and merge * indent * Bump github.com/goccy/go-json from 0.10.0 to 0.10.1 (#882) * Bump github.com/goccy/go-json from 0.10.0 to 0.10.1 Bumps [github.com/goccy/go-json](https://github.com/goccy/go-json) from 0.10.0 to 0.10.1. - [Release notes](https://github.com/goccy/go-json/releases) - [Changelog](https://github.com/goccy/go-json/blob/master/CHANGELOG.md) - [Commits](https://github.com/goccy/go-json/compare/v0.10.0...v0.10.1) --- updated-dependencies: - dependency-name: github.com/goccy/go-json dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * Run make tidy + bazel gazelle-update-repos --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Daisuke Maki * Fix jwk cache docs (#885) * Fix example comment * Upon re-reading, this sentence does not need to exist * autodoc updates (#886) Co-authored-by: lestrrat * Bump actions/setup-go from 3 to 4 (#887) Bumps [actions/setup-go](https://github.com/actions/setup-go) from 3 to 4. - [Release notes](https://github.com/actions/setup-go/releases) - [Commits](https://github.com/actions/setup-go/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/setup-go dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Allow "none" algorithm when signing with explicit option (#890) * Add test case for #888 * Catch the use of "none" when used in conjunction with jws.WithKey * first pass implementing (jwt/jws).Sign that allows alg="none" * regenerate jwt options * appease linter * Check for jws.Sign/Verify * OK to _sign_ using `none`, but no verification * Tweak Changes * typo (#893) * Bump github.com/goccy/go-json from 0.10.1 to 0.10.2 (#892) * Bump github.com/goccy/go-json from 0.10.1 to 0.10.2 Bumps [github.com/goccy/go-json](https://github.com/goccy/go-json) from 0.10.1 to 0.10.2. - [Release notes](https://github.com/goccy/go-json/releases) - [Changelog](https://github.com/goccy/go-json/blob/master/CHANGELOG.md) - [Commits](https://github.com/goccy/go-json/compare/v0.10.1...v0.10.2) --- updated-dependencies: - dependency-name: github.com/goccy/go-json dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * Run make tidy + bazel --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Daisuke Maki * Update Changes * Bump github.com/goccy/go-json from 0.9.11 to 0.10.0 (#855) Bumps [github.com/goccy/go-json](https://github.com/goccy/go-json) from 0.9.11 to 0.10.0. - [Release notes](https://github.com/goccy/go-json/releases) - [Changelog](https://github.com/goccy/go-json/blob/master/CHANGELOG.md) - [Commits](https://github.com/goccy/go-json/compare/v0.9.11...v0.10.0) --- updated-dependencies: - dependency-name: github.com/goccy/go-json dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump github.com/lestrrat-go/option from 1.0.0 to 1.0.1 (#858) Bumps [github.com/lestrrat-go/option](https://github.com/lestrrat-go/option) from 1.0.0 to 1.0.1. - [Release notes](https://github.com/lestrrat-go/option/releases) - [Commits](https://github.com/lestrrat-go/option/compare/v1.0.0...v1.0.1) --- updated-dependencies: - dependency-name: github.com/lestrrat-go/option dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump actions/stale from 6 to 7 (#859) Bumps [actions/stale](https://github.com/actions/stale) from 6 to 7. - [Release notes](https://github.com/actions/stale/releases) - [Changelog](https://github.com/actions/stale/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/stale/compare/v6...v7) --- updated-dependencies: - dependency-name: actions/stale dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Tweak v2 tests (#863) * Port changes from #862 * Actually report errors * fix expected result * Unbeknownst to me, benchstat seems to have changed * Update Contribution Guidelines * Fix generated header file comments (#867) The generated file header should match regexp: ^// Code generated .* DO NOT EDIT\.$ See https://golang.org/s/generatedcode. * Remove unused variables in ReadFile (#866) * Bump kentaro-m/auto-assign-action from 1.2.4 to 1.2.5 (#868) Bumps [kentaro-m/auto-assign-action](https://github.com/kentaro-m/auto-assign-action) from 1.2.4 to 1.2.5. - [Release notes](https://github.com/kentaro-m/auto-assign-action/releases) - [Commits](https://github.com/kentaro-m/auto-assign-action/compare/v1.2.4...v1.2.5) --- updated-dependencies: - dependency-name: kentaro-m/auto-assign-action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Update tool deps (#869) * Try updating tools for genjwt * Update genjws * Update genjwe * Update genjwk * Update genjwa * Update genjwk * Updage genoptions * Update genreadfile * Fix PEM armor for EC private keys when encoding (#876) * Incorporate #875 * Test PEM roundtrip for other key types * Use more constants * Bump golang.org/x/crypto from 0.0.0-20220427172511-eb4f295cb31f to 0.6.0 (#871) * Bump golang.org/x/crypto from 0.0.0-20220427172511-eb4f295cb31f to 0.6.0 Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.0.0-20220427172511-eb4f295cb31f to 0.6.0. - [Release notes](https://github.com/golang/crypto/releases) - [Commits](https://github.com/golang/crypto/commits/v0.6.0) --- updated-dependencies: - dependency-name: golang.org/x/crypto dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * run appropriate `go get` and `go mod tidy` all over --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Daisuke Maki * Bump github.com/stretchr/testify from 1.8.1 to 1.8.2 (#873) * Bump github.com/stretchr/testify from 1.8.1 to 1.8.2 Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.8.1 to 1.8.2. - [Release notes](https://github.com/stretchr/testify/releases) - [Commits](https://github.com/stretchr/testify/compare/v1.8.1...v1.8.2) --- updated-dependencies: - dependency-name: github.com/stretchr/testify dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * run appropriate `go get` and `go mod tidy` all over --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Daisuke Maki * Update Changes * Create codeql.yml * Bump golang.org/x/crypto from 0.6.0 to 0.7.0 (#877) * Bump golang.org/x/crypto from 0.6.0 to 0.7.0 Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.6.0 to 0.7.0. - [Release notes](https://github.com/golang/crypto/releases) - [Commits](https://github.com/golang/crypto/compare/v0.6.0...v0.7.0) --- updated-dependencies: - dependency-name: golang.org/x/crypto dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * run go get and make tidy --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Daisuke Maki * Add bazel support (#880) * Attempt to enable bazel * enable bazel building in smoke tests too * tweak order * Add explicit imports * Add deps.bzl * remove unused file reference * Add missing BUILD file * Add missing BUILD file * add missing BUILD.bazel files * add .bazelversion * Add aspect presets * Update Changes/README * Create an auto-merge action for dependabot (#884) * Create an auto-merge action for dependabot * approve and merge * indent * Bump github.com/goccy/go-json from 0.10.0 to 0.10.1 (#882) * Bump github.com/goccy/go-json from 0.10.0 to 0.10.1 Bumps [github.com/goccy/go-json](https://github.com/goccy/go-json) from 0.10.0 to 0.10.1. - [Release notes](https://github.com/goccy/go-json/releases) - [Changelog](https://github.com/goccy/go-json/blob/master/CHANGELOG.md) - [Commits](https://github.com/goccy/go-json/compare/v0.10.0...v0.10.1) --- updated-dependencies: - dependency-name: github.com/goccy/go-json dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * Run make tidy + bazel gazelle-update-repos --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Daisuke Maki * Fix jwk cache docs (#885) * Fix example comment * Upon re-reading, this sentence does not need to exist * autodoc updates (#886) Co-authored-by: lestrrat * Bump actions/setup-go from 3 to 4 (#887) Bumps [actions/setup-go](https://github.com/actions/setup-go) from 3 to 4. - [Release notes](https://github.com/actions/setup-go/releases) - [Commits](https://github.com/actions/setup-go/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/setup-go dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Allow "none" algorithm when signing with explicit option (#890) * Add test case for #888 * Catch the use of "none" when used in conjunction with jws.WithKey * first pass implementing (jwt/jws).Sign that allows alg="none" * regenerate jwt options * appease linter * Check for jws.Sign/Verify * OK to _sign_ using `none`, but no verification * Tweak Changes * typo (#893) * Bump github.com/goccy/go-json from 0.10.1 to 0.10.2 (#892) * Bump github.com/goccy/go-json from 0.10.1 to 0.10.2 Bumps [github.com/goccy/go-json](https://github.com/goccy/go-json) from 0.10.1 to 0.10.2. - [Release notes](https://github.com/goccy/go-json/releases) - [Changelog](https://github.com/goccy/go-json/blob/master/CHANGELOG.md) - [Commits](https://github.com/goccy/go-json/compare/v0.10.1...v0.10.2) --- updated-dependencies: - dependency-name: github.com/goccy/go-json dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * Run make tidy + bazel --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Daisuke Maki * Update Changes --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Oleksandr Redko Co-authored-by: Mitsuo Heijo <25817501+johejo@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: lestrrat --- .aspect/bazelrc/BUILD.bazel | 3 + .aspect/bazelrc/bazel5.bazelrc | 5 + .aspect/bazelrc/bazel6.bazelrc | 15 +++ .aspect/bazelrc/ci.bazelrc | 71 ++++++++++ .aspect/bazelrc/convenience.bazelrc | 29 ++++ .aspect/bazelrc/correctness.bazelrc | 63 +++++++++ .aspect/bazelrc/debug.bazelrc | 19 +++ .aspect/bazelrc/javascript.bazelrc | 28 ++++ .aspect/bazelrc/performance.bazelrc | 54 ++++++++ .bazelignore | 4 + .bazelrc | 1 + .bazelversion | 1 + .github/CONTRIBUTING.md | 18 ++- .github/workflows/assign-pr.yml | 2 +- .github/workflows/benchmark.yml | 2 +- .github/workflows/ci.yml | 6 +- .github/workflows/codeql.yml | 76 +++++++++++ .github/workflows/dependabot.yml | 30 +++++ .github/workflows/lint.yml | 2 +- .github/workflows/smoke.yml | 10 +- .github/workflows/stale.yml | 2 +- .gitignore | 2 + BUILD | 58 ++++++++ Changes | 21 +++ README.md | 1 + WORKSPACE | 46 +++++++ bench/performance/Makefile | 2 +- bench/performance/go.mod | 6 +- bench/performance/go.sum | 40 +++++- cert/BUILD.bazel | 32 +++++ cmd/jwx/go.mod | 14 +- cmd/jwx/go.sum | 62 ++++++--- deps.bzl | 178 +++++++++++++++++++++++++ docs/04-jwk.md | 3 +- examples/go.mod | 4 +- examples/go.sum | 39 +++++- examples/jwk_cache_example_test.go | 3 +- go.mod | 8 +- go.sum | 48 +++++-- internal/base64/BUILD.bazel | 21 +++ internal/ecutil/BUILD.bazel | 15 +++ internal/iter/BUILD.bazel | 15 +++ internal/jose/BUILD.bazel | 15 +++ internal/jose/jose.go | 36 +++++ internal/json/BUILD.bazel | 19 +++ internal/jwxtest/BUILD.bazel | 23 ++++ internal/keyconv/BUILD.bazel | 31 +++++ internal/pool/BUILD.bazel | 14 ++ jwa/BUILD.bazel | 39 ++++++ jwa/compression_gen.go | 2 +- jwa/compression_gen_test.go | 2 +- jwa/content_encryption_gen.go | 2 +- jwa/content_encryption_gen_test.go | 2 +- jwa/elliptic_gen.go | 2 +- jwa/elliptic_gen_test.go | 2 +- jwa/key_encryption_gen.go | 2 +- jwa/key_encryption_gen_test.go | 2 +- jwa/key_type_gen.go | 2 +- jwa/key_type_gen_test.go | 2 +- jwa/signature_gen.go | 2 +- jwa/signature_gen_test.go | 2 +- jwe/BUILD.bazel | 68 ++++++++++ jwe/headers_gen.go | 2 +- jwe/internal/aescbc/BUILD.bazel | 21 +++ jwe/internal/cipher/BUILD.bazel | 32 +++++ jwe/internal/concatkdf/BUILD.bazel | 24 ++++ jwe/internal/content_crypt/BUILD.bazel | 21 +++ jwe/internal/keyenc/BUILD.bazel | 37 +++++ jwe/internal/keygen/BUILD.bazel | 25 ++++ jwe/io.go | 11 +- jwe/options_gen.go | 2 +- jwe/options_gen_test.go | 2 +- jwk/BUILD.bazel | 78 +++++++++++ jwk/README.md | 3 +- jwk/ecdsa_gen.go | 2 +- jwk/interface_gen.go | 2 +- jwk/io.go | 5 +- jwk/jwk.go | 17 ++- jwk/jwk_test.go | 94 ++++++++++--- jwk/okp_gen.go | 2 +- jwk/options_gen.go | 2 +- jwk/options_gen_test.go | 2 +- jwk/rsa_gen.go | 2 +- jwk/symmetric_gen.go | 2 +- jws/BUILD.bazel | 69 ++++++++++ jws/headers_gen.go | 2 +- jws/io.go | 11 +- jws/jws.go | 36 ++++- jws/jws_test.go | 38 ++++++ jws/message.go | 24 ++-- jws/options.go | 45 +++++++ jws/options_gen.go | 2 +- jws/options_gen_test.go | 2 +- jws/signer.go | 10 ++ jwt/BUILD.bazel | 65 +++++++++ jwt/builder_gen.go | 2 +- jwt/internal/types/BUILD.bazel | 32 +++++ jwt/io.go | 5 +- jwt/jwt_test.go | 26 ++++ jwt/openid/BUILD.bazel | 45 +++++++ jwt/openid/builder_gen.go | 2 +- jwt/openid/token_gen.go | 2 +- jwt/options.go | 7 + jwt/options.yaml | 2 +- jwt/options_gen.go | 4 +- jwt/options_gen_test.go | 2 +- jwt/token_gen.go | 2 +- jwx_test.go | 91 +++++++------ tools/cmd/genjwa/go.mod | 8 +- tools/cmd/genjwa/go.sum | 53 ++++++-- tools/cmd/genjwa/main.go | 4 +- tools/cmd/genjwe/go.mod | 12 +- tools/cmd/genjwe/go.sum | 79 ++++++++--- tools/cmd/genjwe/main.go | 2 +- tools/cmd/genjwk/go.mod | 12 +- tools/cmd/genjwk/go.sum | 79 ++++++++--- tools/cmd/genjwk/main.go | 4 +- tools/cmd/genjws/go.mod | 12 +- tools/cmd/genjws/go.sum | 79 ++++++++--- tools/cmd/genjws/main.go | 2 +- tools/cmd/genjwt/go.mod | 14 +- tools/cmd/genjwt/go.sum | 83 +++++++++--- tools/cmd/genjwt/main.go | 4 +- tools/cmd/genoptions/go.mod | 27 ++-- tools/cmd/genoptions/go.sum | 55 +++++--- tools/cmd/genoptions/main.go | 10 +- tools/cmd/genreadfile/go.mod | 8 +- tools/cmd/genreadfile/go.sum | 53 ++++++-- tools/cmd/genreadfile/main.go | 19 ++- tools/test.sh | 13 +- x25519/BUILD.bazel | 24 ++++ 131 files changed, 2532 insertions(+), 366 deletions(-) create mode 100644 .aspect/bazelrc/BUILD.bazel create mode 100644 .aspect/bazelrc/bazel5.bazelrc create mode 100644 .aspect/bazelrc/bazel6.bazelrc create mode 100644 .aspect/bazelrc/ci.bazelrc create mode 100644 .aspect/bazelrc/convenience.bazelrc create mode 100644 .aspect/bazelrc/correctness.bazelrc create mode 100644 .aspect/bazelrc/debug.bazelrc create mode 100644 .aspect/bazelrc/javascript.bazelrc create mode 100644 .aspect/bazelrc/performance.bazelrc create mode 100644 .bazelignore create mode 100644 .bazelrc create mode 100644 .bazelversion create mode 100644 .github/workflows/codeql.yml create mode 100644 .github/workflows/dependabot.yml create mode 100644 BUILD create mode 100644 WORKSPACE create mode 100644 cert/BUILD.bazel create mode 100644 deps.bzl create mode 100644 internal/base64/BUILD.bazel create mode 100644 internal/ecutil/BUILD.bazel create mode 100644 internal/iter/BUILD.bazel create mode 100644 internal/jose/BUILD.bazel create mode 100644 internal/json/BUILD.bazel create mode 100644 internal/jwxtest/BUILD.bazel create mode 100644 internal/keyconv/BUILD.bazel create mode 100644 internal/pool/BUILD.bazel create mode 100644 jwa/BUILD.bazel create mode 100644 jwe/BUILD.bazel create mode 100644 jwe/internal/aescbc/BUILD.bazel create mode 100644 jwe/internal/cipher/BUILD.bazel create mode 100644 jwe/internal/concatkdf/BUILD.bazel create mode 100644 jwe/internal/content_crypt/BUILD.bazel create mode 100644 jwe/internal/keyenc/BUILD.bazel create mode 100644 jwe/internal/keygen/BUILD.bazel create mode 100644 jwk/BUILD.bazel create mode 100644 jws/BUILD.bazel create mode 100644 jwt/BUILD.bazel create mode 100644 jwt/internal/types/BUILD.bazel create mode 100644 jwt/openid/BUILD.bazel create mode 100644 x25519/BUILD.bazel diff --git a/.aspect/bazelrc/BUILD.bazel b/.aspect/bazelrc/BUILD.bazel new file mode 100644 index 000000000..1f3084be3 --- /dev/null +++ b/.aspect/bazelrc/BUILD.bazel @@ -0,0 +1,3 @@ +load("@aspect_bazel_lib//lib:bazelrc_presets.bzl", "write_aspect_bazelrc_presets") + +write_aspect_bazelrc_presets(name = "update_aspect_bazelrc_presets") diff --git a/.aspect/bazelrc/bazel5.bazelrc b/.aspect/bazelrc/bazel5.bazelrc new file mode 100644 index 000000000..c9d77444d --- /dev/null +++ b/.aspect/bazelrc/bazel5.bazelrc @@ -0,0 +1,5 @@ +# Performance improvement for WORKSPACE evaluation +# of slow rulesets, for example rules_k8s has been +# observed to take 10 seconds without this flag. +# See https://github.com/bazelbuild/bazel/issues/13907 +common --incompatible_existing_rules_immutable_view diff --git a/.aspect/bazelrc/bazel6.bazelrc b/.aspect/bazelrc/bazel6.bazelrc new file mode 100644 index 000000000..11a1c67fa --- /dev/null +++ b/.aspect/bazelrc/bazel6.bazelrc @@ -0,0 +1,15 @@ +# Speed up all builds by not checking if external repository files have been modified. +# Docs: https://github.com/bazelbuild/bazel/blob/1af61b21df99edc2fc66939cdf14449c2661f873/src/main/java/com/google/devtools/build/lib/bazel/repository/RepositoryOptions.java#L244 +build --noexperimental_check_external_repository_files +fetch --noexperimental_check_external_repository_files +query --noexperimental_check_external_repository_files + +# Directories used by sandboxed non-worker execution may be reused to avoid unnecessary setup costs. +# Save time on Sandbox creation and deletion when many of the same kind of action run during the +# build. +# Docs: https://bazel.build/reference/command-line-reference#flag--reuse_sandbox_directories +build --reuse_sandbox_directories + +# Avoid this flag being enabled by remote_download_minimal or remote_download_toplevel +# See https://meroton.com/blog/bazel-6-errors-build-without-the-bytes/ +build --noexperimental_action_cache_store_output_metadata diff --git a/.aspect/bazelrc/ci.bazelrc b/.aspect/bazelrc/ci.bazelrc new file mode 100644 index 000000000..5c17b99f6 --- /dev/null +++ b/.aspect/bazelrc/ci.bazelrc @@ -0,0 +1,71 @@ +# We recommend enforcing a policy that keeps your CI from being slowed down +# by individual test targets that should be optimized +# or split up into multiple test targets with sharding or manually. +# Set this flag to exclude targets that have their timeout set to eternal (>15m) from running on CI. +# Docs: https://bazel.build/docs/user-manual#test-timeout-filters +build --test_timeout_filters=-eternal + +# Set this flag to enable re-tries of failed tests on CI. +# When any test target fails, try one or more times. This applies regardless of whether the "flaky" +# tag appears on the target definition. +# This is a tradeoff: legitimately failing tests will take longer to report, +# but we can paper over flaky tests that pass most of the time. +# The alternative is to mark every flaky test with the `flaky = True` attribute, but this requires +# the buildcop to make frequent code edits. +# Not recommended for local builds so that the flakiness is observed during development and thus +# is more likely to get fixed. +# Note that when passing after the first attempt, Bazel will give a special "FLAKY" status. +# Docs: https://bazel.build/docs/user-manual#flaky-test-attempts +build --flaky_test_attempts=2 + +# Announce all announces command options read from the bazelrc file(s) when starting up at the +# beginning of each Bazel invocation. This is very useful on CI to be able to inspect what Bazel rc +# settings are being applied on each run. +# Docs: https://bazel.build/docs/user-manual#announce-rc +build --announce_rc + +# Add a timestamp to each message generated by Bazel specifying the time at which the message was +# displayed. +# Docs: https://bazel.build/docs/user-manual#show-timestamps +build --show_timestamps + +# Only show progress every 5 seconds on CI. +# https://bazel.build/reference/command-line-reference#flag--show_progress_rate_limit +build --show_progress_rate_limit=5 + +# Use cursor controls in screen output. +# Docs: https://bazel.build/docs/user-manual#curses +build --curses=yes + +# Use colors to highlight output on the screen. Set to `no` if your CI does not display colors. +# Docs: https://bazel.build/docs/user-manual#color +build --color=yes + +# The terminal width in columns. Configure this to override the default value based on what your CI system renders. +# Docs: https://github.com/bazelbuild/bazel/blob/1af61b21df99edc2fc66939cdf14449c2661f873/src/main/java/com/google/devtools/build/lib/runtime/UiOptions.java#L151 +build --terminal_columns=143 + +###################################### +# Generic remote cache configuration # +###################################### + +# Only download remote outputs of top level targets to the local machine. +# Docs: https://bazel.build/reference/command-line-reference#flag--remote_download_toplevel +build --remote_download_toplevel + +# The maximum amount of time to wait for remote execution and cache calls. +# https://bazel.build/reference/command-line-reference#flag--remote_timeout +build --remote_timeout=3600 + +# Upload locally executed action results to the remote cache. +# Docs: https://bazel.build/reference/command-line-reference#flag--remote_upload_local_results +build --remote_upload_local_results + +# Fall back to standalone local execution strategy if remote execution fails. If the grpc remote +# cache connection fails, it will fail the build, add this so it falls back to the local cache. +# Docs: https://bazel.build/reference/command-line-reference#flag--remote_local_fallback +build --remote_local_fallback + +# Fixes builds hanging on CI that get the TCP connection closed without sending RST packets. +# Docs: https://bazel.build/reference/command-line-reference#flag--grpc_keepalive_time +build --grpc_keepalive_time=30s diff --git a/.aspect/bazelrc/convenience.bazelrc b/.aspect/bazelrc/convenience.bazelrc new file mode 100644 index 000000000..3122d3273 --- /dev/null +++ b/.aspect/bazelrc/convenience.bazelrc @@ -0,0 +1,29 @@ +# Attempt to build & test every target whose prerequisites were successfully built. +# Docs: https://bazel.build/docs/user-manual#keep-going +build --keep_going +test --keep_going + +# Output test errors to stderr so users don't have to `cat` or open test failure log files when test +# fail. This makes the log noiser in exchange for reducing the time-to-feedback on test failures for +# users. +# Docs: https://bazel.build/docs/user-manual#test-output +test --test_output=errors + +# Show the output files created by builds that requested more than one target. This helps users +# locate the build outputs in more cases +# Docs: https://bazel.build/docs/user-manual#show-result +build --show_result=20 + +# Bazel picks up host-OS-specific config lines from bazelrc files. For example, if the host OS is +# Linux and you run bazel build, Bazel picks up lines starting with build:linux. Supported OS +# identifiers are `linux`, `macos`, `windows`, `freebsd`, and `openbsd`. Enabling this flag is +# equivalent to using `--config=linux` on Linux, `--config=windows` on Windows, etc. +# Docs: https://bazel.build/reference/command-line-reference#flag--enable_platform_specific_config +common --enable_platform_specific_config + +# Output a heap dump if an OOM is thrown during a Bazel invocation +# (including OOMs due to `--experimental_oom_more_eagerly_threshold`). +# The dump will be written to `/.heapdump.hprof`. +# You may need to configure CI to capture this artifact and upload for later use. +# Docs: https://bazel.build/reference/command-line-reference#flag--heap_dump_on_oom +build --heap_dump_on_oom diff --git a/.aspect/bazelrc/correctness.bazelrc b/.aspect/bazelrc/correctness.bazelrc new file mode 100644 index 000000000..d9ef2e5bc --- /dev/null +++ b/.aspect/bazelrc/correctness.bazelrc @@ -0,0 +1,63 @@ +# Do not upload locally executed action results to the remote cache. +# This should be the default for local builds so local builds cannot poison the remote cache. +# It should be flipped to `--remote_upload_local_results` on CI +# by using `--bazelrc=.aspect/bazelrc/ci.bazelrc`. +# Docs: https://bazel.build/reference/command-line-reference#flag--remote_upload_local_results +build --noremote_upload_local_results + +# Don't allow network access for build actions in the sandbox. +# Ensures that you don't accidentally make non-hermetic actions/tests which depend on remote +# services. +# Developers should tag targets with `tags=["requires-network"]` to opt-out of the enforcement. +# Docs: https://bazel.build/reference/command-line-reference#flag--sandbox_default_allow_network +build --sandbox_default_allow_network=false +test --sandbox_default_allow_network=false + +# Warn if a test's timeout is significantly longer than the test's actual execution time. +# Bazel's default for test_timeout is medium (5 min), but most tests should instead be short (1 min). +# While a test's timeout should be set such that it is not flaky, a test that has a highly +# over-generous timeout can hide real problems that crop up unexpectedly. +# For instance, a test that normally executes in a minute or two should not have a timeout of +# ETERNAL or LONG as these are much, much too generous. +# Docs: https://bazel.build/docs/user-manual#test-verbose-timeout-warnings +test --test_verbose_timeout_warnings + +# Allow the Bazel server to check directory sources for changes. Ensures that the Bazel server +# notices when a directory changes, if you have a directory listed in the srcs of some target. +# Recommended when using +# [copy_directory](https://github.com/aspect-build/bazel-lib/blob/main/docs/copy_directory.md) and +# [rules_js](https://github.com/aspect-build/rules_js) since npm package are source directories +# inputs to copy_directory actions. +# Docs: https://bazel.build/reference/command-line-reference#flag--host_jvm_args +startup --host_jvm_args=-DBAZEL_TRACK_SOURCE_DIRECTORIES=1 + +# Allow exclusive tests to run in the sandbox. Fixes a bug where Bazel doesn't enable sandboxing for +# tests with `tags=["exclusive"]`. +# Docs: https://bazel.build/reference/command-line-reference#flag--incompatible_exclusive_test_sandboxed +test --incompatible_exclusive_test_sandboxed + +# Use a static value for `PATH` and does not inherit `LD_LIBRARY_PATH`. Doesn't let environment +# variables like `PATH` sneak into the build, which can cause massive cache misses when they change. +# Use `--action_env=ENV_VARIABLE` if you want to inherit specific environment variables from the +# client, but note that doing so can prevent cross-user caching if a shared cache is used. +# Docs: https://bazel.build/reference/command-line-reference#flag--incompatible_strict_action_env +build --incompatible_strict_action_env + +# Propagate tags from a target declaration to the actions' execution requirements. +# Ensures that tags applied in your BUILD file, like `tags=["no-remote"]` +# get propagated to actions created by the rule. +# Without this option, you rely on rules authors to manually check the tags you passed +# and apply relevant ones to the actions they create. +# See https://github.com/bazelbuild/bazel/issues/8830 for details. +# Docs: https://bazel.build/reference/command-line-reference#flag--experimental_allow_tags_propagation +build --experimental_allow_tags_propagation +fetch --experimental_allow_tags_propagation +query --experimental_allow_tags_propagation + +# Do not automatically create `__init__.py` files in the runfiles of Python targets. Fixes the wrong +# default that comes from Google's internal monorepo by using `__init__.py` to delimit a Python +# package. Precisely, when a `py_binary` or `py_test` target has `legacy_create_init` set to `auto (the +# default), it is treated as false if and only if this flag is set. See +# https://github.com/bazelbuild/bazel/issues/10076. +# Docs: https://bazel.build/reference/command-line-reference#flag--incompatible_default_to_explicit_init_py +build --incompatible_default_to_explicit_init_py diff --git a/.aspect/bazelrc/debug.bazelrc b/.aspect/bazelrc/debug.bazelrc new file mode 100644 index 000000000..bfb0bdd4a --- /dev/null +++ b/.aspect/bazelrc/debug.bazelrc @@ -0,0 +1,19 @@ +############################################################ +# Use `bazel test --config=debug` to enable these settings # +############################################################ + +# Stream stdout/stderr output from each test in real-time. +# Docs: https://bazel.build/docs/user-manual#test-output +test:debug --test_output=streamed + +# Run one test at a time. +# Docs: https://bazel.build/reference/command-line-reference#flag--test_strategy +test:debug --test_strategy=exclusive + +# Prevent long running tests from timing out. +# Docs: https://bazel.build/docs/user-manual#test-timeout +test:debug --test_timeout=9999 + +# Always run tests even if they have cached results. +# Docs: https://bazel.build/docs/user-manual#cache-test-results +test:debug --nocache_test_results diff --git a/.aspect/bazelrc/javascript.bazelrc b/.aspect/bazelrc/javascript.bazelrc new file mode 100644 index 000000000..dc768641e --- /dev/null +++ b/.aspect/bazelrc/javascript.bazelrc @@ -0,0 +1,28 @@ +# Aspect recommended Bazel flags when using Aspect's JavaScript rules: https://github.com/aspect-build/rules_js +# Docs for Node.js flags: https://nodejs.org/en/docs/guides/debugging-getting-started/#command-line-options + +# Support for debugging Node.js tests. Use bazel run with `--config=debug` to turn on the NodeJS +# inspector agent. The node process will break before user code starts and wait for the debugger to +# connect. Pass the --inspect-brk option to all tests which enables the node inspector agent. See +# https://nodejs.org/de/docs/guides/debugging-getting-started/#command-line-options for more +# details. +# Docs: https://nodejs.org/en/docs/guides/debugging-getting-started/#command-line-options +run:debug -- --node_options=--inspect-brk + +# Enable runfiles on all platforms. Runfiles are on by default on Linux and MacOS but off on +# Windows. +# +# In general, rules_js and derivate rule sets assume that runfiles are enabled and do not support no +# runfiles case because it does not scale to teach all Node.js tools to use the runfiles manifest. +# +# If you are developing on Windows, you must either run bazel with administrator privileges or +# enable developer mode. If you do not you may hit this error on Windows: +# +# Bazel needs to create symlinks to build the runfiles tree. +# Creating symlinks on Windows requires one of the following: +# 1. Bazel is run with administrator privileges. +# 2. The system version is Windows 10 Creators Update (1703) or later +# and developer mode is enabled. +# +# Docs: https://bazel.build/reference/command-line-reference#flag--enable_runfiles +build --enable_runfiles diff --git a/.aspect/bazelrc/performance.bazelrc b/.aspect/bazelrc/performance.bazelrc new file mode 100644 index 000000000..bc11a3f43 --- /dev/null +++ b/.aspect/bazelrc/performance.bazelrc @@ -0,0 +1,54 @@ +# Merkle tree calculations will be memoized to improve the remote cache hit checking speed. The +# memory foot print of the cache is controlled by `--experimental_remote_merkle_tree_cache_size`. +# Docs: https://bazel.build/reference/command-line-reference#flag--experimental_remote_merkle_tree_cache +build --experimental_remote_merkle_tree_cache +query --experimental_remote_merkle_tree_cache + +# The number of Merkle trees to memoize to improve the remote cache hit checking speed. Even though +# the cache is automatically pruned according to Java's handling of soft references, out-of-memory +# errors can occur if set too high. If set to 0 the cache size is unlimited. Optimal value varies +# depending on project's size. +# Docs: https://bazel.build/reference/command-line-reference#flag--experimental_remote_merkle_tree_cache_size +build --experimental_remote_merkle_tree_cache_size=1000 +query --experimental_remote_merkle_tree_cache_size=1000 + +# Speed up all builds by not checking if output files have been modified. Lets you make changes to +# the output tree without triggering a build for local debugging. For example, you can modify +# [rules_js](https://github.com/aspect-build/rules_js) 3rd party npm packages in the output tree +# when local debugging. +# Docs: https://github.com/bazelbuild/bazel/blob/1af61b21df99edc2fc66939cdf14449c2661f873/src/main/java/com/google/devtools/build/lib/pkgcache/PackageOptions.java#L185 +build --noexperimental_check_output_files +fetch --noexperimental_check_output_files +query --noexperimental_check_output_files + +# Don't apply `--noremote_upload_local_results` and `--noremote_accept_cached` to the disk cache. +# If you have both `--noremote_upload_local_results` and `--disk_cache`, then this fixes a bug where +# Bazel doesn't write to the local disk cache as it treats as a remote cache. +# Docs: https://bazel.build/reference/command-line-reference#flag--incompatible_remote_results_ignore_disk +build --incompatible_remote_results_ignore_disk + +# Directories used by sandboxed non-worker execution may be reused to avoid unnecessary setup costs. +# Save time on Sandbox creation and deletion when many of the same kind of action run during the +# build. +# No longer experimental in Bazel 6: https://github.com/bazelbuild/bazel/commit/c1a95501a5611878e5cc43a3cc531f2b9e47835b +# Docs: https://bazel.build/reference/command-line-reference#flag--reuse_sandbox_directories +build --experimental_reuse_sandbox_directories + +# Do not build runfiles symlink forests for external repositories under +# `.runfiles/wsname/external/repo` (in addition to `.runfiles/repo`). This reduces runfiles & +# sandbox creation times & prevents accidentally depending on this feature which may flip to off by +# default in the future. Note, some rules may fail under this flag, please file issues with the rule +# author. +# Docs: https://bazel.build/reference/command-line-reference#flag--legacy_external_runfiles +build --nolegacy_external_runfiles +run --nolegacy_external_runfiles +test --nolegacy_external_runfiles + +# Some actions are always IO-intensive but require little compute. It's wasteful to put the output +# in the remote cache, it just saturates the network and fills the cache storage causing earlier +# evictions. It's also not worth sending them for remote execution. +# For actions like PackageTar it's usually faster to just re-run the work locally every time. +# You'll have to look at an execution log to figure out what other action mnemonics you care about. +# In some cases you may need to patch rulesets to add a mnemonic to actions that don't have one. +# https://bazel.build/reference/command-line-reference#flag--modify_execution_info +build --modify_execution_info=PackageTar=+no-remote diff --git a/.bazelignore b/.bazelignore new file mode 100644 index 000000000..50347e877 --- /dev/null +++ b/.bazelignore @@ -0,0 +1,4 @@ +cmd +bench +examples +tools diff --git a/.bazelrc b/.bazelrc new file mode 100644 index 000000000..ea3df8df2 --- /dev/null +++ b/.bazelrc @@ -0,0 +1 @@ +import %workspace%/.aspect/bazelrc/bazel6.bazelrc diff --git a/.bazelversion b/.bazelversion new file mode 100644 index 000000000..09b254e90 --- /dev/null +++ b/.bazelversion @@ -0,0 +1 @@ +6.0.0 diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 7b65d88c1..a4d6c0f32 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -10,6 +10,7 @@ The following is a set of guidelines that we ask you to follow when you contribu * [Please Be Nice](#please-be-nice) * [Please Use Correct Medium (GitHub Issues / Discussions)](#please-use-correct-medium-github-issues--discussions) * [Please Include (Pseudo)code for Any Technical Issues](#please-include-pseudocode-for-any-technical-issues) +* [Reviewer/Reviewee Guidelines](#reviewer-reviewee-guidelines) * [Brown M&M Clause](#brown-mm-clause) * [Pull Requests](#pull-requests) * [Branches](#branches) @@ -27,10 +28,11 @@ The following is a set of guidelines that we ask you to follow when you contribu # Please Be Nice +[Main source; if wording differ, the main source supersedes this copy](https://github.com/lestrrat-go/contributions/blob/main/Contributions.md) + Please be nice when you contact us. -We are very glad that you find this project useful, and we intend to provide software -that help you. +We are very glad that you find this project useful, and we intend to provide software that help you. You do not have to thank us, but please bare in mind that this is an opensource project that is provided **as-is**. This means that we are **NOT** obligated to support you, work for you, do your homework/research for you, @@ -46,15 +48,18 @@ We are willing to help, but only as long as you are being nice to us. # Please Use Correct Medium (GitHub Issues / Discussions) +[Main source; this is a specialized version copied from the main source](https://github.com/lestrrat-go/contributions/blob/main/Contributions.md) + This project uses [GitHub Issues](https://github.com/lestrrat-go/jwx/issues) to deal with technical issues -including bug reports, proposing new API, and otherwise issues that -are directly actionable. +including bug reports, proposing new API, and otherwise issues that are directly actionable. Inquiries, questions about the usage, maintenance policies, and other open-ended questions/discussions should be posted to [GitHub Discussions](https://github.com/lestrrat-go/jwx/discussions). # Please Include (Pseudo)code for Any Technical Issues +[Main source; if wording differ, the main source supersedes this copy](https://github.com/lestrrat-go/contributions/blob/main/Contributions.md) + Your report should contain clear, concise description of the issue that you are facing. However, at the same time please always include (pseudo)code in report. @@ -75,6 +80,11 @@ your code. Please help us help you by providing us with a reproducible code. +# Reviewer/Reviewee Guidelines + +If you are curious about what what gets reviewed and why some decisions +are made the way they are, please read [this document](https://github.com/lestrrat-go/contributions/blob/main/Reviews.md) to get some insight into the thinking process. + # Brown M&M Clause If you came here from an issue/PR template, please make sure to delete diff --git a/.github/workflows/assign-pr.yml b/.github/workflows/assign-pr.yml index 8c8b45048..4405c6d07 100644 --- a/.github/workflows/assign-pr.yml +++ b/.github/workflows/assign-pr.yml @@ -7,6 +7,6 @@ jobs: add-reviews: runs-on: ubuntu-latest steps: - - uses: kentaro-m/auto-assign-action@v1.2.4 + - uses: kentaro-m/auto-assign-action@v1.2.5 with: configuration-path: .github/auto-assign-pr.yml diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index c3e75eaa7..6f4b49a6c 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -24,7 +24,7 @@ jobs: restore-keys: | ${{ runner.os }}-go- - name: Install Go stable version - uses: actions/setup-go@v3 + uses: actions/setup-go@v4 with: go-version: ${{ matrix.go }} check-latest: true diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 515f2fafb..1f59c0326 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,12 +22,13 @@ jobs: path: | ~/go/pkg/mod ~/.cache/go-build + ~/.cache/bazel key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} restore-keys: | ${{ runner.os }}-go- - name: Install Go stable version if: matrix.go != 'tip' - uses: actions/setup-go@v3 + uses: actions/setup-go@v4 with: go-version: ${{ matrix.go }} check-latest: true @@ -58,4 +59,5 @@ jobs: file: ./coverage.out - name: Check difference between generation code and commit code run: make check_diffs - + - uses: bazelbuild/setup-bazelisk@v2 + - run: bazel build //... diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 000000000..e9a65fd19 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,76 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: "CodeQL" + +on: + push: + branches: [ develop/*, v* ] + pull_request: + # The branches below must be a subset of the branches above + branches: [ "develop/v2", "develop/v1" ] + schedule: + - cron: '40 13 * * 5' + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [ 'go' ] + # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] + # Use only 'java' to analyze code written in Java, Kotlin or both + # Use only 'javascript' to analyze code written in JavaScript, TypeScript or both + # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + + # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + # queries: security-extended,security-and-quality + + + # Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v2 + + # ℹī¸ Command-line programs to run using the OS shell. + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + + # If the Autobuild fails above, remove it and uncomment the following three lines. + # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. + + # - run: | + # echo "Run, Build Application using script" + # ./location_of_script_within_repo/buildscript.sh + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 + with: + category: "/language:${{matrix.language}}" diff --git a/.github/workflows/dependabot.yml b/.github/workflows/dependabot.yml new file mode 100644 index 000000000..984b4d6d8 --- /dev/null +++ b/.github/workflows/dependabot.yml @@ -0,0 +1,30 @@ +name: merge dependabot +on: + pull_request: + types: [labeled] + +jobs: + merge: + if: ${{github.event.label.name == 'dependabot'}} + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - run: | + make tidy + - run: | + make test + - run: | + bazel run //:gazelle-update-repos + - run: | + bazel build //... + - run: | + git config --local user.email '41898282+github-actions[bot]@users.noreply.github.com' + git add . + git commit -m "Run tidy / bazel+gazelle" + git push + gh pr review --approve "$PR_URL" + gh pr merge --auto --merge "$PR_URL" + env: + PR_URL: ${{github.event.pull_request.html_url}} + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 66bf61d5e..72fabee73 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -6,7 +6,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 + - uses: actions/setup-go@v4 with: go-version: 1.19 check-latest: true diff --git a/.github/workflows/smoke.yml b/.github/workflows/smoke.yml index 0598734ef..a7fb00b63 100644 --- a/.github/workflows/smoke.yml +++ b/.github/workflows/smoke.yml @@ -28,11 +28,12 @@ jobs: path: | ~/go/pkg/mod ~/.cache/go-build + ~/.cache/bazel key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} restore-keys: | ${{ runner.os }}-go- - name: Install Go stable version - uses: actions/setup-go@v3 + uses: actions/setup-go@v4 with: go-version: ${{ matrix.go }} check-latest: true @@ -43,9 +44,12 @@ jobs: - name: Install jose run: sudo apt-get install -y --no-install-recommends jose - run: make generate + - name: Check difference between generation code and commit code + run: make check_diffs - name: make tidy run: make tidy - name: Run smoke tests run: make smoke-${{ matrix.go_tags }} - - name: Check difference between generation code and commit code - run: make check_diffs + - uses: bazelbuild/setup-bazelisk@v2 + - run: bazel build //... + diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index e52aff755..d79f8e984 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -7,7 +7,7 @@ jobs: stale: runs-on: ubuntu-latest steps: - - uses: actions/stale@v6 + - uses: actions/stale@v7 with: stale-issue-message: 'This issue is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 7 days.' stale-pr-message: 'This PR is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 14 days.' diff --git a/.gitignore b/.gitignore index 605219c24..c4c0ebff3 100644 --- a/.gitignore +++ b/.gitignore @@ -35,3 +35,5 @@ coverage.out out cmd/jwx/jwx + +bazel-* diff --git a/BUILD b/BUILD new file mode 100644 index 000000000..dbde005d7 --- /dev/null +++ b/BUILD @@ -0,0 +1,58 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") +load("@bazel_gazelle//:def.bzl", "gazelle") + +# gazelle:prefix github.com/lestrrat-go/jwx/v2 +# gazelle:go_naming_convention import_alias + +gazelle(name = "gazelle") + +gazelle( + name = "gazelle-update-repos", + args = [ + "-from_file=go.mod", + "-to_macro=deps.bzl%go_dependencies", + "-prune", + "-build_file_proto_mode=disable_global", + ], + command = "update-repos", +) + +go_library( + name = "jwx", + srcs = [ + "format.go", + "formatkind_string_gen.go", + "jwx.go", + "options.go", + ], + importpath = "github.com/lestrrat-go/jwx/v2", + visibility = ["//visibility:public"], + deps = [ + "//internal/json", + "@com_github_lestrrat_go_option//:option", + ], +) + +go_test( + name = "jwx_test", + srcs = ["jwx_test.go"], + deps = [ + ":jwx", + "//internal/ecutil", + "//internal/jose", + "//internal/json", + "//internal/jwxtest", + "//jwa", + "//jwe", + "//jwk", + "//jws", + "@com_github_stretchr_testify//assert", + "@com_github_stretchr_testify//require", + ], +) + +alias( + name = "go_default_library", + actual = ":jwx", + visibility = ["//visibility:public"], +) diff --git a/Changes b/Changes index f68a2efca..e20b75771 100644 --- a/Changes +++ b/Changes @@ -4,6 +4,27 @@ Changes v2 has many incompatibilities with v1. To see the full list of differences between v1 and v2, please read the Changes-v2.md file (https://github.com/lestrrat-go/jwx/blob/develop/v2/Changes-v2.md) +v2.0.9 - 21 Mar 2023 +[Security Fixes] + * Updated use of golang.org/x/crypto to v0.7.0 +[Bug fixes] + * Emitted PEM file for EC private key types used the wrong PEM armor (#875) +[Miscellaneous] + * Banners for generated files have been modified to allow tools to pick them up (#867) + * Remove unused variables around ReadFileOption (#866) + * Fix test failures + * Support bazel out of the box + * Now you can create JWS messages using `{"alg":"none"}`, by calling `jws.Sign()` + with `jws.WithInsecureNoSignature()` option. (#888, #890). + + Note that there is no way to call + `jws.Verify()` while allowing `{"alg":"none"}` as you wouldn't be _verifying_ + the message if we allowed the "none" algorithm. `jws.Parse()` will parse such + messages witout verification. + + `jwt` also allows you to sign using alg="none", but there's no symmetrical + way to verify such messages. + v2.0.8 - 25 Nov 2022 [Security Fixes] * [jws][jwe] Starting from go 1.19, code related to elliptic algorithms diff --git a/README.md b/README.md index e9f2a84fa..c71145642 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,7 @@ If you are using this module in your product or your company, please add your p * Arguments are organized as explicit required paramters and optional WithXXXX() style options. * Extra utilities * `jwk.Cache` to always keep a JWKS up-to-date + * [bazel](https://bazel.build)-ready Some more in-depth discussion on why you might want to use this library over others can be found in the [Description section](#description) diff --git a/WORKSPACE b/WORKSPACE new file mode 100644 index 000000000..6a0cbe84b --- /dev/null +++ b/WORKSPACE @@ -0,0 +1,46 @@ +workspace(name = "com_github_lestrrat_go_jwx_v2") + +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") + +http_archive( + name = "io_bazel_rules_go", + sha256 = "dd926a88a564a9246713a9c00b35315f54cbd46b31a26d5d8fb264c07045f05d", + urls = [ + "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.38.1/rules_go-v0.38.1.zip", + "https://github.com/bazelbuild/rules_go/releases/download/v0.38.1/rules_go-v0.38.1.zip", + ], +) + +http_archive( + name = "bazel_gazelle", + sha256 = "ecba0f04f96b4960a5b250c8e8eeec42281035970aa8852dda73098274d14a1d", + urls = [ + "https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.29.0/bazel-gazelle-v0.29.0.tar.gz", + "https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.29.0/bazel-gazelle-v0.29.0.tar.gz", + ], +) + +load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies") +load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies") +load("//:deps.bzl", "go_dependencies") + +# gazelle:repository_macro deps.bzl%go_dependencies +go_dependencies() + +go_rules_dependencies() + +go_register_toolchains(version = "1.19.5") + +gazelle_dependencies() + +# aspect-build related stuff +http_archive( + name = "aspect_bazel_lib", + sha256 = "b4cd1114874ab15f794134eefbc254eb89d3e1de640bf4a11f2f402e886ad29e", + strip_prefix = "bazel-lib-1.27.2", + url = "https://github.com/aspect-build/bazel-lib/releases/download/v1.27.2/bazel-lib-v1.27.2.tar.gz", +) + +load("@aspect_bazel_lib//lib:repositories.bzl", "aspect_bazel_lib_dependencies") + +aspect_bazel_lib_dependencies() diff --git a/bench/performance/Makefile b/bench/performance/Makefile index b7f7a6a99..7db68fe8b 100644 --- a/bench/performance/Makefile +++ b/bench/performance/Makefile @@ -5,4 +5,4 @@ goccy: go test -bench . -benchmem -count 5 -timeout 60m -tags jwx_goccy | tee goccy.txt benchstat: - benchstat -sort -delta stdlib.txt goccy.txt + benchstat stdlib.txt goccy.txt diff --git a/bench/performance/go.mod b/bench/performance/go.mod index f6f2d1041..a2344ff9e 100644 --- a/bench/performance/go.mod +++ b/bench/performance/go.mod @@ -2,4 +2,8 @@ module github.com/lestrrat-go/jwx/v2/bench/performance go 1.16 -require github.com/lestrrat-go/jwx/v2 v2.0.7 +require ( + github.com/lestrrat-go/jwx/v2 v2.0.8 + github.com/stretchr/testify v1.8.2 // indirect + golang.org/x/crypto v0.7.0 // indirect +) diff --git a/bench/performance/go.sum b/bench/performance/go.sum index 6e90c20b0..50f01885d 100644 --- a/bench/performance/go.sum +++ b/bench/performance/go.sum @@ -14,8 +14,8 @@ github.com/lestrrat-go/httprc v1.0.4 h1:bAZymwoZQb+Oq8MEbyipag7iSq6YIga8Wj6GOiJG github.com/lestrrat-go/httprc v1.0.4/go.mod h1:mwwz3JMTPBjHUkkDv/IGJ39aALInZLrhBp0X7KGUZlo= github.com/lestrrat-go/iter v1.0.2 h1:gMXo1q4c2pHmC3dn8LzRhJfP1ceCbgSiT9lUydIzltI= github.com/lestrrat-go/iter v1.0.2/go.mod h1:Momfcq3AnRlRjI5b5O8/G5/BvpzrhoFTZcn06fEOPt4= -github.com/lestrrat-go/jwx/v2 v2.0.7 h1:vNh7cA5pKS/1muWYpM1GeUHBCf/r1UFxYN60iv7LFRA= -github.com/lestrrat-go/jwx/v2 v2.0.7/go.mod h1:zLxnyv9rTlEvOUHbc48FAfIL8iYu2hHvIRaTFGc8mT0= +github.com/lestrrat-go/jwx/v2 v2.0.8 h1:jCFT8oc0hEDVjgUgsBy1F9cbjsjAVZSXNi7JaU9HR/Q= +github.com/lestrrat-go/jwx/v2 v2.0.8/go.mod h1:zLxnyv9rTlEvOUHbc48FAfIL8iYu2hHvIRaTFGc8mT0= github.com/lestrrat-go/option v1.0.0 h1:WqAWL8kh8VcSoD6xjSH34/1m8yxluXQbDeKNfvFeEO4= github.com/lestrrat-go/option v1.0.0/go.mod h1:5ZHFbivi4xwXxhxY9XHDe2FHo6/Z7WWmtT7T5nBBp3I= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= @@ -26,17 +26,49 @@ github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpE github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f h1:OeJjE6G4dgCY4PIXvIRQbE8+RX+uXZyGhUy/ksMGJoc= +github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.7.0 h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A= +golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= +golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/cert/BUILD.bazel b/cert/BUILD.bazel new file mode 100644 index 000000000..7b2617e55 --- /dev/null +++ b/cert/BUILD.bazel @@ -0,0 +1,32 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "cert", + srcs = [ + "cert.go", + "chain.go", + ], + importpath = "github.com/lestrrat-go/jwx/v2/cert", + visibility = ["//visibility:public"], + deps = ["//internal/base64"], +) + +go_test( + name = "cert_test", + srcs = [ + "cert_test.go", + "chain_test.go", + ], + deps = [ + ":cert", + "//internal/jwxtest", + "@com_github_stretchr_testify//assert", + "@com_github_stretchr_testify//require", + ], +) + +alias( + name = "go_default_library", + actual = ":cert", + visibility = ["//visibility:public"], +) diff --git a/cmd/jwx/go.mod b/cmd/jwx/go.mod index c621fb42a..14329559e 100644 --- a/cmd/jwx/go.mod +++ b/cmd/jwx/go.mod @@ -3,19 +3,21 @@ module github.com/lestrrat-go/jwx/v2/cmd/jwx go 1.17 require ( - github.com/lestrrat-go/jwx/v2 v2.0.7 - github.com/urfave/cli/v2 v2.3.0 - golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f + github.com/lestrrat-go/jwx/v2 v2.0.8 + github.com/urfave/cli/v2 v2.24.4 + golang.org/x/crypto v0.7.0 ) require ( - github.com/cpuguy83/go-md2man/v2 v2.0.1 // indirect + github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect - github.com/goccy/go-json v0.9.11 // indirect + github.com/goccy/go-json v0.10.0 // indirect github.com/lestrrat-go/blackmagic v1.0.1 // indirect github.com/lestrrat-go/httpcc v1.0.1 // indirect github.com/lestrrat-go/httprc v1.0.4 // indirect github.com/lestrrat-go/iter v1.0.2 // indirect - github.com/lestrrat-go/option v1.0.0 // indirect + github.com/lestrrat-go/option v1.0.1 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect + github.com/stretchr/testify v1.8.2 // indirect + github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect ) diff --git a/cmd/jwx/go.sum b/cmd/jwx/go.sum index 751f5525d..a64eba7e3 100644 --- a/cmd/jwx/go.sum +++ b/cmd/jwx/go.sum @@ -1,15 +1,15 @@ -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= -github.com/cpuguy83/go-md2man/v2 v2.0.1 h1:r/myEWzV9lfsM1tFLgDyu0atFtJ1fXn261LKYj/3DxU= -github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/BurntSushi/toml v1.2.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= +github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= +github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 h1:HbphB4TFFXpv7MNrT52FGrrgVXF1owhMVTHFZIlnvd4= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0/go.mod h1:DZGJHZMqrU4JJqFAWUS2UO1+lbSKsdiOoYi9Zzey7Fc= -github.com/goccy/go-json v0.9.11 h1:/pAaQDLHEoCq/5FFmSKBswWmK6H0e8g4159Kc/X/nqk= github.com/goccy/go-json v0.9.11/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= +github.com/goccy/go-json v0.10.0 h1:mXKd9Qw4NuzShiRlOXKews24ufknHO7gx30lsDyokKA= +github.com/goccy/go-json v0.10.0/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/lestrrat-go/blackmagic v1.0.1 h1:lS5Zts+5HIC/8og6cGHb0uCcNCa3OUt1ygh3Qz2Fe80= github.com/lestrrat-go/blackmagic v1.0.1/go.mod h1:UrEqBzIR2U6CnzVyUtfM6oZNMt/7O7Vohk2J0OGSAtU= github.com/lestrrat-go/httpcc v1.0.1 h1:ydWCStUeJLkpYyjLDHihupbn2tYmZ7m22BGkcvZZrIE= @@ -18,37 +18,69 @@ github.com/lestrrat-go/httprc v1.0.4 h1:bAZymwoZQb+Oq8MEbyipag7iSq6YIga8Wj6GOiJG github.com/lestrrat-go/httprc v1.0.4/go.mod h1:mwwz3JMTPBjHUkkDv/IGJ39aALInZLrhBp0X7KGUZlo= github.com/lestrrat-go/iter v1.0.2 h1:gMXo1q4c2pHmC3dn8LzRhJfP1ceCbgSiT9lUydIzltI= github.com/lestrrat-go/iter v1.0.2/go.mod h1:Momfcq3AnRlRjI5b5O8/G5/BvpzrhoFTZcn06fEOPt4= -github.com/lestrrat-go/jwx/v2 v2.0.7 h1:vNh7cA5pKS/1muWYpM1GeUHBCf/r1UFxYN60iv7LFRA= -github.com/lestrrat-go/jwx/v2 v2.0.7/go.mod h1:zLxnyv9rTlEvOUHbc48FAfIL8iYu2hHvIRaTFGc8mT0= -github.com/lestrrat-go/option v1.0.0 h1:WqAWL8kh8VcSoD6xjSH34/1m8yxluXQbDeKNfvFeEO4= +github.com/lestrrat-go/jwx/v2 v2.0.8 h1:jCFT8oc0hEDVjgUgsBy1F9cbjsjAVZSXNi7JaU9HR/Q= +github.com/lestrrat-go/jwx/v2 v2.0.8/go.mod h1:zLxnyv9rTlEvOUHbc48FAfIL8iYu2hHvIRaTFGc8mT0= github.com/lestrrat-go/option v1.0.0/go.mod h1:5ZHFbivi4xwXxhxY9XHDe2FHo6/Z7WWmtT7T5nBBp3I= +github.com/lestrrat-go/option v1.0.1 h1:oAzP2fvZGQKWkvHa1/SAcFolBEca1oN+mQ7eooNBEYU= +github.com/lestrrat-go/option v1.0.1/go.mod h1:5ZHFbivi4xwXxhxY9XHDe2FHo6/Z7WWmtT7T5nBBp3I= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/urfave/cli/v2 v2.3.0 h1:qph92Y649prgesehzOrQjdWyxFOp/QVM+6imKHad91M= -github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI= -golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f h1:OeJjE6G4dgCY4PIXvIRQbE8+RX+uXZyGhUy/ksMGJoc= +github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/urfave/cli/v2 v2.24.4 h1:0gyJJEBYtCV87zI/x2nZCPyDxD51K6xM8SkwjHFCNEU= +github.com/urfave/cli/v2 v2.24.4/go.mod h1:GHupkWPMM0M/sj1a2b4wUrWBPzazNrIjouW6fmdJLxc= +github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU= +github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.7.0 h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A= +golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= +golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/deps.bzl b/deps.bzl new file mode 100644 index 000000000..e9ca97161 --- /dev/null +++ b/deps.bzl @@ -0,0 +1,178 @@ +load("@bazel_gazelle//:deps.bzl", "go_repository") + +def go_dependencies(): + go_repository( + name = "com_github_davecgh_go_spew", + build_file_proto_mode = "disable_global", + importpath = "github.com/davecgh/go-spew", + sum = "h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=", + version = "v1.1.1", + ) + go_repository( + name = "com_github_decred_dcrd_crypto_blake256", + build_file_proto_mode = "disable_global", + importpath = "github.com/decred/dcrd/crypto/blake256", + sum = "h1:/8DMNYp9SGi5f0w7uCm6d6M4OU2rGFK09Y2A4Xv7EE0=", + version = "v1.0.0", + ) + go_repository( + name = "com_github_decred_dcrd_dcrec_secp256k1_v4", + build_file_proto_mode = "disable_global", + importpath = "github.com/decred/dcrd/dcrec/secp256k1/v4", + sum = "h1:HbphB4TFFXpv7MNrT52FGrrgVXF1owhMVTHFZIlnvd4=", + version = "v4.1.0", + ) + go_repository( + name = "com_github_goccy_go_json", + build_file_proto_mode = "disable_global", + importpath = "github.com/goccy/go-json", + sum = "h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU=", + version = "v0.10.2", + ) + go_repository( + name = "com_github_lestrrat_go_blackmagic", + build_file_proto_mode = "disable_global", + importpath = "github.com/lestrrat-go/blackmagic", + sum = "h1:lS5Zts+5HIC/8og6cGHb0uCcNCa3OUt1ygh3Qz2Fe80=", + version = "v1.0.1", + ) + go_repository( + name = "com_github_lestrrat_go_httpcc", + build_file_proto_mode = "disable_global", + importpath = "github.com/lestrrat-go/httpcc", + sum = "h1:ydWCStUeJLkpYyjLDHihupbn2tYmZ7m22BGkcvZZrIE=", + version = "v1.0.1", + ) + go_repository( + name = "com_github_lestrrat_go_httprc", + build_file_proto_mode = "disable_global", + importpath = "github.com/lestrrat-go/httprc", + sum = "h1:bAZymwoZQb+Oq8MEbyipag7iSq6YIga8Wj6GOiJGdI8=", + version = "v1.0.4", + ) + go_repository( + name = "com_github_lestrrat_go_iter", + build_file_proto_mode = "disable_global", + importpath = "github.com/lestrrat-go/iter", + sum = "h1:gMXo1q4c2pHmC3dn8LzRhJfP1ceCbgSiT9lUydIzltI=", + version = "v1.0.2", + ) + + go_repository( + name = "com_github_lestrrat_go_option", + build_file_proto_mode = "disable_global", + importpath = "github.com/lestrrat-go/option", + sum = "h1:oAzP2fvZGQKWkvHa1/SAcFolBEca1oN+mQ7eooNBEYU=", + version = "v1.0.1", + ) + + go_repository( + name = "com_github_pmezard_go_difflib", + build_file_proto_mode = "disable_global", + importpath = "github.com/pmezard/go-difflib", + sum = "h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=", + version = "v1.0.0", + ) + go_repository( + name = "com_github_stretchr_objx", + build_file_proto_mode = "disable_global", + importpath = "github.com/stretchr/objx", + sum = "h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c=", + version = "v0.5.0", + ) + go_repository( + name = "com_github_stretchr_testify", + build_file_proto_mode = "disable_global", + importpath = "github.com/stretchr/testify", + sum = "h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8=", + version = "v1.8.2", + ) + go_repository( + name = "com_github_yuin_goldmark", + build_file_proto_mode = "disable_global", + importpath = "github.com/yuin/goldmark", + sum = "h1:fVcFKWvrslecOb/tg+Cc05dkeYx540o0FuFt3nUVDoE=", + version = "v1.4.13", + ) + + go_repository( + name = "in_gopkg_check_v1", + build_file_proto_mode = "disable_global", + importpath = "gopkg.in/check.v1", + sum = "h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=", + version = "v0.0.0-20161208181325-20d25e280405", + ) + + go_repository( + name = "in_gopkg_yaml_v3", + build_file_proto_mode = "disable_global", + importpath = "gopkg.in/yaml.v3", + sum = "h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=", + version = "v3.0.1", + ) + go_repository( + name = "org_golang_x_crypto", + build_file_proto_mode = "disable_global", + importpath = "golang.org/x/crypto", + sum = "h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A=", + version = "v0.7.0", + ) + go_repository( + name = "org_golang_x_mod", + build_file_proto_mode = "disable_global", + importpath = "golang.org/x/mod", + sum = "h1:LUYupSeNrTNCGzR/hVBk2NHZO4hXcVaW1k4Qx7rjPx8=", + version = "v0.8.0", + ) + + go_repository( + name = "org_golang_x_net", + build_file_proto_mode = "disable_global", + importpath = "golang.org/x/net", + sum = "h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ=", + version = "v0.8.0", + ) + go_repository( + name = "org_golang_x_sync", + build_file_proto_mode = "disable_global", + importpath = "golang.org/x/sync", + sum = "h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o=", + version = "v0.1.0", + ) + + go_repository( + name = "org_golang_x_sys", + build_file_proto_mode = "disable_global", + importpath = "golang.org/x/sys", + sum = "h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ=", + version = "v0.6.0", + ) + go_repository( + name = "org_golang_x_term", + build_file_proto_mode = "disable_global", + importpath = "golang.org/x/term", + sum = "h1:clScbb1cHjoCkyRbWwBEUZ5H/tIFu5TAXIqaZD0Gcjw=", + version = "v0.6.0", + ) + + go_repository( + name = "org_golang_x_text", + build_file_proto_mode = "disable_global", + importpath = "golang.org/x/text", + sum = "h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68=", + version = "v0.8.0", + ) + go_repository( + name = "org_golang_x_tools", + build_file_proto_mode = "disable_global", + importpath = "golang.org/x/tools", + sum = "h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM=", + version = "v0.6.0", + ) + go_repository( + name = "org_golang_x_xerrors", + build_file_proto_mode = "disable_global", + importpath = "golang.org/x/xerrors", + sum = "h1:9zdDQZ7Thm29KFXgAX/+yaf3eVbP7djjWp/dXAppNCc=", + version = "v0.0.0-20190717185122-a985d3407aa7", + ) diff --git a/docs/04-jwk.md b/docs/04-jwk.md index f2a83a77b..3d3098151 100644 --- a/docs/04-jwk.md +++ b/docs/04-jwk.md @@ -655,8 +655,7 @@ MAIN: return } _ = keyset - // The returned `keyset` will always be "reasonably" new. It is important that - // you always call `ar.Fetch()` before using the `keyset` as this is where the refreshing occurs. + // The returned `keyset` will always be "reasonably" new. // // By "reasonably" we mean that we cannot guarantee that the keys will be refreshed // immediately after it has been rotated in the remote source. But it should be close\ diff --git a/examples/go.mod b/examples/go.mod index 56f87cfbf..b0c4e492e 100644 --- a/examples/go.mod +++ b/examples/go.mod @@ -4,7 +4,9 @@ go 1.16 require ( github.com/cloudflare/circl v1.1.0 - github.com/lestrrat-go/jwx/v2 v2.0.7 + github.com/lestrrat-go/jwx/v2 v2.0.8 + github.com/stretchr/testify v1.8.2 // indirect + golang.org/x/crypto v0.7.0 // indirect ) replace github.com/cloudflare/circl v1.0.0 => github.com/cloudflare/circl v1.0.1-0.20210104183656-96a0695de3c3 diff --git a/examples/go.sum b/examples/go.sum index 234174f9c..4e0f3e686 100644 --- a/examples/go.sum +++ b/examples/go.sum @@ -17,8 +17,8 @@ github.com/lestrrat-go/httprc v1.0.4 h1:bAZymwoZQb+Oq8MEbyipag7iSq6YIga8Wj6GOiJG github.com/lestrrat-go/httprc v1.0.4/go.mod h1:mwwz3JMTPBjHUkkDv/IGJ39aALInZLrhBp0X7KGUZlo= github.com/lestrrat-go/iter v1.0.2 h1:gMXo1q4c2pHmC3dn8LzRhJfP1ceCbgSiT9lUydIzltI= github.com/lestrrat-go/iter v1.0.2/go.mod h1:Momfcq3AnRlRjI5b5O8/G5/BvpzrhoFTZcn06fEOPt4= -github.com/lestrrat-go/jwx/v2 v2.0.7 h1:vNh7cA5pKS/1muWYpM1GeUHBCf/r1UFxYN60iv7LFRA= -github.com/lestrrat-go/jwx/v2 v2.0.7/go.mod h1:zLxnyv9rTlEvOUHbc48FAfIL8iYu2hHvIRaTFGc8mT0= +github.com/lestrrat-go/jwx/v2 v2.0.8 h1:jCFT8oc0hEDVjgUgsBy1F9cbjsjAVZSXNi7JaU9HR/Q= +github.com/lestrrat-go/jwx/v2 v2.0.8/go.mod h1:zLxnyv9rTlEvOUHbc48FAfIL8iYu2hHvIRaTFGc8mT0= github.com/lestrrat-go/option v1.0.0 h1:WqAWL8kh8VcSoD6xjSH34/1m8yxluXQbDeKNfvFeEO4= github.com/lestrrat-go/option v1.0.0/go.mod h1:5ZHFbivi4xwXxhxY9XHDe2FHo6/Z7WWmtT7T5nBBp3I= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= @@ -29,22 +29,51 @@ github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpE github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f h1:OeJjE6G4dgCY4PIXvIRQbE8+RX+uXZyGhUy/ksMGJoc= golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.7.0 h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A= +golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac h1:oN6lz7iLW/YC7un8pq+9bOLyXrprv2+DKfkJY+2LJJw= golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= +golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/examples/jwk_cache_example_test.go b/examples/jwk_cache_example_test.go index 5c1f41c2e..e91a41479 100644 --- a/examples/jwk_cache_example_test.go +++ b/examples/jwk_cache_example_test.go @@ -49,8 +49,7 @@ MAIN: return } _ = keyset - // The returned `keyset` will always be "reasonably" new. It is important that - // you always call `ar.Fetch()` before using the `keyset` as this is where the refreshing occurs. + // The returned `keyset` will always be "reasonably" new. // // By "reasonably" we mean that we cannot guarantee that the keys will be refreshed // immediately after it has been rotated in the remote source. But it should be close\ diff --git a/go.mod b/go.mod index 08baa8f7f..6e8b82c0a 100644 --- a/go.mod +++ b/go.mod @@ -4,11 +4,11 @@ go 1.16 require ( github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 - github.com/goccy/go-json v0.9.11 + github.com/goccy/go-json v0.10.2 github.com/lestrrat-go/blackmagic v1.0.1 github.com/lestrrat-go/httprc v1.0.4 github.com/lestrrat-go/iter v1.0.2 - github.com/lestrrat-go/option v1.0.0 - github.com/stretchr/testify v1.8.1 - golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f + github.com/lestrrat-go/option v1.0.1 + github.com/stretchr/testify v1.8.2 + golang.org/x/crypto v0.7.0 ) diff --git a/go.sum b/go.sum index 65ce6ebb3..55d4f1da8 100644 --- a/go.sum +++ b/go.sum @@ -4,8 +4,8 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 h1:HbphB4TFFXpv7MNrT52FGrrgVXF1owhMVTHFZIlnvd4= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0/go.mod h1:DZGJHZMqrU4JJqFAWUS2UO1+lbSKsdiOoYi9Zzey7Fc= -github.com/goccy/go-json v0.9.11 h1:/pAaQDLHEoCq/5FFmSKBswWmK6H0e8g4159Kc/X/nqk= -github.com/goccy/go-json v0.9.11/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= +github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= +github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/lestrrat-go/blackmagic v1.0.1 h1:lS5Zts+5HIC/8og6cGHb0uCcNCa3OUt1ygh3Qz2Fe80= github.com/lestrrat-go/blackmagic v1.0.1/go.mod h1:UrEqBzIR2U6CnzVyUtfM6oZNMt/7O7Vohk2J0OGSAtU= github.com/lestrrat-go/httpcc v1.0.1 h1:ydWCStUeJLkpYyjLDHihupbn2tYmZ7m22BGkcvZZrIE= @@ -14,8 +14,9 @@ github.com/lestrrat-go/httprc v1.0.4 h1:bAZymwoZQb+Oq8MEbyipag7iSq6YIga8Wj6GOiJG github.com/lestrrat-go/httprc v1.0.4/go.mod h1:mwwz3JMTPBjHUkkDv/IGJ39aALInZLrhBp0X7KGUZlo= github.com/lestrrat-go/iter v1.0.2 h1:gMXo1q4c2pHmC3dn8LzRhJfP1ceCbgSiT9lUydIzltI= github.com/lestrrat-go/iter v1.0.2/go.mod h1:Momfcq3AnRlRjI5b5O8/G5/BvpzrhoFTZcn06fEOPt4= -github.com/lestrrat-go/option v1.0.0 h1:WqAWL8kh8VcSoD6xjSH34/1m8yxluXQbDeKNfvFeEO4= github.com/lestrrat-go/option v1.0.0/go.mod h1:5ZHFbivi4xwXxhxY9XHDe2FHo6/Z7WWmtT7T5nBBp3I= +github.com/lestrrat-go/option v1.0.1 h1:oAzP2fvZGQKWkvHa1/SAcFolBEca1oN+mQ7eooNBEYU= +github.com/lestrrat-go/option v1.0.1/go.mod h1:5ZHFbivi4xwXxhxY9XHDe2FHo6/Z7WWmtT7T5nBBp3I= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -24,17 +25,44 @@ github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpE github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= -github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f h1:OeJjE6G4dgCY4PIXvIRQbE8+RX+uXZyGhUy/ksMGJoc= -golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.7.0 h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A= +golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= +golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/internal/base64/BUILD.bazel b/internal/base64/BUILD.bazel new file mode 100644 index 000000000..688265f6b --- /dev/null +++ b/internal/base64/BUILD.bazel @@ -0,0 +1,21 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "base64", + srcs = ["base64.go"], + importpath = "github.com/lestrrat-go/jwx/v2/internal/base64", + visibility = ["//:__subpackages__"], +) + +go_test( + name = "base64_test", + srcs = ["base64_test.go"], + embed = [":base64"], + deps = ["@com_github_stretchr_testify//assert"], +) + +alias( + name = "go_default_library", + actual = ":base64", + visibility = ["//:__subpackages__"], +) diff --git a/internal/ecutil/BUILD.bazel b/internal/ecutil/BUILD.bazel new file mode 100644 index 000000000..3d5987ded --- /dev/null +++ b/internal/ecutil/BUILD.bazel @@ -0,0 +1,15 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "ecutil", + srcs = ["ecutil.go"], + importpath = "github.com/lestrrat-go/jwx/v2/internal/ecutil", + visibility = ["//:__subpackages__"], + deps = ["//jwa"], +) + +alias( + name = "go_default_library", + actual = ":ecutil", + visibility = ["//:__subpackages__"], +) diff --git a/internal/iter/BUILD.bazel b/internal/iter/BUILD.bazel new file mode 100644 index 000000000..5d7b3d95d --- /dev/null +++ b/internal/iter/BUILD.bazel @@ -0,0 +1,15 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "iter", + srcs = ["mapiter.go"], + importpath = "github.com/lestrrat-go/jwx/v2/internal/iter", + visibility = ["//:__subpackages__"], + deps = ["@com_github_lestrrat_go_iter//mapiter:go_default_library"], +) + +alias( + name = "go_default_library", + actual = ":iter", + visibility = ["//:__subpackages__"], +) diff --git a/internal/jose/BUILD.bazel b/internal/jose/BUILD.bazel new file mode 100644 index 000000000..2e4919267 --- /dev/null +++ b/internal/jose/BUILD.bazel @@ -0,0 +1,15 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "jose", + srcs = ["jose.go"], + importpath = "github.com/lestrrat-go/jwx/v2/internal/jose", + visibility = ["//:__subpackages__"], + deps = ["//internal/jwxtest"], +) + +alias( + name = "go_default_library", + actual = ":jose", + visibility = ["//:__subpackages__"], +) diff --git a/internal/jose/jose.go b/internal/jose/jose.go index 654d7973a..be16b66fc 100644 --- a/internal/jose/jose.go +++ b/internal/jose/jose.go @@ -1,6 +1,7 @@ package jose import ( + "bufio" "bytes" "context" "fmt" @@ -82,6 +83,41 @@ func RunJoseCommand(ctx context.Context, t *testing.T, args []string, outw, errw return nil } +type AlgorithmSet struct { + data map[string]struct{} +} + +func NewAlgorithmSet() *AlgorithmSet { + return &AlgorithmSet{ + data: make(map[string]struct{}), + } +} + +func (set *AlgorithmSet) Add(s string) { + set.data[s] = struct{}{} +} + +func (set *AlgorithmSet) Has(s string) bool { + _, ok := set.data[s] + return ok +} + +func Algorithms(ctx context.Context, t *testing.T) (*AlgorithmSet, error) { + var buf bytes.Buffer + if err := RunJoseCommand(ctx, t, []string{"alg"}, &buf, nil); err != nil { + return nil, fmt.Errorf(`failed to generate jose tool's supported algorithms: %w`, err) + } + + set := NewAlgorithmSet() + + scanner := bufio.NewScanner(&buf) + for scanner.Scan() { + alg := scanner.Text() + set.Add(alg) + } + return set, nil +} + // GenerateJwk creates a new key using the jose tool, and returns its filename and // a cleanup function. // The caller is responsible for calling the cleanup diff --git a/internal/json/BUILD.bazel b/internal/json/BUILD.bazel new file mode 100644 index 000000000..f3dba9710 --- /dev/null +++ b/internal/json/BUILD.bazel @@ -0,0 +1,19 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "json", + srcs = [ + "json.go", + "registry.go", + "stdlib.go", + ], + importpath = "github.com/lestrrat-go/jwx/v2/internal/json", + visibility = ["//:__subpackages__"], + deps = ["//internal/base64"], +) + +alias( + name = "go_default_library", + actual = ":json", + visibility = ["//:__subpackages__"], +) diff --git a/internal/jwxtest/BUILD.bazel b/internal/jwxtest/BUILD.bazel new file mode 100644 index 000000000..5e252e2d9 --- /dev/null +++ b/internal/jwxtest/BUILD.bazel @@ -0,0 +1,23 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "jwxtest", + srcs = ["jwxtest.go"], + importpath = "github.com/lestrrat-go/jwx/v2/internal/jwxtest", + visibility = ["//:__subpackages__"], + deps = [ + "//internal/ecutil", + "//jwa", + "//jwe", + "//jwk", + "//jws", + "//x25519", + "@com_github_stretchr_testify//assert", + ], +) + +alias( + name = "go_default_library", + actual = ":jwxtest", + visibility = ["//:__subpackages__"], +) diff --git a/internal/keyconv/BUILD.bazel b/internal/keyconv/BUILD.bazel new file mode 100644 index 000000000..246dfb864 --- /dev/null +++ b/internal/keyconv/BUILD.bazel @@ -0,0 +1,31 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "keyconv", + srcs = ["keyconv.go"], + importpath = "github.com/lestrrat-go/jwx/v2/internal/keyconv", + visibility = ["//:__subpackages__"], + deps = [ + "//jwk", + "@com_github_lestrrat_go_blackmagic//:go_default_library", + "@org_golang_x_crypto//ed25519", + ], +) + +go_test( + name = "keyconv_test", + srcs = ["keyconv_test.go"], + deps = [ + ":keyconv", + "//internal/jwxtest", + "//jwa", + "//jwk", + "@com_github_stretchr_testify//assert", + ], +) + +alias( + name = "go_default_library", + actual = ":keyconv", + visibility = ["//:__subpackages__"], +) diff --git a/internal/pool/BUILD.bazel b/internal/pool/BUILD.bazel new file mode 100644 index 000000000..bab9745cb --- /dev/null +++ b/internal/pool/BUILD.bazel @@ -0,0 +1,14 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "pool", + srcs = ["pool.go"], + importpath = "github.com/lestrrat-go/jwx/v2/internal/pool", + visibility = ["//:__subpackages__"], +) + +alias( + name = "go_default_library", + actual = ":pool", + visibility = ["//:__subpackages__"], +) diff --git a/jwa/BUILD.bazel b/jwa/BUILD.bazel new file mode 100644 index 000000000..63fffcf90 --- /dev/null +++ b/jwa/BUILD.bazel @@ -0,0 +1,39 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "jwa", + srcs = [ + "compression_gen.go", + "content_encryption_gen.go", + "elliptic_gen.go", + "jwa.go", + "key_encryption_gen.go", + "key_type_gen.go", + "signature_gen.go", + ], + importpath = "github.com/lestrrat-go/jwx/v2/jwa", + visibility = ["//visibility:public"], +) + +go_test( + name = "jwa_test", + srcs = [ + "compression_gen_test.go", + "content_encryption_gen_test.go", + "elliptic_gen_test.go", + "jwa_test.go", + "key_encryption_gen_test.go", + "key_type_gen_test.go", + "signature_gen_test.go", + ], + deps = [ + ":jwa", + "@com_github_stretchr_testify//assert", + ], +) + +alias( + name = "go_default_library", + actual = ":jwa", + visibility = ["//visibility:public"], +) diff --git a/jwa/compression_gen.go b/jwa/compression_gen.go index 1649b4a55..ad27ea3f3 100644 --- a/jwa/compression_gen.go +++ b/jwa/compression_gen.go @@ -1,4 +1,4 @@ -// this file was auto-generated by internal/cmd/gentypes/main.go: DO NOT EDIT +// Code generated by tools/cmd/genjwa/main.go. DO NOT EDIT. package jwa diff --git a/jwa/compression_gen_test.go b/jwa/compression_gen_test.go index 29e2292f6..016e6093e 100644 --- a/jwa/compression_gen_test.go +++ b/jwa/compression_gen_test.go @@ -1,4 +1,4 @@ -// this file was auto-generated by internal/cmd/gentypes/main.go: DO NOT EDIT +// Code generated by tools/cmd/genjwa/main.go. DO NOT EDIT package jwa_test diff --git a/jwa/content_encryption_gen.go b/jwa/content_encryption_gen.go index fe0e062f6..bc82d5058 100644 --- a/jwa/content_encryption_gen.go +++ b/jwa/content_encryption_gen.go @@ -1,4 +1,4 @@ -// this file was auto-generated by internal/cmd/gentypes/main.go: DO NOT EDIT +// Code generated by tools/cmd/genjwa/main.go. DO NOT EDIT. package jwa diff --git a/jwa/content_encryption_gen_test.go b/jwa/content_encryption_gen_test.go index 348aa9837..7eec98652 100644 --- a/jwa/content_encryption_gen_test.go +++ b/jwa/content_encryption_gen_test.go @@ -1,4 +1,4 @@ -// this file was auto-generated by internal/cmd/gentypes/main.go: DO NOT EDIT +// Code generated by tools/cmd/genjwa/main.go. DO NOT EDIT package jwa_test diff --git a/jwa/elliptic_gen.go b/jwa/elliptic_gen.go index d948e0798..6e813989e 100644 --- a/jwa/elliptic_gen.go +++ b/jwa/elliptic_gen.go @@ -1,4 +1,4 @@ -// this file was auto-generated by internal/cmd/gentypes/main.go: DO NOT EDIT +// Code generated by tools/cmd/genjwa/main.go. DO NOT EDIT. package jwa diff --git a/jwa/elliptic_gen_test.go b/jwa/elliptic_gen_test.go index b37f39d4c..badec268d 100644 --- a/jwa/elliptic_gen_test.go +++ b/jwa/elliptic_gen_test.go @@ -1,4 +1,4 @@ -// this file was auto-generated by internal/cmd/gentypes/main.go: DO NOT EDIT +// Code generated by tools/cmd/genjwa/main.go. DO NOT EDIT package jwa_test diff --git a/jwa/key_encryption_gen.go b/jwa/key_encryption_gen.go index 80a97d9b8..f85574ffa 100644 --- a/jwa/key_encryption_gen.go +++ b/jwa/key_encryption_gen.go @@ -1,4 +1,4 @@ -// this file was auto-generated by internal/cmd/gentypes/main.go: DO NOT EDIT +// Code generated by tools/cmd/genjwa/main.go. DO NOT EDIT. package jwa diff --git a/jwa/key_encryption_gen_test.go b/jwa/key_encryption_gen_test.go index 0cd11b913..26250b584 100644 --- a/jwa/key_encryption_gen_test.go +++ b/jwa/key_encryption_gen_test.go @@ -1,4 +1,4 @@ -// this file was auto-generated by internal/cmd/gentypes/main.go: DO NOT EDIT +// Code generated by tools/cmd/genjwa/main.go. DO NOT EDIT package jwa_test diff --git a/jwa/key_type_gen.go b/jwa/key_type_gen.go index a55da787e..2b602c67a 100644 --- a/jwa/key_type_gen.go +++ b/jwa/key_type_gen.go @@ -1,4 +1,4 @@ -// this file was auto-generated by internal/cmd/gentypes/main.go: DO NOT EDIT +// Code generated by tools/cmd/genjwa/main.go. DO NOT EDIT. package jwa diff --git a/jwa/key_type_gen_test.go b/jwa/key_type_gen_test.go index 1e1dabe2a..56df50642 100644 --- a/jwa/key_type_gen_test.go +++ b/jwa/key_type_gen_test.go @@ -1,4 +1,4 @@ -// this file was auto-generated by internal/cmd/gentypes/main.go: DO NOT EDIT +// Code generated by tools/cmd/genjwa/main.go. DO NOT EDIT package jwa_test diff --git a/jwa/signature_gen.go b/jwa/signature_gen.go index 40cb01790..bc2cbb91c 100644 --- a/jwa/signature_gen.go +++ b/jwa/signature_gen.go @@ -1,4 +1,4 @@ -// this file was auto-generated by internal/cmd/gentypes/main.go: DO NOT EDIT +// Code generated by tools/cmd/genjwa/main.go. DO NOT EDIT. package jwa diff --git a/jwa/signature_gen_test.go b/jwa/signature_gen_test.go index a00a20d10..647111fd6 100644 --- a/jwa/signature_gen_test.go +++ b/jwa/signature_gen_test.go @@ -1,4 +1,4 @@ -// this file was auto-generated by internal/cmd/gentypes/main.go: DO NOT EDIT +// Code generated by tools/cmd/genjwa/main.go. DO NOT EDIT package jwa_test diff --git a/jwe/BUILD.bazel b/jwe/BUILD.bazel new file mode 100644 index 000000000..a5e3f4e0f --- /dev/null +++ b/jwe/BUILD.bazel @@ -0,0 +1,68 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "jwe", + srcs = [ + "compress.go", + "decrypt.go", + "headers.go", + "headers_gen.go", + "interface.go", + "io.go", + "jwe.go", + "key_provider.go", + "message.go", + "options.go", + "options_gen.go", + ], + importpath = "github.com/lestrrat-go/jwx/v2/jwe", + visibility = ["//visibility:public"], + deps = [ + "//cert", + "//internal/base64", + "//internal/iter", + "//internal/json", + "//internal/keyconv", + "//internal/pool", + "//jwa", + "//jwe/internal/cipher", + "//jwe/internal/content_crypt", + "//jwe/internal/keyenc", + "//jwe/internal/keygen", + "//jwk", + "//x25519", + "@com_github_lestrrat_go_blackmagic//:go_default_library", + "@com_github_lestrrat_go_iter//mapiter:go_default_library", + "@com_github_lestrrat_go_option//:option", + "@org_golang_x_crypto//pbkdf2", + ], +) + +go_test( + name = "jwe_test", + srcs = [ + "gh402_test.go", + "headers_test.go", + "jwe_test.go", + "message_test.go", + "options_gen_test.go", + "speed_test.go", + ], + embed = [":jwe"], + deps = [ + "//cert", + "//internal/json", + "//internal/jwxtest", + "//jwa", + "//jwk", + "//x25519", + "@com_github_stretchr_testify//assert", + "@com_github_stretchr_testify//require", + ], +) + +alias( + name = "go_default_library", + actual = ":jwe", + visibility = ["//visibility:public"], +) diff --git a/jwe/headers_gen.go b/jwe/headers_gen.go index 61ce413cb..5377fff3d 100644 --- a/jwe/headers_gen.go +++ b/jwe/headers_gen.go @@ -1,4 +1,4 @@ -// This file is auto-generated by jwe/internal/cmd/genheaders/main.go. DO NOT EDIT +// Code generated by tools/cmd/genjwe/main.go. DO NOT EDIT. package jwe diff --git a/jwe/internal/aescbc/BUILD.bazel b/jwe/internal/aescbc/BUILD.bazel new file mode 100644 index 000000000..2db324c4a --- /dev/null +++ b/jwe/internal/aescbc/BUILD.bazel @@ -0,0 +1,21 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "aescbc", + srcs = ["aescbc.go"], + importpath = "github.com/lestrrat-go/jwx/v2/jwe/internal/aescbc", + visibility = ["//:__subpackages__"], +) + +go_test( + name = "aescbc_test", + srcs = ["aescbc_test.go"], + embed = [":aescbc"], + deps = ["@com_github_stretchr_testify//assert"], +) + +alias( + name = "go_default_library", + actual = ":aescbc", + visibility = ["//jwe:__subpackages__"], +) diff --git a/jwe/internal/cipher/BUILD.bazel b/jwe/internal/cipher/BUILD.bazel new file mode 100644 index 000000000..880c08f86 --- /dev/null +++ b/jwe/internal/cipher/BUILD.bazel @@ -0,0 +1,32 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "cipher", + srcs = [ + "cipher.go", + "interface.go", + ], + importpath = "github.com/lestrrat-go/jwx/v2/jwe/internal/cipher", + visibility = ["//:__subpackages__"], + deps = [ + "//jwa", + "//jwe/internal/aescbc", + "//jwe/internal/keygen", + ], +) + +go_test( + name = "cipher_test", + srcs = ["cipher_test.go"], + deps = [ + ":cipher", + "//jwa", + "@com_github_stretchr_testify//assert", + ], +) + +alias( + name = "go_default_library", + actual = ":cipher", + visibility = ["//jwe:__subpackages__"], +) diff --git a/jwe/internal/concatkdf/BUILD.bazel b/jwe/internal/concatkdf/BUILD.bazel new file mode 100644 index 000000000..38b666b92 --- /dev/null +++ b/jwe/internal/concatkdf/BUILD.bazel @@ -0,0 +1,24 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "concatkdf", + srcs = ["concatkdf.go"], + importpath = "github.com/lestrrat-go/jwx/v2/jwe/internal/concatkdf", + visibility = ["//:__subpackages__"], +) + +go_test( + name = "concatkdf_test", + srcs = ["concatkdf_test.go"], + embed = [":concatkdf"], + deps = [ + "//jwa", + "@com_github_stretchr_testify//assert", + ], +) + +alias( + name = "go_default_library", + actual = ":concatkdf", + visibility = ["//jwe:__subpackages__"], +) diff --git a/jwe/internal/content_crypt/BUILD.bazel b/jwe/internal/content_crypt/BUILD.bazel new file mode 100644 index 000000000..60eacfb10 --- /dev/null +++ b/jwe/internal/content_crypt/BUILD.bazel @@ -0,0 +1,21 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "content_crypt", + srcs = [ + "content_crypt.go", + "interface.go", + ], + importpath = "github.com/lestrrat-go/jwx/v2/jwe/internal/content_crypt", + visibility = ["//:__subpackages__"], + deps = [ + "//jwa", + "//jwe/internal/cipher", + ], +) + +alias( + name = "go_default_library", + actual = ":content_crypt", + visibility = ["//jwe:__subpackages__"], +) diff --git a/jwe/internal/keyenc/BUILD.bazel b/jwe/internal/keyenc/BUILD.bazel new file mode 100644 index 000000000..fc771789b --- /dev/null +++ b/jwe/internal/keyenc/BUILD.bazel @@ -0,0 +1,37 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "keyenc", + srcs = [ + "interface.go", + "keyenc.go", + ], + importpath = "github.com/lestrrat-go/jwx/v2/jwe/internal/keyenc", + visibility = ["//:__subpackages__"], + deps = [ + "//internal/ecutil", + "//jwa", + "//jwe/internal/cipher", + "//jwe/internal/concatkdf", + "//jwe/internal/keygen", + "//x25519", + "@org_golang_x_crypto//curve25519", + "@org_golang_x_crypto//pbkdf2", + ], +) + +go_test( + name = "keyenc_test", + srcs = ["keyenc_test.go"], + deps = [ + ":keyenc", + "//jwk", + "@com_github_stretchr_testify//assert", + ], +) + +alias( + name = "go_default_library", + actual = ":keyenc", + visibility = ["//jwe:__subpackages__"], +) diff --git a/jwe/internal/keygen/BUILD.bazel b/jwe/internal/keygen/BUILD.bazel new file mode 100644 index 000000000..a47b79093 --- /dev/null +++ b/jwe/internal/keygen/BUILD.bazel @@ -0,0 +1,25 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "keygen", + srcs = [ + "interface.go", + "keygen.go", + ], + importpath = "github.com/lestrrat-go/jwx/v2/jwe/internal/keygen", + visibility = ["//:__subpackages__"], + deps = [ + "//internal/ecutil", + "//jwa", + "//jwe/internal/concatkdf", + "//jwk", + "//x25519", + "@org_golang_x_crypto//curve25519", + ], +) + +alias( + name = "go_default_library", + actual = ":keygen", + visibility = ["//jwe:__subpackages__"], +) diff --git a/jwe/io.go b/jwe/io.go index e10119984..27b6941eb 100644 --- a/jwe/io.go +++ b/jwe/io.go @@ -1,4 +1,4 @@ -// Automatically generated by internal/cmd/genreadfile/main.go. DO NOT EDIT +// Code generated by tools/cmd/genreadfile/main.go. DO NOT EDIT. package jwe @@ -14,15 +14,6 @@ func (sysFS) Open(path string) (fs.File, error) { } func ReadFile(path string, options ...ReadFileOption) (*Message, error) { - var parseOptions []ParseOption - var readFileOptions []ReadFileOption - for _, option := range options { - if po, ok := option.(ParseOption); ok { - parseOptions = append(parseOptions, po) - } else { - readFileOptions = append(readFileOptions, option) - } - } var srcFS fs.FS = sysFS{} for _, option := range options { diff --git a/jwe/options_gen.go b/jwe/options_gen.go index 9adb9753e..c22e2a5f0 100644 --- a/jwe/options_gen.go +++ b/jwe/options_gen.go @@ -1,4 +1,4 @@ -// This file is auto-generated by internal/cmd/genoptions/main.go. DO NOT EDIT +// Code generated by tools/cmd/genoptions/main.go. DO NOT EDIT. package jwe diff --git a/jwe/options_gen_test.go b/jwe/options_gen_test.go index f58bfa574..da3bbbfe7 100644 --- a/jwe/options_gen_test.go +++ b/jwe/options_gen_test.go @@ -1,4 +1,4 @@ -// This file is auto-generated by internal/cmd/genoptions/main.go. DO NOT EDIT +// Code generated by tools/cmd/genoptions/main.go. DO NOT EDIT. package jwe diff --git a/jwk/BUILD.bazel b/jwk/BUILD.bazel new file mode 100644 index 000000000..a61a919f5 --- /dev/null +++ b/jwk/BUILD.bazel @@ -0,0 +1,78 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "jwk", + srcs = [ + "cache.go", + "ecdsa.go", + "ecdsa_gen.go", + "fetch.go", + "interface.go", + "interface_gen.go", + "io.go", + "jwk.go", + "key_ops.go", + "okp.go", + "okp_gen.go", + "options.go", + "options_gen.go", + "rsa.go", + "rsa_gen.go", + "set.go", + "symmetric.go", + "symmetric_gen.go", + "usage.go", + "whitelist.go", + ], + importpath = "github.com/lestrrat-go/jwx/v2/jwk", + visibility = ["//visibility:public"], + deps = [ + "//cert", + "//internal/base64", + "//internal/ecutil", + "//internal/iter", + "//internal/json", + "//internal/pool", + "//jwa", + "//x25519", + "@com_github_lestrrat_go_blackmagic//:go_default_library", + "@com_github_lestrrat_go_httprc//:go_default_library", + "@com_github_lestrrat_go_iter//arrayiter:go_default_library", + "@com_github_lestrrat_go_iter//mapiter:go_default_library", + "@com_github_lestrrat_go_option//:option", + ], +) + +go_test( + name = "jwk_test", + srcs = [ + "headers_test.go", + "jwk_internal_test.go", + "jwk_test.go", + "options_gen_test.go", + "refresh_test.go", + "set_test.go", + "x5c_test.go", + ], + data = glob(["testdata/**"]), + embed = [":jwk"], + deps = [ + "//cert", + "//internal/base64", + "//internal/ecutil", + "//internal/jose", + "//internal/json", + "//internal/jwxtest", + "//jwa", + "//jws", + "//x25519", + "@com_github_stretchr_testify//assert", + "@com_github_stretchr_testify//require", + ], +) + +alias( + name = "go_default_library", + actual = ":jwk", + visibility = ["//visibility:public"], +) diff --git a/jwk/README.md b/jwk/README.md index a5ded403d..ff6b4a4f9 100644 --- a/jwk/README.md +++ b/jwk/README.md @@ -81,8 +81,7 @@ MAIN: return } _ = keyset - // The returned `keyset` will always be "reasonably" new. It is important that - // you always call `ar.Fetch()` before using the `keyset` as this is where the refreshing occurs. + // The returned `keyset` will always be "reasonably" new. // // By "reasonably" we mean that we cannot guarantee that the keys will be refreshed // immediately after it has been rotated in the remote source. But it should be close\ diff --git a/jwk/ecdsa_gen.go b/jwk/ecdsa_gen.go index 92f56f5a6..95a299517 100644 --- a/jwk/ecdsa_gen.go +++ b/jwk/ecdsa_gen.go @@ -1,4 +1,4 @@ -// This file is auto-generated by jwk/internal/cmd/genheader/main.go. DO NOT EDIT +// Code generated by tools/cmd/genjwk/main.go. DO NOT EDIT. package jwk diff --git a/jwk/interface_gen.go b/jwk/interface_gen.go index ee765127d..6e4e79a04 100644 --- a/jwk/interface_gen.go +++ b/jwk/interface_gen.go @@ -1,4 +1,4 @@ -// This file is auto-generated. DO NOT EDIT +// Code generated by tools/cmd/genjwk/main.go. DO NOT EDIT. package jwk diff --git a/jwk/io.go b/jwk/io.go index 4e0d487ee..2dc097e2f 100644 --- a/jwk/io.go +++ b/jwk/io.go @@ -1,4 +1,4 @@ -// Automatically generated by internal/cmd/genreadfile/main.go. DO NOT EDIT +// Code generated by tools/cmd/genreadfile/main.go. DO NOT EDIT. package jwk @@ -15,12 +15,9 @@ func (sysFS) Open(path string) (fs.File, error) { func ReadFile(path string, options ...ReadFileOption) (Set, error) { var parseOptions []ParseOption - var readFileOptions []ReadFileOption for _, option := range options { if po, ok := option.(ParseOption); ok { parseOptions = append(parseOptions, po) - } else { - readFileOptions = append(readFileOptions, option) } } diff --git a/jwk/jwk.go b/jwk/jwk.go index 3d4671c1f..7aced4920 100644 --- a/jwk/jwk.go +++ b/jwk/jwk.go @@ -234,8 +234,11 @@ func PublicRawKeyOf(v interface{}) (interface{}, error) { } const ( - pmPrivateKey = `PRIVATE KEY` - pmPublicKey = `PUBLIC KEY` + pmPrivateKey = `PRIVATE KEY` + pmPublicKey = `PUBLIC KEY` + pmECPrivateKey = `EC PRIVATE KEY` + pmRSAPublicKey = `RSA PUBLIC KEY` + pmRSAPrivateKey = `RSA PRIVATE KEY` ) // EncodeX509 encodes the key into a byte sequence in ASN.1 DER format @@ -263,13 +266,13 @@ func EncodeX509(v interface{}) (string, []byte, error) { // Try to convert it into a certificate switch v := v.(type) { case *rsa.PrivateKey: - return "RSA PRIVATE KEY", x509.MarshalPKCS1PrivateKey(v), nil + return pmRSAPrivateKey, x509.MarshalPKCS1PrivateKey(v), nil case *ecdsa.PrivateKey: marshaled, err := x509.MarshalECPrivateKey(v) if err != nil { return "", nil, err } - return "ECDSA PRIVATE KEY", marshaled, nil + return pmECPrivateKey, marshaled, nil case ed25519.PrivateKey: marshaled, err := x509.MarshalPKCS8PrivateKey(v) if err != nil { @@ -316,19 +319,19 @@ func DecodePEM(src []byte) (interface{}, []byte, error) { switch block.Type { // Handle the semi-obvious cases - case "RSA PRIVATE KEY": + case pmRSAPrivateKey: key, err := x509.ParsePKCS1PrivateKey(block.Bytes) if err != nil { return nil, nil, fmt.Errorf(`failed to parse PKCS1 private key: %w`, err) } return key, rest, nil - case "RSA PUBLIC KEY": + case pmRSAPublicKey: key, err := x509.ParsePKCS1PublicKey(block.Bytes) if err != nil { return nil, nil, fmt.Errorf(`failed to parse PKCS1 public key: %w`, err) } return key, rest, nil - case "EC PRIVATE KEY": + case pmECPrivateKey: key, err := x509.ParseECPrivateKey(block.Bytes) if err != nil { return nil, nil, fmt.Errorf(`failed to parse EC private key: %w`, err) diff --git a/jwk/jwk_test.go b/jwk/jwk_test.go index 4e30d06c0..f5c084c93 100644 --- a/jwk/jwk_test.go +++ b/jwk/jwk_test.go @@ -214,28 +214,65 @@ func VerifyKey(t *testing.T, def map[string]keyDef) { } }) t.Run("Roundtrip", func(t *testing.T) { - buf, err := json.Marshal(key) - if !assert.NoError(t, err, `json.Marshal should succeed`) { - return + var supportsPEM bool + switch key.KeyType() { + case jwa.OKP, jwa.OctetSeq: + default: + supportsPEM = true } - newkey, err := jwk.ParseKey(buf) - if !assert.NoError(t, err, `jwk.ParseKey should succeed`) { - return - } + for _, usePEM := range []bool{true, false} { + if usePEM && !supportsPEM { + continue + } + t.Run(fmt.Sprintf("WithPEM(%t)", usePEM), func(t *testing.T) { + var buf []byte + if usePEM { + pem, err := jwk.EncodePEM(key) + if !assert.NoError(t, err, `jwk.EncodePEM should succeed`) { + return + } + buf = pem + } else { + jsonbuf, err := json.Marshal(key) + if !assert.NoError(t, err, `json.Marshal should succeed`) { + return + } + buf = jsonbuf + } - m1, err := key.AsMap(context.TODO()) - if !assert.NoError(t, err, `key.AsMap should succeed`) { - return - } + newkey, err := jwk.ParseKey(buf, jwk.WithPEM(usePEM)) + if !assert.NoError(t, err, `jwk.ParseKey should succeed`) { + return + } - m2, err := newkey.AsMap(context.TODO()) - if !assert.NoError(t, err, `key.AsMap should succeed`) { - return - } + m1, err := key.AsMap(context.TODO()) + if !assert.NoError(t, err, `key.AsMap should succeed`) { + return + } - if !assert.Equal(t, m1, m2, `keys should match`) { - return + m2, err := newkey.AsMap(context.TODO()) + if !assert.NoError(t, err, `key.AsMap should succeed`) { + return + } + + // PEM does not preserve these keys + if usePEM { + delete(m1, `private`) + delete(m1, jwk.AlgorithmKey) + delete(m1, jwk.KeyIDKey) + delete(m1, jwk.KeyOpsKey) + delete(m1, jwk.KeyUsageKey) + delete(m1, jwk.X509CertChainKey) + delete(m1, jwk.X509CertThumbprintKey) + delete(m1, jwk.X509CertThumbprintS256Key) + delete(m1, jwk.X509URLKey) + } + + if !assert.Equal(t, m1, m2, `keys should match`) { + return + } + }) } }) t.Run("Raw", func(t *testing.T) { @@ -2070,3 +2107,26 @@ func TestGH730(t *testing.T) { require.NoError(t, set.AddKey(key), `first AddKey should succeed`) require.Error(t, set.AddKey(key), `second AddKey should fail`) } + +// This test was lifted from #875. See tests under Roundtrip/WithPEM(true) for other key types +func TestECDSAPEM(t *testing.T) { + // go make an EC key at https://mkjwk.org/ + key, err := jwk.ParseKey([]byte(`{ + "kty": "EC", + "d": "zqYPTs5gMEwtidOqjlFJSk6L4BQSfhCJX6FTgbuuiE0", + "crv": "P-256", + "x": "AYwhwiE1hXWdfwu-HlBSsY5Chxycu-LyE6WsZ_w2DO4", + "y": "zumemGclMFkimMsKMXlLdKYWtLle58e4N9hDPcN7lig" + }`)) + if err != nil { + t.Fatal(err) + } + pem, err := jwk.EncodePEM(key) + if err != nil { + t.Fatal(err) + } + _, err = jwk.ParseKey(pem, jwk.WithPEM(true)) + if err != nil { + t.Fatal(err) + } +} diff --git a/jwk/okp_gen.go b/jwk/okp_gen.go index ccad6775b..832dc912d 100644 --- a/jwk/okp_gen.go +++ b/jwk/okp_gen.go @@ -1,4 +1,4 @@ -// This file is auto-generated by jwk/internal/cmd/genheader/main.go. DO NOT EDIT +// Code generated by tools/cmd/genjwk/main.go. DO NOT EDIT. package jwk diff --git a/jwk/options_gen.go b/jwk/options_gen.go index 17e23a705..644b24711 100644 --- a/jwk/options_gen.go +++ b/jwk/options_gen.go @@ -1,4 +1,4 @@ -// This file is auto-generated by internal/cmd/genoptions/main.go. DO NOT EDIT +// Code generated by tools/cmd/genoptions/main.go. DO NOT EDIT. package jwk diff --git a/jwk/options_gen_test.go b/jwk/options_gen_test.go index 3ec91b756..2c7df3685 100644 --- a/jwk/options_gen_test.go +++ b/jwk/options_gen_test.go @@ -1,4 +1,4 @@ -// This file is auto-generated by internal/cmd/genoptions/main.go. DO NOT EDIT +// Code generated by tools/cmd/genoptions/main.go. DO NOT EDIT. package jwk diff --git a/jwk/rsa_gen.go b/jwk/rsa_gen.go index ce4e400ff..659624297 100644 --- a/jwk/rsa_gen.go +++ b/jwk/rsa_gen.go @@ -1,4 +1,4 @@ -// This file is auto-generated by jwk/internal/cmd/genheader/main.go. DO NOT EDIT +// Code generated by tools/cmd/genjwk/main.go. DO NOT EDIT. package jwk diff --git a/jwk/symmetric_gen.go b/jwk/symmetric_gen.go index 6a965193c..fc96c78d7 100644 --- a/jwk/symmetric_gen.go +++ b/jwk/symmetric_gen.go @@ -1,4 +1,4 @@ -// This file is auto-generated by jwk/internal/cmd/genheader/main.go. DO NOT EDIT +// Code generated by tools/cmd/genjwk/main.go. DO NOT EDIT. package jwk diff --git a/jws/BUILD.bazel b/jws/BUILD.bazel new file mode 100644 index 000000000..859c183b3 --- /dev/null +++ b/jws/BUILD.bazel @@ -0,0 +1,69 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "jws", + srcs = [ + "ecdsa.go", + "eddsa.go", + "headers.go", + "headers_gen.go", + "hmac.go", + "interface.go", + "io.go", + "jws.go", + "key_provider.go", + "message.go", + "options.go", + "options_gen.go", + "rsa.go", + "signer.go", + "verifier.go", + ], + importpath = "github.com/lestrrat-go/jwx/v2/jws", + visibility = ["//visibility:public"], + deps = [ + "//cert", + "//internal/base64", + "//internal/iter", + "//internal/json", + "//internal/keyconv", + "//internal/pool", + "//jwa", + "//jwk", + "//x25519", + "@com_github_lestrrat_go_blackmagic//:go_default_library", + "@com_github_lestrrat_go_iter//mapiter:go_default_library", + "@com_github_lestrrat_go_option//:option", + ], +) + +go_test( + name = "jws_test", + srcs = [ + "headers_test.go", + "jws_test.go", + "message_test.go", + "options_gen_test.go", + "signer_test.go", + ], + embed = [":jws"], + deps = [ + "//cert", + "//internal/base64", + "//internal/json", + "//internal/jwxtest", + "//jwa", + "//jwk", + "//jwt", + "//x25519", + "@com_github_lestrrat_go_httprc//:go_default_library", + "@com_github_stretchr_testify//assert", + "@com_github_stretchr_testify//require", + ], +) + +alias( + name = "go_default_library", + actual = ":jws", + visibility = ["//visibility:public"], +) diff --git a/jws/headers_gen.go b/jws/headers_gen.go index fd892e2c4..8855d0675 100644 --- a/jws/headers_gen.go +++ b/jws/headers_gen.go @@ -1,4 +1,4 @@ -// This file is auto-generated by jws/internal/cmd/genheaders/main.go. DO NOT EDIT +// Code generated by tools/cmd/genjws/main.go. DO NOT EDIT. package jws diff --git a/jws/io.go b/jws/io.go index 7bfd07f99..0d9dbd6cc 100644 --- a/jws/io.go +++ b/jws/io.go @@ -1,4 +1,4 @@ -// Automatically generated by internal/cmd/genreadfile/main.go. DO NOT EDIT +// Code generated by tools/cmd/genreadfile/main.go. DO NOT EDIT. package jws @@ -14,15 +14,6 @@ func (sysFS) Open(path string) (fs.File, error) { } func ReadFile(path string, options ...ReadFileOption) (*Message, error) { - var parseOptions []ParseOption - var readFileOptions []ReadFileOption - for _, option := range options { - if po, ok := option.(ParseOption); ok { - parseOptions = append(parseOptions, po) - } else { - readFileOptions = append(readFileOptions, option) - } - } var srcFS fs.FS = sysFS{} for _, option := range options { diff --git a/jws/jws.go b/jws/jws.go index 6778b3867..09100ec17 100644 --- a/jws/jws.go +++ b/jws/jws.go @@ -125,11 +125,20 @@ var _ = fmtMax // Read the documentation for `jws.WithKey()` to learn more about the // possible values that can be used for `alg` and `key`. // +// You may create JWS messages with the "none" (jwa.NoSignature) algorithm +// if you use the `jws.WithInsecureNoSignature()` option. This option +// can be combined with one or more signature keys, as well as the +// `jws.WithJSON()` option to generate multiple signatures (though +// the usefulness of such constructs is highly debatable) +// +// Note that this library does not allow you to successfully call `jws.Verify()` on +// signatures with the "none" algorithm. To parse these, use `jws.Parse()` instead. +// // If you want to use a detached payload, use `jws.WithDetachedPayload()` as // one of the options. When you use this option, you must always set the // first parameter (`payload`) to `nil`, or the function will return an error // -// You may also wantt to look at how to pass protected headers to the +// You may also want to look at how to pass protected headers to the // signing process, as you will likely be required to set the `b64` field // when using detached payload. // @@ -139,11 +148,19 @@ func Sign(payload []byte, options ...SignOption) ([]byte, error) { format := fmtCompact var signers []*payloadSigner var detached bool + var noneSignature *payloadSigner for _, option := range options { //nolint:forcetypeassert switch option.Ident() { case identSerialization{}: format = option.Value().(int) + case identInsecureNoSignature{}: + data := option.Value().(*withInsecureNoSignature) + // only the last one is used (we overwrite previous values) + noneSignature = &payloadSigner{ + signer: noneSigner{}, + protected: data.protected, + } case identKey{}: data := option.Value().(*withKey) @@ -151,6 +168,12 @@ func Sign(payload []byte, options ...SignOption) ([]byte, error) { if !ok { return nil, fmt.Errorf(`jws.Sign: expected algorithm to be of type jwa.SignatureAlgorithm but got (%[1]q, %[1]T)`, data.alg) } + + // No, we don't accept "none" here. + if alg == jwa.NoSignature { + return nil, fmt.Errorf(`jws.Sign: "none" (jwa.NoSignature) cannot be used with jws.WithKey`) + } + signer, err := makeSigner(alg, data.key, data.public, data.protected) if err != nil { return nil, fmt.Errorf(`jws.Sign: failed to create signer: %w`, err) @@ -165,6 +188,10 @@ func Sign(payload []byte, options ...SignOption) ([]byte, error) { } } + if noneSignature != nil { + signers = append(signers, noneSignature) + } + lsigner := len(signers) if lsigner == 0 { return nil, fmt.Errorf(`jws.Sign: no signers available. Specify an alogirthm and akey using jws.WithKey()`) @@ -251,6 +278,13 @@ var allowNoneWhitelist = jwk.WhitelistFunc(func(string) bool { // `Verifier` in `verify` subpackage, and call `Verify` method on it. // If you need to access signatures and JOSE headers in a JWS message, // use `Parse` function to get `Message` object. +// +// Because the use of "none" (jwa.NoSignature) algorithm is strongly discouraged, +// this function DOES NOT consider it a success when `{"alg":"none"}` is +// encountered in the message (it would also be counter intuitive when the code says +// you _verified_ something when in fact it did no such thing). If you want to +// accept messages with "none" signature algorithm, use `jws.Parse` to get the +// raw JWS message. func Verify(buf []byte, options ...VerifyOption) ([]byte, error) { var dst *Message var detachedPayload []byte diff --git a/jws/jws_test.go b/jws/jws_test.go index 414df7019..06e9eb3b4 100644 --- a/jws/jws_test.go +++ b/jws/jws_test.go @@ -1951,3 +1951,41 @@ func TestGH840(t *testing.T) { _, err = jwt.Parse(signed, jwt.WithKey(jwa.ES256, pubkey)) require.Error(t, err, `jwt.Parse should FAIL`) // pubkey's X/Y is not on the curve } + +func TestGH888(t *testing.T) { + // This should fail because we're passing multiple keys (i.e. multiple signatures) + // and yet we haven't specified JSON serialization + _, err := jws.Sign([]byte(`foo`), jws.WithInsecureNoSignature(), jws.WithKey(jwa.HS256, []byte(`bar`))) + require.Error(t, err, `jws.Sign with multiple keys (including alg=none) should fail`) + + // This should pass because we can now have multiple signaures with JSON serialization + signed, err := jws.Sign([]byte(`foo`), jws.WithInsecureNoSignature(), jws.WithKey(jwa.HS256, []byte(`bar`)), jws.WithJSON()) + require.NoError(t, err, `jws.Sign should succeed`) + + message, err := jws.Parse(signed) + require.NoError(t, err, `jws.Parse should succeed`) + + // Look for alg=none signature + var foundNoSignature bool + for _, sig := range message.Signatures() { + if sig.ProtectedHeaders().Algorithm() != jwa.NoSignature { + continue + } + + require.Nil(t, sig.Signature(), `signature must be nil for alg=none`) + foundNoSignature = true + } + require.True(t, foundNoSignature, `signature with no signature was found`) + + _, err = jws.Verify(signed) + require.Error(t, err, `jws.Verify should fail`) + + _, err = jws.Verify(signed, jws.WithKey(jwa.NoSignature, nil)) + require.Error(t, err, `jws.Verify should fail`) + + // Note: you can't do jws.Verify(..., jws.WithInsecureNoSignature()) + + verified, err := jws.Verify(signed, jws.WithKey(jwa.HS256, []byte(`bar`))) + require.NoError(t, err, `jws.Verify should succeed`) + require.Equal(t, []byte(`foo`), verified) +} diff --git a/jws/message.go b/jws/message.go index e02842236..adec8445c 100644 --- a/jws/message.go +++ b/jws/message.go @@ -85,11 +85,13 @@ func (s *Signature) UnmarshalJSON(data []byte) error { s.protected = prt } - decoded, err := base64.DecodeString(*sup.Signature) - if err != nil { - return fmt.Errorf(`failed to base decode signature: %w`, err) + if sup.Signature != nil { + decoded, err := base64.DecodeString(*sup.Signature) + if err != nil { + return fmt.Errorf(`failed to base decode signature: %w`, err) + } + s.signature = decoded } - s.signature = decoded return nil } @@ -427,12 +429,16 @@ func (m Message) marshalFull() ([]byte, error) { wrote = true } - if wrote { - buf.WriteRune(',') + if len(sig.signature) > 0 { + // If InsecureNoSignature is enabled, signature may not exist + if wrote { + buf.WriteRune(',') + } + buf.WriteString(`"signature":"`) + buf.WriteString(base64.EncodeToString(sig.signature)) + buf.WriteString(`"`) } - buf.WriteString(`"signature":"`) - buf.WriteString(base64.EncodeToString(sig.signature)) - buf.WriteString(`"}`) + buf.WriteString(`}`) } buf.WriteString(`]}`) diff --git a/jws/options.go b/jws/options.go index 7b38e92dd..9eb04e837 100644 --- a/jws/options.go +++ b/jws/options.go @@ -7,6 +7,7 @@ import ( ) type identHeaders struct{} +type identInsecureNoSignature struct{} // WithHeaders allows you to specify extra header values to include in the // final JWS message @@ -59,6 +60,10 @@ func (w *withKey) Protected(v Headers) Headers { // passed to the option. If you specify other algorithm types such as `jwa.ContentEncryptionAlgorithm`, // then you will get an error when `jws.Sign()` or `jws.Verify()` is executed. // +// The `alg` parameter cannot be "none" (jwa.NoSignature) for security reasons. +// You will have to use a separate, more explicit option to allow the use of "none" +// algorithm. +// // The algorithm specified in the `alg` parameter must be able to support // the type of key you provided, otherwise an error is returned. // @@ -157,3 +162,43 @@ func WithVerifyAuto(f jwk.Fetcher, options ...jwk.FetchOption) VerifyOption { options: options, }) } + +type withInsecureNoSignature struct { + protected Headers +} + +// This exist as escape hatches to modify the header values after the fact +func (w *withInsecureNoSignature) Protected(v Headers) Headers { + if w.protected == nil && v != nil { + w.protected = v + } + return w.protected +} + +// WithInsecureNoSignature creates an option that allows the user to use the +// "none" signature algorithm. +// +// Please note that this is insecure, and should never be used in production +// (this is exactly why specifying "none"/jwa.NoSignature to `jws.WithKey()` +// results in an error when `jws.Sign()` is called -- we do not allow using +// "none" by accident) +// +// TODO: create specific sub-option set for this option +func WithInsecureNoSignature(options ...WithKeySuboption) SignOption { + var protected Headers + for _, option := range options { + //nolint:forcetypeassert + switch option.Ident() { + case identProtectedHeaders{}: + protected = option.Value().(Headers) + } + } + + return &signOption{ + option.New(identInsecureNoSignature{}, + &withInsecureNoSignature{ + protected: protected, + }, + ), + } +} diff --git a/jws/options_gen.go b/jws/options_gen.go index fea18bf79..3a7df7e4e 100644 --- a/jws/options_gen.go +++ b/jws/options_gen.go @@ -1,4 +1,4 @@ -// This file is auto-generated by internal/cmd/genoptions/main.go. DO NOT EDIT +// Code generated by tools/cmd/genoptions/main.go. DO NOT EDIT. package jws diff --git a/jws/options_gen_test.go b/jws/options_gen_test.go index fd0164a48..f3ba4b32f 100644 --- a/jws/options_gen_test.go +++ b/jws/options_gen_test.go @@ -1,4 +1,4 @@ -// This file is auto-generated by internal/cmd/genoptions/main.go. DO NOT EDIT +// Code generated by tools/cmd/genoptions/main.go. DO NOT EDIT. package jws diff --git a/jws/signer.go b/jws/signer.go index 46e73eb17..279386c5f 100644 --- a/jws/signer.go +++ b/jws/signer.go @@ -67,3 +67,13 @@ func NewSigner(alg jwa.SignatureAlgorithm) (Signer, error) { } return nil, fmt.Errorf(`unsupported signature algorithm "%s"`, alg) } + +type noneSigner struct{} + +func (noneSigner) Algorithm() jwa.SignatureAlgorithm { + return jwa.NoSignature +} + +func (noneSigner) Sign([]byte, interface{}) ([]byte, error) { + return nil, nil +} diff --git a/jwt/BUILD.bazel b/jwt/BUILD.bazel new file mode 100644 index 000000000..3cd62c2dd --- /dev/null +++ b/jwt/BUILD.bazel @@ -0,0 +1,65 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "jwt", + srcs = [ + "builder_gen.go", + "http.go", + "interface.go", + "io.go", + "jwt.go", + "options.go", + "options_gen.go", + "serialize.go", + "token_gen.go", + "token_options.go", + "token_options_gen.go", + "validate.go", + ], + importpath = "github.com/lestrrat-go/jwx/v2/jwt", + visibility = ["//visibility:public"], + deps = [ + "//:jwx", + "//internal/base64", + "//internal/iter", + "//internal/json", + "//internal/pool", + "//jwa", + "//jwe", + "//jwk", + "//jws", + "//jwt/internal/types", + "@com_github_lestrrat_go_iter//mapiter:go_default_library", + "@com_github_lestrrat_go_option//:option", + ], +) + +go_test( + name = "jwt_test", + srcs = [ + "jwt_test.go", + "options_gen_test.go", + "token_options_test.go", + "token_test.go", + "validate_test.go", + ], + embed = [":jwt"], + deps = [ + "//internal/ecutil", + "//internal/json", + "//internal/jwxtest", + "//jwa", + "//jwe", + "//jwk", + "//jws", + "//jwt/internal/types", + "@com_github_stretchr_testify//assert", + "@com_github_stretchr_testify//require", + ], +) + +alias( + name = "go_default_library", + actual = ":jwt", + visibility = ["//visibility:public"], +) diff --git a/jwt/builder_gen.go b/jwt/builder_gen.go index a588bc690..0968a5f4b 100644 --- a/jwt/builder_gen.go +++ b/jwt/builder_gen.go @@ -1,4 +1,4 @@ -// This file is auto-generated by jwt/internal/cmd/gentoken/main.go. DO NOT EDIT +// Code generated by tools/cmd/genjwt/main.go. DO NOT EDIT. package jwt diff --git a/jwt/internal/types/BUILD.bazel b/jwt/internal/types/BUILD.bazel new file mode 100644 index 000000000..84abab7f8 --- /dev/null +++ b/jwt/internal/types/BUILD.bazel @@ -0,0 +1,32 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "types", + srcs = [ + "date.go", + "string.go", + ], + importpath = "github.com/lestrrat-go/jwx/v2/jwt/internal/types", + visibility = ["//jwt:__subpackages__"], + deps = ["//internal/json"], +) + +go_test( + name = "types_test", + srcs = [ + "date_test.go", + "string_test.go", + ], + deps = [ + ":types", + "//internal/json", + "//jwt", + "@com_github_stretchr_testify//assert", + ], +) + +alias( + name = "go_default_library", + actual = ":types", + visibility = ["//jwt:__subpackages__"], +) diff --git a/jwt/io.go b/jwt/io.go index ad5db4b87..96a30bba3 100644 --- a/jwt/io.go +++ b/jwt/io.go @@ -1,4 +1,4 @@ -// Automatically generated by internal/cmd/genreadfile/main.go. DO NOT EDIT +// Code generated by tools/cmd/genreadfile/main.go. DO NOT EDIT. package jwt @@ -15,12 +15,9 @@ func (sysFS) Open(path string) (fs.File, error) { func ReadFile(path string, options ...ReadFileOption) (Token, error) { var parseOptions []ParseOption - var readFileOptions []ReadFileOption for _, option := range options { if po, ok := option.(ParseOption); ok { parseOptions = append(parseOptions, po) - } else { - readFileOptions = append(readFileOptions, option) } } diff --git a/jwt/jwt_test.go b/jwt/jwt_test.go index 616f4c646..15bc136a3 100644 --- a/jwt/jwt_test.go +++ b/jwt/jwt_test.go @@ -1667,3 +1667,29 @@ func TestGH850(t *testing.T) { _, err := jwt.Parse([]byte(testToken), jwt.WithVerify(false)) require.True(t, errors.Is(err, jwt.ErrInvalidJWT())) } + +func TestGH888(t *testing.T) { + // Use of "none" is insecure, and we just don't allow it by default. + // In order to allow none, we must tell jwx that we actually want it. + token, err := jwt.NewBuilder(). + Subject("foo"). + Issuer("bar"). + Build() + + require.NoError(t, err, `jwt.Builder should succeed`) + + // 1) "none" must be triggered by its own option. Can't use jwt.WithKey(jwa.NoSignature, ...) + t.Run("jwt.Sign(token, jwt.WithKey(jwa.NoSignature)) should fail", func(t *testing.T) { + _, err := jwt.Sign(token, jwt.WithKey(jwa.NoSignature, nil)) + require.Error(t, err, `jwt.Sign with jwt.WithKey should fail`) + }) + t.Run("jwt.Sign(token, jwt.WithInsecureNoSignature())", func(t *testing.T) { + signed, err := jwt.Sign(token, jwt.WithInsecureNoSignature()) + require.NoError(t, err, `jwt.Sign should succeed`) + + require.Equal(t, `eyJhbGciOiJub25lIiwidHlwIjoiSldUIn0.eyJpc3MiOiJiYXIiLCJzdWIiOiJmb28ifQ.`, string(signed)) + + _, err = jwt.Parse(signed) + require.Error(t, err, `jwt.Parse with alg=none should fail`) + }) +} diff --git a/jwt/openid/BUILD.bazel b/jwt/openid/BUILD.bazel new file mode 100644 index 000000000..050005cc2 --- /dev/null +++ b/jwt/openid/BUILD.bazel @@ -0,0 +1,45 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "openid", + srcs = [ + "address.go", + "birthdate.go", + "builder_gen.go", + "interface.go", + "openid.go", + "token_gen.go", + ], + importpath = "github.com/lestrrat-go/jwx/v2/jwt/openid", + visibility = ["//visibility:public"], + deps = [ + "//internal/base64", + "//internal/iter", + "//internal/json", + "//internal/pool", + "//jwt", + "//jwt/internal/types", + "@com_github_lestrrat_go_iter//mapiter:go_default_library", + ], +) + +go_test( + name = "openid_test", + srcs = ["openid_test.go"], + deps = [ + ":openid", + "//internal/json", + "//internal/jwxtest", + "//jwa", + "//jwt", + "//jwt/internal/types", + "@com_github_stretchr_testify//assert", + "@com_github_stretchr_testify//require", + ], +) + +alias( + name = "go_default_library", + actual = ":openid", + visibility = ["//visibility:public"], +) diff --git a/jwt/openid/builder_gen.go b/jwt/openid/builder_gen.go index 4dc1cd356..ea8604518 100644 --- a/jwt/openid/builder_gen.go +++ b/jwt/openid/builder_gen.go @@ -1,4 +1,4 @@ -// This file is auto-generated by jwt/internal/cmd/gentoken/main.go. DO NOT EDIT +// Code generated by tools/cmd/genjwt/main.go. DO NOT EDIT. package openid diff --git a/jwt/openid/token_gen.go b/jwt/openid/token_gen.go index 6c0fe6d3d..61e950ae3 100644 --- a/jwt/openid/token_gen.go +++ b/jwt/openid/token_gen.go @@ -1,4 +1,4 @@ -// This file is auto-generated by jwt/internal/cmd/gentoken/main.go. DO NOT EDIT +// Code generated by tools/cmd/genjwt/main.go. DO NOT EDIT. package openid diff --git a/jwt/options.go b/jwt/options.go index fe61faeec..b7f78fc84 100644 --- a/jwt/options.go +++ b/jwt/options.go @@ -11,6 +11,7 @@ import ( "github.com/lestrrat-go/option" ) +type identInsecureNoSignature struct{} type identKey struct{} type identKeySet struct{} type identTypedClaim struct{} @@ -21,6 +22,8 @@ func toSignOptions(options ...Option) ([]jws.SignOption, error) { for _, option := range options { //nolint:forcetypeassert switch option.Ident() { + case identInsecureNoSignature{}: + soptions = append(soptions, jws.WithInsecureNoSignature()) case identKey{}: wk := option.Value().(*withKey) // this always succeeds var wksoptions []jws.WithKeySuboption @@ -294,3 +297,7 @@ func WithMinDelta(dur time.Duration, c1, c2 string) ValidateOption { func WithVerifyAuto(f jwk.Fetcher, options ...jwk.FetchOption) ParseOption { return &parseOption{option.New(identVerifyAuto{}, jws.WithVerifyAuto(f, options...))} } + +func WithInsecureNoSignature() SignOption { + return &signEncryptParseOption{option.New(identInsecureNoSignature{}, nil)} +} diff --git a/jwt/options.yaml b/jwt/options.yaml index 18179b262..2a11b9b4c 100644 --- a/jwt/options.yaml +++ b/jwt/options.yaml @@ -26,7 +26,7 @@ interfaces: - readFileOption - signOption comment: | - SignParseOption describes an Option that can be passed to both `jwt.Sign()` or + SignEncryptParseOption describes an Option that can be passed to both `jwt.Sign()` or `jwt.Parse()` - name: ValidateOption methods: diff --git a/jwt/options_gen.go b/jwt/options_gen.go index fb947eccf..ebde2d611 100644 --- a/jwt/options_gen.go +++ b/jwt/options_gen.go @@ -1,4 +1,4 @@ -// This file is auto-generated by internal/cmd/genoptions/main.go. DO NOT EDIT +// Code generated by tools/cmd/genoptions/main.go. DO NOT EDIT. package jwt @@ -67,7 +67,7 @@ type readFileOption struct { func (*readFileOption) readFileOption() {} -// SignParseOption describes an Option that can be passed to both `jwt.Sign()` or +// SignEncryptParseOption describes an Option that can be passed to both `jwt.Sign()` or // `jwt.Parse()` type SignEncryptParseOption interface { Option diff --git a/jwt/options_gen_test.go b/jwt/options_gen_test.go index 90fcd3cc1..bf7b55ed9 100644 --- a/jwt/options_gen_test.go +++ b/jwt/options_gen_test.go @@ -1,4 +1,4 @@ -// This file is auto-generated by internal/cmd/genoptions/main.go. DO NOT EDIT +// Code generated by tools/cmd/genoptions/main.go. DO NOT EDIT. package jwt diff --git a/jwt/token_gen.go b/jwt/token_gen.go index ea55b8375..8b2695723 100644 --- a/jwt/token_gen.go +++ b/jwt/token_gen.go @@ -1,4 +1,4 @@ -// This file is auto-generated by jwt/internal/cmd/gentoken/main.go. DO NOT EDIT +// Code generated by tools/cmd/genjwt/main.go. DO NOT EDIT. package jwt diff --git a/jwx_test.go b/jwx_test.go index 06c746c99..b74243404 100644 --- a/jwx_test.go +++ b/jwx_test.go @@ -17,6 +17,7 @@ import ( "github.com/lestrrat-go/jwx/v2/jwe" "github.com/lestrrat-go/jwx/v2/jwk" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" ) func TestShowBuildInfo(t *testing.T) { @@ -173,43 +174,57 @@ func TestJoseCompatibility(t *testing.T) { } }) t.Run("jwe", func(t *testing.T) { + // For some reason "jose" does not come with RSA-OAEP on some platforms. + // In order to avoid doing this in an ad-hoc way, we're just going to + // ask our jose package for the algorithms that it supports, and generate + // the list dynamically + t.Parallel() - tests := []interopTest{ - {jwa.RSA1_5, jwa.A128GCM}, - {jwa.RSA1_5, jwa.A128CBC_HS256}, - {jwa.RSA1_5, jwa.A256CBC_HS512}, - {jwa.RSA_OAEP, jwa.A128GCM}, - {jwa.RSA_OAEP, jwa.A128CBC_HS256}, - {jwa.RSA_OAEP, jwa.A256CBC_HS512}, - {jwa.RSA_OAEP_256, jwa.A128GCM}, - {jwa.RSA_OAEP_256, jwa.A128CBC_HS256}, - {jwa.RSA_OAEP_256, jwa.A256CBC_HS512}, - {jwa.ECDH_ES, jwa.A128GCM}, - {jwa.ECDH_ES, jwa.A256GCM}, - {jwa.ECDH_ES, jwa.A128CBC_HS256}, - {jwa.ECDH_ES, jwa.A256CBC_HS512}, - {jwa.ECDH_ES_A128KW, jwa.A128GCM}, - {jwa.ECDH_ES_A128KW, jwa.A128CBC_HS256}, - {jwa.ECDH_ES_A256KW, jwa.A256GCM}, - {jwa.ECDH_ES_A256KW, jwa.A256CBC_HS512}, - {jwa.A128KW, jwa.A128GCM}, - {jwa.A128KW, jwa.A128CBC_HS256}, - {jwa.A256KW, jwa.A256GCM}, - {jwa.A256KW, jwa.A256CBC_HS512}, - {jwa.A128GCMKW, jwa.A128GCM}, - {jwa.A128GCMKW, jwa.A128CBC_HS256}, - {jwa.A256GCMKW, jwa.A256GCM}, - {jwa.A256GCMKW, jwa.A256CBC_HS512}, - {jwa.PBES2_HS256_A128KW, jwa.A128GCM}, - {jwa.PBES2_HS256_A128KW, jwa.A128CBC_HS256}, - {jwa.PBES2_HS384_A192KW, jwa.A192GCM}, - {jwa.PBES2_HS384_A192KW, jwa.A192CBC_HS384}, - {jwa.PBES2_HS512_A256KW, jwa.A256GCM}, - {jwa.PBES2_HS512_A256KW, jwa.A256CBC_HS512}, - {jwa.DIRECT, jwa.A128GCM}, - {jwa.DIRECT, jwa.A128CBC_HS256}, - {jwa.DIRECT, jwa.A256GCM}, - {jwa.DIRECT, jwa.A256CBC_HS512}, + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + set, err := jose.Algorithms(ctx, t) + require.NoError(t, err) + + var tests []interopTest + + for _, keyenc := range []jwa.KeyEncryptionAlgorithm{jwa.RSA1_5, jwa.RSA_OAEP, jwa.RSA_OAEP_256} { + if !set.Has(keyenc.String()) { + t.Logf("jose does not support key encryption algorithm %q: skipping", keyenc) + continue + } + for _, contentenc := range []jwa.ContentEncryptionAlgorithm{jwa.A128GCM, jwa.A128CBC_HS256, jwa.A256CBC_HS512} { + tests = append(tests, interopTest{keyenc, contentenc}) + } + } + + for _, keyenc := range []jwa.KeyEncryptionAlgorithm{jwa.ECDH_ES, jwa.ECDH_ES_A128KW, jwa.A128KW, jwa.A128GCMKW, jwa.A256KW, jwa.A256GCMKW, jwa.PBES2_HS256_A128KW, jwa.DIRECT} { + if !set.Has(keyenc.String()) { + t.Logf("jose does not support key encryption algorithm %q: skipping", keyenc) + continue + } + for _, contentenc := range []jwa.ContentEncryptionAlgorithm{jwa.A128GCM, jwa.A128CBC_HS256} { + tests = append(tests, interopTest{keyenc, contentenc}) + } + } + + for _, keyenc := range []jwa.KeyEncryptionAlgorithm{jwa.ECDH_ES, jwa.ECDH_ES_A256KW, jwa.A256KW, jwa.A256GCMKW, jwa.PBES2_HS512_A256KW, jwa.DIRECT} { + if !set.Has(keyenc.String()) { + t.Logf("jose does not support key encryption algorithm %q: skipping", keyenc) + continue + } + for _, contentenc := range []jwa.ContentEncryptionAlgorithm{jwa.A256GCM, jwa.A256CBC_HS512} { + tests = append(tests, interopTest{keyenc, contentenc}) + } + } + + for _, keyenc := range []jwa.KeyEncryptionAlgorithm{jwa.PBES2_HS384_A192KW} { + if !set.Has(keyenc.String()) { + t.Logf("jose does not support key encryption algorithm %q: skipping", keyenc) + continue + } + for _, contentenc := range []jwa.ContentEncryptionAlgorithm{jwa.A192GCM, jwa.A192CBC_HS384} { + tests = append(tests, interopTest{keyenc, contentenc}) + } } for _, test := range tests { @@ -426,7 +441,7 @@ func TestGuessFormat(t *testing.T) { }{ { Name: "Raw String", - Expected: jwx.UnknownFormat, + Expected: jwx.InvalidFormat, Source: []byte(`Hello, World`), }, { @@ -436,7 +451,7 @@ func TestGuessFormat(t *testing.T) { }, { Name: "Random JSON Array", - Expected: jwx.UnknownFormat, + Expected: jwx.InvalidFormat, Source: []byte(`["random", "JSON"]`), }, { diff --git a/tools/cmd/genjwa/go.mod b/tools/cmd/genjwa/go.mod index ac27eb592..a01de2d90 100644 --- a/tools/cmd/genjwa/go.mod +++ b/tools/cmd/genjwa/go.mod @@ -3,6 +3,10 @@ module github.com/lestrrat-go/jwx/v2/tools/cmd/genalgs go 1.16 require ( - github.com/lestrrat-go/codegen v1.0.4-0.20220329032654-7b542c9fb49b - github.com/stretchr/testify v1.7.1 // indirect + github.com/lestrrat-go/codegen v1.0.4 + github.com/lestrrat-go/option v1.0.1 // indirect + github.com/lestrrat-go/xstrings v0.0.0-20220901080742-cacb16b8ddb7 // indirect + github.com/stretchr/testify v1.8.2 // indirect + golang.org/x/sys v0.6.0 // indirect + golang.org/x/tools v0.6.0 // indirect ) diff --git a/tools/cmd/genjwa/go.sum b/tools/cmd/genjwa/go.sum index 2736f29db..65255c636 100644 --- a/tools/cmd/genjwa/go.sum +++ b/tools/cmd/genjwa/go.sum @@ -1,40 +1,73 @@ -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/lestrrat-go/codegen v1.0.4-0.20220329032654-7b542c9fb49b h1:PQ+SVFMytiSbfozcIQbp4Kb7/xe6NPiHdFNVQxnynlk= -github.com/lestrrat-go/codegen v1.0.4-0.20220329032654-7b542c9fb49b/go.mod h1:B5zvyPBGsMtVrUaM9q0doiP+oyw05CI/dpFU9T1TUFo= -github.com/lestrrat-go/option v1.0.0 h1:WqAWL8kh8VcSoD6xjSH34/1m8yxluXQbDeKNfvFeEO4= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/lestrrat-go/codegen v1.0.4 h1:xWRqMkHzfpN/nfl4EeAwmbTvS7uotxfUPl8RhpjB3Go= +github.com/lestrrat-go/codegen v1.0.4/go.mod h1:JQPYOh/5hA2lipdHWj3YZHoKEGUfLmGQoWcWs4I92qk= github.com/lestrrat-go/option v1.0.0/go.mod h1:5ZHFbivi4xwXxhxY9XHDe2FHo6/Z7WWmtT7T5nBBp3I= -github.com/lestrrat-go/xstrings v0.0.0-20210804220435-4dd8b234342b h1:3laG8JWIeDGb7lf00nMRznLdCHy0aZPd/CGz7Okn1SY= +github.com/lestrrat-go/option v1.0.1 h1:oAzP2fvZGQKWkvHa1/SAcFolBEca1oN+mQ7eooNBEYU= +github.com/lestrrat-go/option v1.0.1/go.mod h1:5ZHFbivi4xwXxhxY9XHDe2FHo6/Z7WWmtT7T5nBBp3I= github.com/lestrrat-go/xstrings v0.0.0-20210804220435-4dd8b234342b/go.mod h1:mPFmD3Wuy0ddyPFvllLq4sUpGfE40T3VE8kWWS8fxGA= +github.com/lestrrat-go/xstrings v0.0.0-20220901080742-cacb16b8ddb7 h1:8YrnMMQZquDwIgfQvZZ+JGMrRIn9UdzremIkMGQ/RoU= +github.com/lestrrat-go/xstrings v0.0.0-20220901080742-cacb16b8ddb7/go.mod h1:mPFmD3Wuy0ddyPFvllLq4sUpGfE40T3VE8kWWS8fxGA= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.8.0 h1:LUYupSeNrTNCGzR/hVBk2NHZO4hXcVaW1k4Qx7rjPx8= +golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20200918232735-d647fc253266 h1:k7tVuG0g1JwmD3Jh8oAl1vQ1C3jb4Hi/dUl1wWDBJpQ= golang.org/x/tools v0.0.0-20200918232735-d647fc253266/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/tools/cmd/genjwa/main.go b/tools/cmd/genjwa/main.go index 6f89ed9d0..fd123c3e8 100644 --- a/tools/cmd/genjwa/main.go +++ b/tools/cmd/genjwa/main.go @@ -375,7 +375,7 @@ func (t typ) Generate() error { o := codegen.NewOutput(&buf) - o.R("// this file was auto-generated by internal/cmd/gentypes/main.go: DO NOT EDIT") + o.R("// Code generated by tools/cmd/genjwa/main.go. DO NOT EDIT.") o.LL("package jwa") o.LL("import (") @@ -503,7 +503,7 @@ func (t typ) GenerateTest() error { } o := codegen.NewOutput(&buf) - o.R("// this file was auto-generated by internal/cmd/gentypes/main.go: DO NOT EDIT") + o.R("// Code generated by tools/cmd/genjwa/main.go. DO NOT EDIT") o.LL("package jwa_test") o.L("import (") diff --git a/tools/cmd/genjwe/go.mod b/tools/cmd/genjwe/go.mod index 7ee8345df..e26e4fa83 100644 --- a/tools/cmd/genjwe/go.mod +++ b/tools/cmd/genjwe/go.mod @@ -3,8 +3,12 @@ module github.com/lestrrat-go/jwx/v2/jwe/internal/cmd/genheader go 1.16 require ( - github.com/goccy/go-yaml v1.9.4 - github.com/lestrrat-go/codegen v1.0.4-0.20220422093832-3f381ea644e3 - github.com/stretchr/testify v1.7.1 // indirect - golang.org/x/sys v0.0.0-20220412211240-33da011f77ad // indirect + github.com/fatih/color v1.14.1 // indirect + github.com/goccy/go-yaml v1.9.8 + github.com/lestrrat-go/codegen v1.0.4 + github.com/lestrrat-go/option v1.0.1 // indirect + github.com/lestrrat-go/xstrings v0.0.0-20220901080742-cacb16b8ddb7 // indirect + github.com/stretchr/testify v1.8.2 // indirect + golang.org/x/crypto v0.7.0 // indirect + golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect ) diff --git a/tools/cmd/genjwe/go.sum b/tools/cmd/genjwe/go.sum index 026adac42..f0a1338a6 100644 --- a/tools/cmd/genjwe/go.sum +++ b/tools/cmd/genjwe/go.sum @@ -1,7 +1,9 @@ -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/fatih/color v1.10.0 h1:s36xzo75JdqLaaWoiEHk767eHiwo0598uUxyfiPkDsg= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= +github.com/fatih/color v1.14.1 h1:qfhVLaG5s+nCROl1zJsZRxFeYrHLqWroPOQ8BWiNb4w= +github.com/fatih/color v1.14.1/go.mod h1:2oHN61fhTpgcxD3TSWCgKDiH1+x4OiDVVGH8WlgGZGg= github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q= github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= @@ -9,58 +11,99 @@ github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD87 github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= github.com/go-playground/validator/v10 v10.4.1 h1:pH2c5ADXtd66mxoE0Zm9SUhxE20r7aM3F26W0hOn+GE= github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4= -github.com/goccy/go-yaml v1.9.4 h1:S0GCYjwHKVI6IHqio7QWNKNThUl6NLzFd/g8Z65Axw8= -github.com/goccy/go-yaml v1.9.4/go.mod h1:U/jl18uSupI5rdI2jmuCswEA2htH9eXfferR3KfscvA= +github.com/goccy/go-yaml v1.9.8 h1:5gMyLUeU1/6zl+WFfR1hN7D2kf+1/eRGa7DFtToiBvQ= +github.com/goccy/go-yaml v1.9.8/go.mod h1:JubOolP3gh0HpiBc4BLRD4YmjEjHAmIIB2aaXKkTfoE= github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y= github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= -github.com/lestrrat-go/codegen v1.0.4-0.20220422093832-3f381ea644e3 h1:ePhghrkFCIQH5Wnq5R5H5iw+RXdYkc53M/bcc7ylqpQ= -github.com/lestrrat-go/codegen v1.0.4-0.20220422093832-3f381ea644e3/go.mod h1:B5zvyPBGsMtVrUaM9q0doiP+oyw05CI/dpFU9T1TUFo= -github.com/lestrrat-go/option v1.0.0 h1:WqAWL8kh8VcSoD6xjSH34/1m8yxluXQbDeKNfvFeEO4= +github.com/lestrrat-go/codegen v1.0.4 h1:xWRqMkHzfpN/nfl4EeAwmbTvS7uotxfUPl8RhpjB3Go= +github.com/lestrrat-go/codegen v1.0.4/go.mod h1:JQPYOh/5hA2lipdHWj3YZHoKEGUfLmGQoWcWs4I92qk= github.com/lestrrat-go/option v1.0.0/go.mod h1:5ZHFbivi4xwXxhxY9XHDe2FHo6/Z7WWmtT7T5nBBp3I= -github.com/lestrrat-go/xstrings v0.0.0-20210804220435-4dd8b234342b h1:3laG8JWIeDGb7lf00nMRznLdCHy0aZPd/CGz7Okn1SY= +github.com/lestrrat-go/option v1.0.1 h1:oAzP2fvZGQKWkvHa1/SAcFolBEca1oN+mQ7eooNBEYU= +github.com/lestrrat-go/option v1.0.1/go.mod h1:5ZHFbivi4xwXxhxY9XHDe2FHo6/Z7WWmtT7T5nBBp3I= github.com/lestrrat-go/xstrings v0.0.0-20210804220435-4dd8b234342b/go.mod h1:mPFmD3Wuy0ddyPFvllLq4sUpGfE40T3VE8kWWS8fxGA= -github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8= +github.com/lestrrat-go/xstrings v0.0.0-20220901080742-cacb16b8ddb7 h1:8YrnMMQZquDwIgfQvZZ+JGMrRIn9UdzremIkMGQ/RoU= +github.com/lestrrat-go/xstrings v0.0.0-20220901080742-cacb16b8ddb7/go.mod h1:mPFmD3Wuy0ddyPFvllLq4sUpGfE40T3VE8kWWS8fxGA= github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng= +github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.7.0 h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A= +golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.8.0 h1:LUYupSeNrTNCGzR/hVBk2NHZO4hXcVaW1k4Qx7rjPx8= +golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20220412211240-33da011f77ad h1:ntjMns5wyP/fN65tdBD4g8J5w8n015+iIIs9rtjXkY0= -golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220406163625-3f8b81556e12/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= +golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20200918232735-d647fc253266 h1:k7tVuG0g1JwmD3Jh8oAl1vQ1C3jb4Hi/dUl1wWDBJpQ= golang.org/x/tools v0.0.0-20200918232735-d647fc253266/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3jS9O0/s90v0rJh3X/OLHEUk= +golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/tools/cmd/genjwe/main.go b/tools/cmd/genjwe/main.go index 054209ebf..aa120a126 100644 --- a/tools/cmd/genjwe/main.go +++ b/tools/cmd/genjwe/main.go @@ -78,7 +78,7 @@ func generateHeaders(obj *codegen.Object) error { var buf bytes.Buffer o := codegen.NewOutput(&buf) - o.L("// This file is auto-generated by jwe/internal/cmd/genheaders/main.go. DO NOT EDIT") + o.L("// Code generated by tools/cmd/genjwe/main.go. DO NOT EDIT.") o.LL("package jwe") o.LL("const (") diff --git a/tools/cmd/genjwk/go.mod b/tools/cmd/genjwk/go.mod index 510ec12b5..816d2ac66 100644 --- a/tools/cmd/genjwk/go.mod +++ b/tools/cmd/genjwk/go.mod @@ -3,8 +3,12 @@ module gitub.com/lestrrat-go/jwx/jwk/internal/cmd/genheader go 1.16 require ( - github.com/goccy/go-yaml v1.9.4 - github.com/lestrrat-go/codegen v1.0.4-0.20220422093832-3f381ea644e3 - github.com/stretchr/testify v1.7.1 // indirect - golang.org/x/sys v0.0.0-20220412211240-33da011f77ad // indirect + github.com/fatih/color v1.14.1 // indirect + github.com/goccy/go-yaml v1.9.8 + github.com/lestrrat-go/codegen v1.0.4 + github.com/lestrrat-go/option v1.0.1 // indirect + github.com/lestrrat-go/xstrings v0.0.0-20220901080742-cacb16b8ddb7 // indirect + github.com/stretchr/testify v1.8.2 // indirect + golang.org/x/crypto v0.7.0 // indirect + golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect ) diff --git a/tools/cmd/genjwk/go.sum b/tools/cmd/genjwk/go.sum index 026adac42..f0a1338a6 100644 --- a/tools/cmd/genjwk/go.sum +++ b/tools/cmd/genjwk/go.sum @@ -1,7 +1,9 @@ -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/fatih/color v1.10.0 h1:s36xzo75JdqLaaWoiEHk767eHiwo0598uUxyfiPkDsg= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= +github.com/fatih/color v1.14.1 h1:qfhVLaG5s+nCROl1zJsZRxFeYrHLqWroPOQ8BWiNb4w= +github.com/fatih/color v1.14.1/go.mod h1:2oHN61fhTpgcxD3TSWCgKDiH1+x4OiDVVGH8WlgGZGg= github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q= github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= @@ -9,58 +11,99 @@ github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD87 github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= github.com/go-playground/validator/v10 v10.4.1 h1:pH2c5ADXtd66mxoE0Zm9SUhxE20r7aM3F26W0hOn+GE= github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4= -github.com/goccy/go-yaml v1.9.4 h1:S0GCYjwHKVI6IHqio7QWNKNThUl6NLzFd/g8Z65Axw8= -github.com/goccy/go-yaml v1.9.4/go.mod h1:U/jl18uSupI5rdI2jmuCswEA2htH9eXfferR3KfscvA= +github.com/goccy/go-yaml v1.9.8 h1:5gMyLUeU1/6zl+WFfR1hN7D2kf+1/eRGa7DFtToiBvQ= +github.com/goccy/go-yaml v1.9.8/go.mod h1:JubOolP3gh0HpiBc4BLRD4YmjEjHAmIIB2aaXKkTfoE= github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y= github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= -github.com/lestrrat-go/codegen v1.0.4-0.20220422093832-3f381ea644e3 h1:ePhghrkFCIQH5Wnq5R5H5iw+RXdYkc53M/bcc7ylqpQ= -github.com/lestrrat-go/codegen v1.0.4-0.20220422093832-3f381ea644e3/go.mod h1:B5zvyPBGsMtVrUaM9q0doiP+oyw05CI/dpFU9T1TUFo= -github.com/lestrrat-go/option v1.0.0 h1:WqAWL8kh8VcSoD6xjSH34/1m8yxluXQbDeKNfvFeEO4= +github.com/lestrrat-go/codegen v1.0.4 h1:xWRqMkHzfpN/nfl4EeAwmbTvS7uotxfUPl8RhpjB3Go= +github.com/lestrrat-go/codegen v1.0.4/go.mod h1:JQPYOh/5hA2lipdHWj3YZHoKEGUfLmGQoWcWs4I92qk= github.com/lestrrat-go/option v1.0.0/go.mod h1:5ZHFbivi4xwXxhxY9XHDe2FHo6/Z7WWmtT7T5nBBp3I= -github.com/lestrrat-go/xstrings v0.0.0-20210804220435-4dd8b234342b h1:3laG8JWIeDGb7lf00nMRznLdCHy0aZPd/CGz7Okn1SY= +github.com/lestrrat-go/option v1.0.1 h1:oAzP2fvZGQKWkvHa1/SAcFolBEca1oN+mQ7eooNBEYU= +github.com/lestrrat-go/option v1.0.1/go.mod h1:5ZHFbivi4xwXxhxY9XHDe2FHo6/Z7WWmtT7T5nBBp3I= github.com/lestrrat-go/xstrings v0.0.0-20210804220435-4dd8b234342b/go.mod h1:mPFmD3Wuy0ddyPFvllLq4sUpGfE40T3VE8kWWS8fxGA= -github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8= +github.com/lestrrat-go/xstrings v0.0.0-20220901080742-cacb16b8ddb7 h1:8YrnMMQZquDwIgfQvZZ+JGMrRIn9UdzremIkMGQ/RoU= +github.com/lestrrat-go/xstrings v0.0.0-20220901080742-cacb16b8ddb7/go.mod h1:mPFmD3Wuy0ddyPFvllLq4sUpGfE40T3VE8kWWS8fxGA= github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng= +github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.7.0 h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A= +golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.8.0 h1:LUYupSeNrTNCGzR/hVBk2NHZO4hXcVaW1k4Qx7rjPx8= +golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20220412211240-33da011f77ad h1:ntjMns5wyP/fN65tdBD4g8J5w8n015+iIIs9rtjXkY0= -golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220406163625-3f8b81556e12/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= +golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20200918232735-d647fc253266 h1:k7tVuG0g1JwmD3Jh8oAl1vQ1C3jb4Hi/dUl1wWDBJpQ= golang.org/x/tools v0.0.0-20200918232735-d647fc253266/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3jS9O0/s90v0rJh3X/OLHEUk= +golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/tools/cmd/genjwk/main.go b/tools/cmd/genjwk/main.go index 16fbb9076..ab066f9c1 100644 --- a/tools/cmd/genjwk/main.go +++ b/tools/cmd/genjwk/main.go @@ -118,7 +118,7 @@ type Constant struct { func generateKeyType(kt *KeyType) error { var buf bytes.Buffer o := codegen.NewOutput(&buf) - o.L("// This file is auto-generated by jwk/internal/cmd/genheader/main.go. DO NOT EDIT") + o.L("// Code generated by tools/cmd/genjwk/main.go. DO NOT EDIT.") o.LL("package jwk") // Find unique field key names to create constants @@ -598,7 +598,7 @@ func generateGenericHeaders(fields codegen.FieldList) error { var buf bytes.Buffer o := codegen.NewOutput(&buf) - o.L("// This file is auto-generated. DO NOT EDIT") + o.L("// Code generated by tools/cmd/genjwk/main.go. DO NOT EDIT.") o.LL("package jwk") o.LL("import (") diff --git a/tools/cmd/genjws/go.mod b/tools/cmd/genjws/go.mod index 3464df01f..ca02a6c19 100644 --- a/tools/cmd/genjws/go.mod +++ b/tools/cmd/genjws/go.mod @@ -3,8 +3,12 @@ module github.com/lestrrat-go/jwx/v2/jws/internal/cmd/genheader go 1.16 require ( - github.com/goccy/go-yaml v1.9.4 - github.com/lestrrat-go/codegen v1.0.4-0.20220422093832-3f381ea644e3 - github.com/stretchr/testify v1.7.1 // indirect - golang.org/x/sys v0.0.0-20220412211240-33da011f77ad // indirect + github.com/fatih/color v1.14.1 // indirect + github.com/goccy/go-yaml v1.9.8 + github.com/lestrrat-go/codegen v1.0.4 + github.com/lestrrat-go/option v1.0.1 // indirect + github.com/lestrrat-go/xstrings v0.0.0-20220901080742-cacb16b8ddb7 // indirect + github.com/stretchr/testify v1.8.2 // indirect + golang.org/x/crypto v0.7.0 // indirect + golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect ) diff --git a/tools/cmd/genjws/go.sum b/tools/cmd/genjws/go.sum index 026adac42..f0a1338a6 100644 --- a/tools/cmd/genjws/go.sum +++ b/tools/cmd/genjws/go.sum @@ -1,7 +1,9 @@ -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/fatih/color v1.10.0 h1:s36xzo75JdqLaaWoiEHk767eHiwo0598uUxyfiPkDsg= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= +github.com/fatih/color v1.14.1 h1:qfhVLaG5s+nCROl1zJsZRxFeYrHLqWroPOQ8BWiNb4w= +github.com/fatih/color v1.14.1/go.mod h1:2oHN61fhTpgcxD3TSWCgKDiH1+x4OiDVVGH8WlgGZGg= github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q= github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= @@ -9,58 +11,99 @@ github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD87 github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= github.com/go-playground/validator/v10 v10.4.1 h1:pH2c5ADXtd66mxoE0Zm9SUhxE20r7aM3F26W0hOn+GE= github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4= -github.com/goccy/go-yaml v1.9.4 h1:S0GCYjwHKVI6IHqio7QWNKNThUl6NLzFd/g8Z65Axw8= -github.com/goccy/go-yaml v1.9.4/go.mod h1:U/jl18uSupI5rdI2jmuCswEA2htH9eXfferR3KfscvA= +github.com/goccy/go-yaml v1.9.8 h1:5gMyLUeU1/6zl+WFfR1hN7D2kf+1/eRGa7DFtToiBvQ= +github.com/goccy/go-yaml v1.9.8/go.mod h1:JubOolP3gh0HpiBc4BLRD4YmjEjHAmIIB2aaXKkTfoE= github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y= github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= -github.com/lestrrat-go/codegen v1.0.4-0.20220422093832-3f381ea644e3 h1:ePhghrkFCIQH5Wnq5R5H5iw+RXdYkc53M/bcc7ylqpQ= -github.com/lestrrat-go/codegen v1.0.4-0.20220422093832-3f381ea644e3/go.mod h1:B5zvyPBGsMtVrUaM9q0doiP+oyw05CI/dpFU9T1TUFo= -github.com/lestrrat-go/option v1.0.0 h1:WqAWL8kh8VcSoD6xjSH34/1m8yxluXQbDeKNfvFeEO4= +github.com/lestrrat-go/codegen v1.0.4 h1:xWRqMkHzfpN/nfl4EeAwmbTvS7uotxfUPl8RhpjB3Go= +github.com/lestrrat-go/codegen v1.0.4/go.mod h1:JQPYOh/5hA2lipdHWj3YZHoKEGUfLmGQoWcWs4I92qk= github.com/lestrrat-go/option v1.0.0/go.mod h1:5ZHFbivi4xwXxhxY9XHDe2FHo6/Z7WWmtT7T5nBBp3I= -github.com/lestrrat-go/xstrings v0.0.0-20210804220435-4dd8b234342b h1:3laG8JWIeDGb7lf00nMRznLdCHy0aZPd/CGz7Okn1SY= +github.com/lestrrat-go/option v1.0.1 h1:oAzP2fvZGQKWkvHa1/SAcFolBEca1oN+mQ7eooNBEYU= +github.com/lestrrat-go/option v1.0.1/go.mod h1:5ZHFbivi4xwXxhxY9XHDe2FHo6/Z7WWmtT7T5nBBp3I= github.com/lestrrat-go/xstrings v0.0.0-20210804220435-4dd8b234342b/go.mod h1:mPFmD3Wuy0ddyPFvllLq4sUpGfE40T3VE8kWWS8fxGA= -github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8= +github.com/lestrrat-go/xstrings v0.0.0-20220901080742-cacb16b8ddb7 h1:8YrnMMQZquDwIgfQvZZ+JGMrRIn9UdzremIkMGQ/RoU= +github.com/lestrrat-go/xstrings v0.0.0-20220901080742-cacb16b8ddb7/go.mod h1:mPFmD3Wuy0ddyPFvllLq4sUpGfE40T3VE8kWWS8fxGA= github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng= +github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.7.0 h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A= +golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.8.0 h1:LUYupSeNrTNCGzR/hVBk2NHZO4hXcVaW1k4Qx7rjPx8= +golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20220412211240-33da011f77ad h1:ntjMns5wyP/fN65tdBD4g8J5w8n015+iIIs9rtjXkY0= -golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220406163625-3f8b81556e12/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= +golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20200918232735-d647fc253266 h1:k7tVuG0g1JwmD3Jh8oAl1vQ1C3jb4Hi/dUl1wWDBJpQ= golang.org/x/tools v0.0.0-20200918232735-d647fc253266/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3jS9O0/s90v0rJh3X/OLHEUk= +golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/tools/cmd/genjws/main.go b/tools/cmd/genjws/main.go index bf6521138..66df83133 100644 --- a/tools/cmd/genjws/main.go +++ b/tools/cmd/genjws/main.go @@ -77,7 +77,7 @@ func generateHeaders(obj *codegen.Object) error { var buf bytes.Buffer o := codegen.NewOutput(&buf) - o.L("// This file is auto-generated by jws/internal/cmd/genheaders/main.go. DO NOT EDIT") + o.L("// Code generated by tools/cmd/genjws/main.go. DO NOT EDIT.") o.LL("package jws") o.LL("const (") diff --git a/tools/cmd/genjwt/go.mod b/tools/cmd/genjwt/go.mod index a509e63fb..9306cf8df 100644 --- a/tools/cmd/genjwt/go.mod +++ b/tools/cmd/genjwt/go.mod @@ -3,9 +3,13 @@ module github.com/lestrrat-go/jwx/v2/jwt/internal/cmd/gentoken go 1.16 require ( - github.com/goccy/go-json v0.9.6 - github.com/goccy/go-yaml v1.9.4 - github.com/lestrrat-go/codegen v1.0.4-0.20220422093832-3f381ea644e3 - github.com/stretchr/testify v1.7.1 // indirect - golang.org/x/sys v0.0.0-20220412211240-33da011f77ad // indirect + github.com/fatih/color v1.14.1 // indirect + github.com/goccy/go-json v0.10.0 + github.com/goccy/go-yaml v1.9.8 + github.com/lestrrat-go/codegen v1.0.4 + github.com/lestrrat-go/option v1.0.1 // indirect + github.com/lestrrat-go/xstrings v0.0.0-20220901080742-cacb16b8ddb7 // indirect + github.com/stretchr/testify v1.8.2 // indirect + golang.org/x/crypto v0.7.0 // indirect + golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect ) diff --git a/tools/cmd/genjwt/go.sum b/tools/cmd/genjwt/go.sum index 2661b17eb..76868e319 100644 --- a/tools/cmd/genjwt/go.sum +++ b/tools/cmd/genjwt/go.sum @@ -1,7 +1,9 @@ -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/fatih/color v1.10.0 h1:s36xzo75JdqLaaWoiEHk767eHiwo0598uUxyfiPkDsg= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= +github.com/fatih/color v1.14.1 h1:qfhVLaG5s+nCROl1zJsZRxFeYrHLqWroPOQ8BWiNb4w= +github.com/fatih/color v1.14.1/go.mod h1:2oHN61fhTpgcxD3TSWCgKDiH1+x4OiDVVGH8WlgGZGg= github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q= github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= @@ -9,60 +11,101 @@ github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD87 github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= github.com/go-playground/validator/v10 v10.4.1 h1:pH2c5ADXtd66mxoE0Zm9SUhxE20r7aM3F26W0hOn+GE= github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4= -github.com/goccy/go-json v0.9.6 h1:5/4CtRQdtsX0sal8fdVhTaiMN01Ri8BExZZ8iRmHQ6E= -github.com/goccy/go-json v0.9.6/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= -github.com/goccy/go-yaml v1.9.4 h1:S0GCYjwHKVI6IHqio7QWNKNThUl6NLzFd/g8Z65Axw8= -github.com/goccy/go-yaml v1.9.4/go.mod h1:U/jl18uSupI5rdI2jmuCswEA2htH9eXfferR3KfscvA= +github.com/goccy/go-json v0.10.0 h1:mXKd9Qw4NuzShiRlOXKews24ufknHO7gx30lsDyokKA= +github.com/goccy/go-json v0.10.0/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= +github.com/goccy/go-yaml v1.9.8 h1:5gMyLUeU1/6zl+WFfR1hN7D2kf+1/eRGa7DFtToiBvQ= +github.com/goccy/go-yaml v1.9.8/go.mod h1:JubOolP3gh0HpiBc4BLRD4YmjEjHAmIIB2aaXKkTfoE= github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y= github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= -github.com/lestrrat-go/codegen v1.0.4-0.20220422093832-3f381ea644e3 h1:ePhghrkFCIQH5Wnq5R5H5iw+RXdYkc53M/bcc7ylqpQ= -github.com/lestrrat-go/codegen v1.0.4-0.20220422093832-3f381ea644e3/go.mod h1:B5zvyPBGsMtVrUaM9q0doiP+oyw05CI/dpFU9T1TUFo= -github.com/lestrrat-go/option v1.0.0 h1:WqAWL8kh8VcSoD6xjSH34/1m8yxluXQbDeKNfvFeEO4= +github.com/lestrrat-go/codegen v1.0.4 h1:xWRqMkHzfpN/nfl4EeAwmbTvS7uotxfUPl8RhpjB3Go= +github.com/lestrrat-go/codegen v1.0.4/go.mod h1:JQPYOh/5hA2lipdHWj3YZHoKEGUfLmGQoWcWs4I92qk= github.com/lestrrat-go/option v1.0.0/go.mod h1:5ZHFbivi4xwXxhxY9XHDe2FHo6/Z7WWmtT7T5nBBp3I= -github.com/lestrrat-go/xstrings v0.0.0-20210804220435-4dd8b234342b h1:3laG8JWIeDGb7lf00nMRznLdCHy0aZPd/CGz7Okn1SY= +github.com/lestrrat-go/option v1.0.1 h1:oAzP2fvZGQKWkvHa1/SAcFolBEca1oN+mQ7eooNBEYU= +github.com/lestrrat-go/option v1.0.1/go.mod h1:5ZHFbivi4xwXxhxY9XHDe2FHo6/Z7WWmtT7T5nBBp3I= github.com/lestrrat-go/xstrings v0.0.0-20210804220435-4dd8b234342b/go.mod h1:mPFmD3Wuy0ddyPFvllLq4sUpGfE40T3VE8kWWS8fxGA= -github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8= +github.com/lestrrat-go/xstrings v0.0.0-20220901080742-cacb16b8ddb7 h1:8YrnMMQZquDwIgfQvZZ+JGMrRIn9UdzremIkMGQ/RoU= +github.com/lestrrat-go/xstrings v0.0.0-20220901080742-cacb16b8ddb7/go.mod h1:mPFmD3Wuy0ddyPFvllLq4sUpGfE40T3VE8kWWS8fxGA= github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng= +github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.7.0 h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A= +golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.8.0 h1:LUYupSeNrTNCGzR/hVBk2NHZO4hXcVaW1k4Qx7rjPx8= +golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20220412211240-33da011f77ad h1:ntjMns5wyP/fN65tdBD4g8J5w8n015+iIIs9rtjXkY0= -golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220406163625-3f8b81556e12/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= +golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20200918232735-d647fc253266 h1:k7tVuG0g1JwmD3Jh8oAl1vQ1C3jb4Hi/dUl1wWDBJpQ= golang.org/x/tools v0.0.0-20200918232735-d647fc253266/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3jS9O0/s90v0rJh3X/OLHEUk= +golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/tools/cmd/genjwt/main.go b/tools/cmd/genjwt/main.go index 19fd16116..2baa553e5 100644 --- a/tools/cmd/genjwt/main.go +++ b/tools/cmd/genjwt/main.go @@ -102,7 +102,7 @@ func generateToken(obj *codegen.Object) error { var buf bytes.Buffer o := codegen.NewOutput(&buf) - o.L("// This file is auto-generated by jwt/internal/cmd/gentoken/main.go. DO NOT EDIT") + o.L("// Code generated by tools/cmd/genjwt/main.go. DO NOT EDIT.") o.LL("package %s", obj.String(`package`)) var fields = obj.Fields() @@ -579,7 +579,7 @@ func genBuilder(obj *codegen.Object) error { var buf bytes.Buffer pkg := obj.MustString(`package`) o := codegen.NewOutput(&buf) - o.L("// This file is auto-generated by jwt/internal/cmd/gentoken/main.go. DO NOT EDIT") + o.L("// Code generated by tools/cmd/genjwt/main.go. DO NOT EDIT.") o.LL("package %s", pkg) o.LL("// Builder is a convenience wrapper around the New() constructor") diff --git a/tools/cmd/genoptions/go.mod b/tools/cmd/genoptions/go.mod index 38bbdb0a4..a59b76ce6 100644 --- a/tools/cmd/genoptions/go.mod +++ b/tools/cmd/genoptions/go.mod @@ -1,21 +1,22 @@ module github.com/lestrrat-go/jwx/v2/jwe/tools/cmd/genoptions -go 1.17 +go 1.19 require ( - github.com/goccy/go-yaml v1.9.5 - github.com/lestrrat-go/codegen v1.0.4-0.20220329032654-7b542c9fb49b - github.com/lestrrat-go/xstrings v0.0.0-20210804220435-4dd8b234342b + github.com/goccy/go-yaml v1.9.8 + github.com/lestrrat-go/codegen v1.0.4 + github.com/lestrrat-go/xstrings v0.0.0-20220901080742-cacb16b8ddb7 ) require ( - github.com/fatih/color v1.10.0 // indirect - github.com/lestrrat-go/option v1.0.0 // indirect - github.com/mattn/go-colorable v0.1.8 // indirect - github.com/mattn/go-isatty v0.0.12 // indirect - github.com/stretchr/testify v1.7.1 // indirect - golang.org/x/mod v0.3.0 // indirect - golang.org/x/sys v0.0.0-20220412211240-33da011f77ad // indirect - golang.org/x/tools v0.0.0-20200918232735-d647fc253266 // indirect - golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect + github.com/fatih/color v1.14.1 // indirect + github.com/lestrrat-go/option v1.0.1 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect + github.com/mattn/go-isatty v0.0.17 // indirect + github.com/stretchr/testify v1.8.2 // indirect + golang.org/x/crypto v0.7.0 // indirect + golang.org/x/mod v0.8.0 // indirect + golang.org/x/sys v0.6.0 // indirect + golang.org/x/tools v0.6.0 // indirect + golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect ) diff --git a/tools/cmd/genoptions/go.sum b/tools/cmd/genoptions/go.sum index 31c7707b9..06d5d0995 100644 --- a/tools/cmd/genoptions/go.sum +++ b/tools/cmd/genoptions/go.sum @@ -1,7 +1,9 @@ -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/fatih/color v1.10.0 h1:s36xzo75JdqLaaWoiEHk767eHiwo0598uUxyfiPkDsg= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= +github.com/fatih/color v1.14.1 h1:qfhVLaG5s+nCROl1zJsZRxFeYrHLqWroPOQ8BWiNb4w= +github.com/fatih/color v1.14.1/go.mod h1:2oHN61fhTpgcxD3TSWCgKDiH1+x4OiDVVGH8WlgGZGg= github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q= github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= @@ -9,35 +11,46 @@ github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD87 github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= github.com/go-playground/validator/v10 v10.4.1 h1:pH2c5ADXtd66mxoE0Zm9SUhxE20r7aM3F26W0hOn+GE= github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4= -github.com/goccy/go-yaml v1.9.5 h1:Eh/+3uk9kLxG4koCX6lRMAPS1OaMSAi+FJcya0INdB0= -github.com/goccy/go-yaml v1.9.5/go.mod h1:U/jl18uSupI5rdI2jmuCswEA2htH9eXfferR3KfscvA= +github.com/goccy/go-yaml v1.9.8 h1:5gMyLUeU1/6zl+WFfR1hN7D2kf+1/eRGa7DFtToiBvQ= +github.com/goccy/go-yaml v1.9.8/go.mod h1:JubOolP3gh0HpiBc4BLRD4YmjEjHAmIIB2aaXKkTfoE= github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y= github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= -github.com/lestrrat-go/codegen v1.0.4-0.20220329032654-7b542c9fb49b h1:PQ+SVFMytiSbfozcIQbp4Kb7/xe6NPiHdFNVQxnynlk= -github.com/lestrrat-go/codegen v1.0.4-0.20220329032654-7b542c9fb49b/go.mod h1:B5zvyPBGsMtVrUaM9q0doiP+oyw05CI/dpFU9T1TUFo= -github.com/lestrrat-go/option v1.0.0 h1:WqAWL8kh8VcSoD6xjSH34/1m8yxluXQbDeKNfvFeEO4= +github.com/lestrrat-go/codegen v1.0.4 h1:xWRqMkHzfpN/nfl4EeAwmbTvS7uotxfUPl8RhpjB3Go= +github.com/lestrrat-go/codegen v1.0.4/go.mod h1:JQPYOh/5hA2lipdHWj3YZHoKEGUfLmGQoWcWs4I92qk= github.com/lestrrat-go/option v1.0.0/go.mod h1:5ZHFbivi4xwXxhxY9XHDe2FHo6/Z7WWmtT7T5nBBp3I= -github.com/lestrrat-go/xstrings v0.0.0-20210804220435-4dd8b234342b h1:3laG8JWIeDGb7lf00nMRznLdCHy0aZPd/CGz7Okn1SY= +github.com/lestrrat-go/option v1.0.1 h1:oAzP2fvZGQKWkvHa1/SAcFolBEca1oN+mQ7eooNBEYU= +github.com/lestrrat-go/option v1.0.1/go.mod h1:5ZHFbivi4xwXxhxY9XHDe2FHo6/Z7WWmtT7T5nBBp3I= github.com/lestrrat-go/xstrings v0.0.0-20210804220435-4dd8b234342b/go.mod h1:mPFmD3Wuy0ddyPFvllLq4sUpGfE40T3VE8kWWS8fxGA= -github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8= +github.com/lestrrat-go/xstrings v0.0.0-20220901080742-cacb16b8ddb7 h1:8YrnMMQZquDwIgfQvZZ+JGMrRIn9UdzremIkMGQ/RoU= +github.com/lestrrat-go/xstrings v0.0.0-20220901080742-cacb16b8ddb7/go.mod h1:mPFmD3Wuy0ddyPFvllLq4sUpGfE40T3VE8kWWS8fxGA= github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng= +github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4= +golang.org/x/crypto v0.7.0 h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A= +golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.8.0 h1:LUYupSeNrTNCGzR/hVBk2NHZO4hXcVaW1k4Qx7rjPx8= +golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= @@ -48,19 +61,25 @@ golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20220412211240-33da011f77ad h1:ntjMns5wyP/fN65tdBD4g8J5w8n015+iIIs9rtjXkY0= -golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220406163625-3f8b81556e12/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20200918232735-d647fc253266 h1:k7tVuG0g1JwmD3Jh8oAl1vQ1C3jb4Hi/dUl1wWDBJpQ= golang.org/x/tools v0.0.0-20200918232735-d647fc253266/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU= +golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3jS9O0/s90v0rJh3X/OLHEUk= +golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/tools/cmd/genoptions/main.go b/tools/cmd/genoptions/main.go index e4a07c6c4..52232062e 100644 --- a/tools/cmd/genoptions/main.go +++ b/tools/cmd/genoptions/main.go @@ -134,7 +134,7 @@ func genOptions(objects *Objects) error { o := codegen.NewOutput(&buf) - o.L("// This file is auto-generated by internal/cmd/genoptions/main.go. DO NOT EDIT") + o.L("// Code generated by tools/cmd/genoptions/main.go. DO NOT EDIT.") o.LL(`package %s`, objects.PackageName) @@ -251,10 +251,16 @@ func genOptionTests(objects *Objects) error { o := codegen.NewOutput(&buf) - o.L("// This file is auto-generated by internal/cmd/genoptions/main.go. DO NOT EDIT") + o.L("// Code generated by tools/cmd/genoptions/main.go. DO NOT EDIT.") o.LL(`package %s`, objects.PackageName) + imports := append(objects.Imports, []string{ + `testing`, + `github.com/stretchr/testify/require`, + }...) + o.WriteImports(imports...) + o.LL(`func TestOptionIdent(t *testing.T) {`) seen := make(map[string]struct{}) for _, option := range objects.Options { diff --git a/tools/cmd/genreadfile/go.mod b/tools/cmd/genreadfile/go.mod index 4725424cb..4beb63b61 100644 --- a/tools/cmd/genreadfile/go.mod +++ b/tools/cmd/genreadfile/go.mod @@ -3,6 +3,10 @@ module github.com/lestrrat-go/jwx/v2/tools/cmd/genreadfile go 1.16 require ( - github.com/lestrrat-go/codegen v1.0.4-0.20220329032654-7b542c9fb49b - github.com/stretchr/testify v1.7.1 // indirect + github.com/lestrrat-go/codegen v1.0.4 + github.com/lestrrat-go/option v1.0.1 // indirect + github.com/lestrrat-go/xstrings v0.0.0-20220901080742-cacb16b8ddb7 // indirect + github.com/stretchr/testify v1.8.2 // indirect + golang.org/x/sys v0.6.0 // indirect + golang.org/x/tools v0.6.0 // indirect ) diff --git a/tools/cmd/genreadfile/go.sum b/tools/cmd/genreadfile/go.sum index 2736f29db..65255c636 100644 --- a/tools/cmd/genreadfile/go.sum +++ b/tools/cmd/genreadfile/go.sum @@ -1,40 +1,73 @@ -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/lestrrat-go/codegen v1.0.4-0.20220329032654-7b542c9fb49b h1:PQ+SVFMytiSbfozcIQbp4Kb7/xe6NPiHdFNVQxnynlk= -github.com/lestrrat-go/codegen v1.0.4-0.20220329032654-7b542c9fb49b/go.mod h1:B5zvyPBGsMtVrUaM9q0doiP+oyw05CI/dpFU9T1TUFo= -github.com/lestrrat-go/option v1.0.0 h1:WqAWL8kh8VcSoD6xjSH34/1m8yxluXQbDeKNfvFeEO4= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/lestrrat-go/codegen v1.0.4 h1:xWRqMkHzfpN/nfl4EeAwmbTvS7uotxfUPl8RhpjB3Go= +github.com/lestrrat-go/codegen v1.0.4/go.mod h1:JQPYOh/5hA2lipdHWj3YZHoKEGUfLmGQoWcWs4I92qk= github.com/lestrrat-go/option v1.0.0/go.mod h1:5ZHFbivi4xwXxhxY9XHDe2FHo6/Z7WWmtT7T5nBBp3I= -github.com/lestrrat-go/xstrings v0.0.0-20210804220435-4dd8b234342b h1:3laG8JWIeDGb7lf00nMRznLdCHy0aZPd/CGz7Okn1SY= +github.com/lestrrat-go/option v1.0.1 h1:oAzP2fvZGQKWkvHa1/SAcFolBEca1oN+mQ7eooNBEYU= +github.com/lestrrat-go/option v1.0.1/go.mod h1:5ZHFbivi4xwXxhxY9XHDe2FHo6/Z7WWmtT7T5nBBp3I= github.com/lestrrat-go/xstrings v0.0.0-20210804220435-4dd8b234342b/go.mod h1:mPFmD3Wuy0ddyPFvllLq4sUpGfE40T3VE8kWWS8fxGA= +github.com/lestrrat-go/xstrings v0.0.0-20220901080742-cacb16b8ddb7 h1:8YrnMMQZquDwIgfQvZZ+JGMrRIn9UdzremIkMGQ/RoU= +github.com/lestrrat-go/xstrings v0.0.0-20220901080742-cacb16b8ddb7/go.mod h1:mPFmD3Wuy0ddyPFvllLq4sUpGfE40T3VE8kWWS8fxGA= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.8.0 h1:LUYupSeNrTNCGzR/hVBk2NHZO4hXcVaW1k4Qx7rjPx8= +golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20200918232735-d647fc253266 h1:k7tVuG0g1JwmD3Jh8oAl1vQ1C3jb4Hi/dUl1wWDBJpQ= golang.org/x/tools v0.0.0-20200918232735-d647fc253266/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/tools/cmd/genreadfile/main.go b/tools/cmd/genreadfile/main.go index 105c2cc24..cf5402014 100644 --- a/tools/cmd/genreadfile/main.go +++ b/tools/cmd/genreadfile/main.go @@ -60,7 +60,7 @@ func generateFile(def definition) error { var buf bytes.Buffer o := codegen.NewOutput(&buf) - o.LL("// Automatically generated by internal/cmd/genreadfile/main.go. DO NOT EDIT") + o.LL("// Code generated by tools/cmd/genreadfile/main.go. DO NOT EDIT.") o.LL("package %s", def.Package) o.WriteImports("io/fs", "os") @@ -71,15 +71,14 @@ func generateFile(def definition) error { o.L(`}`) o.LL("func ReadFile(path string, options ...ReadFileOption) (%s, error) {", def.ReturnType) - o.L("var parseOptions []ParseOption") - o.L(`var readFileOptions []ReadFileOption`) - o.L(`for _, option := range options {`) - o.L(`if po, ok := option.(ParseOption); ok {`) - o.L(`parseOptions = append(parseOptions, po)`) - o.L(`} else {`) - o.L(`readFileOptions = append(readFileOptions, option)`) - o.L(`}`) - o.L(`}`) + if def.ParseOptions { + o.L("var parseOptions []ParseOption") + o.L(`for _, option := range options {`) + o.L(`if po, ok := option.(ParseOption); ok {`) + o.L(`parseOptions = append(parseOptions, po)`) + o.L(`}`) + o.L(`}`) + } o.LL(`var srcFS fs.FS = sysFS{}`) o.L("for _, option := range options {") o.L(`switch option.Ident() {`) diff --git a/tools/test.sh b/tools/test.sh index b8236fab9..905a6fe0a 100755 --- a/tools/test.sh +++ b/tools/test.sh @@ -19,13 +19,24 @@ case "$MODE" in ;; esac +failures=0 echo "mode: atomic" > "$DST" for dir in . ./examples ./bench/performance ./cmd/jwx; do + testout=$(mktemp /tmp/jwx-test.XXXXX) pushd "$dir" > /dev/null - go test -race -json ${testopts[@]} ./... | tparse + go test -race -json ${testopts[@]} ./... > $testout + if [[ "$?" != "0" ]]; then + failures=$((failures+1)) + fi + tparse -file="$testout" + rm "$testout" if [[ -e "$tmpfile" ]]; then cat "$tmpfile" | tail -n +2 | grep -v "internal/jose" | grep -v "internal/jwxtest" | grep -v "internal/cmd" >> "$DST" rm "$tmpfile" fi popd > /dev/null done + +if [[ "$failures" != "0" ]]; then + exit 1 +fi diff --git a/x25519/BUILD.bazel b/x25519/BUILD.bazel new file mode 100644 index 000000000..bfcc136bf --- /dev/null +++ b/x25519/BUILD.bazel @@ -0,0 +1,24 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "x25519", + srcs = ["x25519.go"], + importpath = "github.com/lestrrat-go/jwx/v2/x25519", + visibility = ["//visibility:public"], + deps = ["@org_golang_x_crypto//curve25519"], +) + +go_test( + name = "x25519_test", + srcs = ["x25519_test.go"], + deps = [ + ":x25519", + "@com_github_stretchr_testify//assert", + ], +) + +alias( + name = "go_default_library", + actual = ":x25519", + visibility = ["//visibility:public"], +)