jwt

package
v0.3.0-beta.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 29, 2023 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractBearerToken

func ExtractBearerToken(header string) (string, error)

It takes a string, splits it on a space, and returns the second element of the resulting array

func GetClaims

func GetClaims(token *jwt.Token) (*jwt.StandardClaims, bool)

It takes a JWT token and returns the claims from it

Types

type JWT

type JWT struct {
	// contains filtered or unexported fields
}

`JWT` is a struct that has a field called `options` of type `JWTOptions`. @property {JWTOptions} options - This is a struct that contains the options for the JWT.

func DefaultNew

func DefaultNew() *JWT

`DefaultNew()` returns a new instance of `JWT` with the default options

func (*JWT) BuildJWTParseMiddleware

func (j *JWT) BuildJWTParseMiddleware(headers string) JWTParserMiddleware

A function that returns a function.

func (*JWT) Generate

func (j *JWT) Generate(doc *did.DidDocument) (string, error)

Creating a new token with the claims of the document.

func (*JWT) Parse

func (j *JWT) Parse(token string) (*jwt.Token, error)

Parses a jwt token if possible and returns as Token type.

type JWTOptions

type JWTOptions struct {
	// contains filtered or unexported fields
}

`JWTOptions` is a struct that contains a `[]byte` named `secret`, a `jwt.SigningMethod` named `singingMethod`, and an `int64` named `ttl`. @property {[]byte} secret - This is the secret key used to sign the JWT. @property singingMethod - The signing method used to sign the token. @property {int64} ttl - Time to live in seconds.

func (*JWTOptions) DefaultTestConfig

func (opts *JWTOptions) DefaultTestConfig() JWTOptions

A method that returns a `JWTOptions` struct.

func (*JWTOptions) WithConfig

func (j *JWTOptions) WithConfig(config JWTOptions)

Setting the `options` variable to the `config` variable.

type JWTParserMiddleware

type JWTParserMiddleware = func() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL