Skip to content

Commit

Permalink
Update README.md (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
cristaloleg authored May 9, 2020
1 parent 07dfee3 commit 5cd2d23
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
18 changes: 15 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,27 @@
[![Go Report Card][reportcard-img]][reportcard-url]
[![Coverage][coverage-img]][coverage-url]

JSON Web Tokens for Go
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 `v3`.

## Features

* Simple API.
* Clean and tested code.
* Optimized for speed.
* Dependency-free.
* All sign methods supported
* HMAS (HS)
* RSA (RS)
* RSA-PSS (PS)
* ECDSA (ES)
* EdDSA (EdDSA)
* or your own!

## Install

Go version 1.13
Go version 1.13+

```
go get github.com/cristalhq/jwt/v3
Expand Down Expand Up @@ -65,7 +75,9 @@ var newClaims jwt.StandardClaims
errClaims := json.Unmarshal(newToken.RawClaims(), &newClaims)
checkErr(errClaims)

// 10. see docs for more methods
// 10. verify claims
var _ bool = newClaims.IsForAudience("admin")
var _ bool = newClaims.IsValidAt(time.Now())
```

Also see examples: [this above](https://github.com/cristalhq/jwt/blob/master/example_test.go), [build](https://github.com/cristalhq/jwt/blob/master/example_build_test.go), [parse](https://github.com/cristalhq/jwt/blob/master/example_parse_test.go).
Expand Down
5 changes: 4 additions & 1 deletion example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package jwt_test
import (
"encoding/json"
"fmt"
"time"

"github.com/cristalhq/jwt/v3"
)
Expand Down Expand Up @@ -49,7 +50,9 @@ func Example_JWT() {
errClaims := json.Unmarshal(newToken.RawClaims(), &newClaims)
checkErr(errClaims)

// 10. see docs for more methods
// 10. verify claims
var _ bool = newClaims.IsForAudience("admin")
var _ bool = newClaims.IsValidAt(time.Now())

fmt.Printf("Algorithm %v\n", newToken.Header().Algorithm)
fmt.Printf("Type %v\n", newToken.Header().Type)
Expand Down

0 comments on commit 5cd2d23

Please sign in to comment.