From 970d2ded7c5ba67f00b7d3b475c58cc8c2bd34df Mon Sep 17 00:00:00 2001 From: Oleg Kovalov Date: Sun, 19 Feb 2023 14:01:54 +0100 Subject: [PATCH] Next major v5 (#133) --- .github/workflows/build.yml | 18 ++++++------------ README.md | 8 ++++---- algo_es_test.go | 1 - algo_rs_test.go | 1 - build.go | 1 - claims.go | 1 - doc.go | 1 - example_test.go | 2 +- fuzz.go | 1 - go.mod | 4 ++-- jwt.go | 2 -- jwt_bench_test.go | 2 +- numeric_date.go | 1 - 13 files changed, 14 insertions(+), 29 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b358aba..0c654cc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,35 +1,29 @@ name: build -permissions: read-all - on: push: branches: [main] pull_request: + branches: [main] + schedule: + - cron: '0 0 * * 0' workflow_dispatch: inputs: tag: description: 'Tag to create' required: true default: 'v0.0.0' - schedule: - - cron: '0 0 * * 0' # See https://github.com/cristalhq/.github/.github/workflows jobs: build: - uses: cristalhq/.github/.github/workflows/build.yml@d8f219c7111863d360a6c6f978ee64d6371a045e # latest @ main + uses: cristalhq/.github/.github/workflows/build.yml@main codeql: - if: github.event.repository.public - permissions: - security-events: write - uses: cristalhq/.github/.github/workflows/codeql.yml@d8f219c7111863d360a6c6f978ee64d6371a045e # latest @ main + uses: cristalhq/.github/.github/workflows/codeql.yml@main release: if: github.event_name == 'workflow_dispatch' - uses: cristalhq/.github/.github/workflows/release.yml@d8f219c7111863d360a6c6f978ee64d6371a045e # latest @ main - permissions: - contents: write + uses: cristalhq/.github/.github/workflows/release.yml@main with: tag: ${{ github.event.input.tag }} diff --git a/README.md b/README.md index 7307ad2..43f24aa 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ JSON Web Token for Go [RFC 7519](https://tools.ietf.org/html/rfc7519), also see [jwt.io](https://jwt.io) for more. -The latest version is `v4`. +The latest version is `v5`. ## Rationale @@ -36,7 +36,7 @@ See [GUIDE.md](https://github.com/cristalhq/jwt/blob/main/GUIDE.md) for more det Go version 1.17+ ``` -go get github.com/cristalhq/jwt/v4 +go get github.com/cristalhq/jwt/v5 ``` ## Example @@ -108,8 +108,8 @@ See [these docs][pkg-url]. [build-img]: https://github.com/cristalhq/jwt/workflows/build/badge.svg [build-url]: https://github.com/cristalhq/jwt/actions -[pkg-img]: https://pkg.go.dev/badge/cristalhq/jwt/v4 -[pkg-url]: https://pkg.go.dev/github.com/cristalhq/jwt/v4 +[pkg-img]: https://pkg.go.dev/badge/cristalhq/jwt/v5 +[pkg-url]: https://pkg.go.dev/github.com/cristalhq/jwt/v5 [reportcard-img]: https://goreportcard.com/badge/cristalhq/jwt [reportcard-url]: https://goreportcard.com/report/cristalhq/jwt [coverage-img]: https://codecov.io/gh/cristalhq/jwt/branch/main/graph/badge.svg diff --git a/algo_es_test.go b/algo_es_test.go index cbfeb7a..7d696b0 100644 --- a/algo_es_test.go +++ b/algo_es_test.go @@ -104,7 +104,6 @@ var ( // openssl ecparam -name secp384r1 -genkey -noout -out es384-private.pem // ES512 // openssl ecparam -name secp521r1 -genkey -noout -out es521-private.pem -// const ( testKeyES256 = `-----BEGIN EC PRIVATE KEY----- MHcCAQEEIM+a8cZ6BjdZBYy7pMIqmWsHKSmAZhZ/RTeSkmzPKohfoAoGCCqGSM49 diff --git a/algo_rs_test.go b/algo_rs_test.go index 085ef0d..948f9a7 100644 --- a/algo_rs_test.go +++ b/algo_rs_test.go @@ -92,7 +92,6 @@ var ( // openssl genrsa -out rs384-2048-private.rsa 2048 // RS512 // openssl genrsa -out rs512-4096-private.rsa 4096 -// const ( testKeyRSA1024 = `-----BEGIN RSA PRIVATE KEY----- MIICXQIBAAKBgQDZY2zMlYH8Onz1eAxYc6IdyPT5AmVsae/Q2+wuhFcf6DrGRrBj diff --git a/build.go b/build.go index cca3a48..07bf116 100644 --- a/build.go +++ b/build.go @@ -46,7 +46,6 @@ func NewBuilder(signer Signer, opts ...BuilderOption) *Builder { // Build used to create and encode JWT with a provided claims. // If claims param is of type []byte or string then it's treated as a marshaled JSON. // In other words you can pass already marshaled claims. -// func (b *Builder) Build(claims interface{}) (*Token, error) { rawClaims, errClaims := encodeClaims(claims) if errClaims != nil { diff --git a/claims.go b/claims.go index 209b9db..2f22df5 100644 --- a/claims.go +++ b/claims.go @@ -7,7 +7,6 @@ import ( // RegisteredClaims represents claims for JWT. // See: https://tools.ietf.org/html/rfc7519#section-4.1 -// type RegisteredClaims struct { // ID claim provides a unique identifier for the JWT. ID string `json:"jti,omitempty"` diff --git a/doc.go b/doc.go index b1ff87c..731a398 100644 --- a/doc.go +++ b/doc.go @@ -3,5 +3,4 @@ // Builder, all Signers and Verifiers are safe for use by multiple goroutines simultaneously. // // See [RFC 7519](https://tools.ietf.org/html/rfc7519) and see [jwt.io](https://jwt.io) for more. -// package jwt diff --git a/example_test.go b/example_test.go index e2a4fdc..817deeb 100644 --- a/example_test.go +++ b/example_test.go @@ -5,7 +5,7 @@ import ( "fmt" "time" - "github.com/cristalhq/jwt/v4" + "github.com/cristalhq/jwt/v5" ) func ExampleSignAndVerify() { diff --git a/fuzz.go b/fuzz.go index ee19bea..e87831c 100644 --- a/fuzz.go +++ b/fuzz.go @@ -1,5 +1,4 @@ //go:build gofuzz -// +build gofuzz // To run the fuzzer, run the following commands: // $ GO111MODULE=off go get -u github.com/dvyukov/go-fuzz/go-fuzz github.com/dvyukov/go-fuzz/go-fuzz-build diff --git a/go.mod b/go.mod index 8128a36..19b0c3d 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,3 @@ -module github.com/cristalhq/jwt/v4 +module github.com/cristalhq/jwt/v5 -go 1.17 +go 1.19 diff --git a/jwt.go b/jwt.go index b29b78c..c3428a3 100644 --- a/jwt.go +++ b/jwt.go @@ -8,7 +8,6 @@ import ( // Token represents a JWT token. // See: https://tools.ietf.org/html/rfc7519 -// type Token struct { raw []byte dot1 int @@ -73,7 +72,6 @@ func (t *Token) isValid() bool { // Header representa JWT header data. // See: https://tools.ietf.org/html/rfc7519#section-5, https://tools.ietf.org/html/rfc7517 -// type Header struct { Algorithm Algorithm `json:"alg"` Type string `json:"typ,omitempty"` // only "JWT" can be here diff --git a/jwt_bench_test.go b/jwt_bench_test.go index 5bd60cb..c313d4f 100644 --- a/jwt_bench_test.go +++ b/jwt_bench_test.go @@ -11,7 +11,7 @@ import ( "testing" "time" - "github.com/cristalhq/jwt/v4" + "github.com/cristalhq/jwt/v5" ) func BenchmarkAlgEDSA(b *testing.B) { diff --git a/numeric_date.go b/numeric_date.go index 5535002..82d69e0 100644 --- a/numeric_date.go +++ b/numeric_date.go @@ -9,7 +9,6 @@ import ( // NumericDate represents date for StandardClaims // See: https://tools.ietf.org/html/rfc7519#section-2 -// type NumericDate struct { time.Time }