Skip to content

Commit b2647e8

Browse files
authored
Adding a more detailed README (#2)
1 parent 15b79f6 commit b2647e8

File tree

1 file changed

+44
-2
lines changed

1 file changed

+44
-2
lines changed

README.md

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,45 @@
1-
# JWE
1+
# jwe
22

3-
Implementation of the JWE specification. This is a companion package to https://github.com/golang-jwt/jwt.
3+
[![build](https://github.com/golang-jwt/jwe/actions/workflows/build.yml/badge.svg)](https://github.com/golang-jwt/jwe/actions/workflows/build.yml)
4+
[![Go Reference](https://pkg.go.dev/badge/github.com/golang-jwt/jwe.svg)](https://pkg.go.dev/github.com/golang-jwt/jwe)
5+
6+
A [go](http://www.golang.org) (or 'golang' for search engine friendliness)
7+
implementation of [JSON Web
8+
Encryption](https://datatracker.ietf.org/doc/rfc7516/). This is a companion
9+
package to https://github.com/golang-jwt/jwt. A common use-case is to encrypt
10+
the contents of a JWT using JWE.
11+
12+
## Disclaimer
13+
14+
The public API of this package is highly unstable and we are nowhere near any
15+
stable `v1.0` version, so expect a number of breaking changes as we develop it.
16+
17+
Currently, this package is considered mostly a pet project, so please be aware
18+
that the `golang-jwt` maintainers can only spent a limited time on this.
19+
Therefore, any response to a pull request review might take some time. On the
20+
other hand, we might be a little more lax with regards to API breaking pull
21+
requests, as long as we are still in the `v0.x` version range.
22+
23+
## Usage
24+
25+
In order to build a new JWE, which encrypts a certain payload the function
26+
`NewJWE` should be used.
27+
28+
```golang
29+
import "github.com/golang-jwt/jwe"
30+
31+
func main() {
32+
originalText := []byte("The true sign of intelligence is not knowledge but imagination.")
33+
token, err := jwe.NewJWE(jwe.KeyAlgorithmRSAOAEP, pk, jwe.EncryptionTypeA256GCM, originalText)
34+
if err != nil {
35+
panic(err)
36+
return
37+
}
38+
39+
compact, err := token.CompactSerialize()
40+
if err != nil {
41+
panic(err)
42+
return
43+
}
44+
}
45+
```

0 commit comments

Comments
 (0)