You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A go (or 'golang' for search engine friendliness)
implementation of JSON Web
Encryption. This is a companion
package to https://github.com/golang-jwt/jwt. A common use-case is to encrypt
the contents of a JWT using JWE.
Disclaimer
The public API of this package is highly unstable and we are nowhere near any
stable v1.0 version, so expect a number of breaking changes as we develop it.
Currently, this package is considered mostly a pet project, so please be aware
that the golang-jwt maintainers can only spent a limited time on this.
Therefore, any response to a pull request review might take some time. On the
other hand, we might be a little more lax with regards to API breaking pull
requests, as long as we are still in the v0.x version range.
Usage
In order to build a new JWE, which encrypts a certain payload the function
NewJWE should be used.
import"github.com/golang-jwt/jwe"funcmain() {
originalText:= []byte("The true sign of intelligence is not knowledge but imagination.")
token, err:=jwe.NewJWE(jwe.KeyAlgorithmRSAOAEP, pk, jwe.EncryptionTypeA256GCM, originalText)
iferr!=nil {
panic(err)
return
}
compact, err:=token.CompactSerialize()
iferr!=nil {
panic(err)
return
}
}