package jwt
import "git.sr.ht/~pingoo/stdx/jwt"
Index ¶
- Variables
- type Algorithm
- type NewProviderOptions
- type Provider
- func NewProvider(signingSecretKey []byte, algorithm Algorithm, options *NewProviderOptions) (provider *Provider, err error)
- func (provider *Provider) IssueToken(data any, options *TokenOptions) (token string, err error)
- func (provider *Provider) VerifyToken(token string, data any) (err error)
- type TokenOptions
- type Type
Variables ¶
var ( ErrTokenIsNotValid = errors.New("The token is not valid") ErrSignatureIsNotValid = errors.New("Signature is not valid") ErrTokenHasExpired = errors.New("The token has expired") ErrAlgorithmIsNotValid = fmt.Errorf("Algorithm is not valid. Valid algorithms values are: [%s, %s]", AlgorithmHS256, AlgorithmHS512) )
Types ¶
type Algorithm ¶
type Algorithm string
type NewProviderOptions ¶
type NewProviderOptions struct { VerifyingKeys [][]byte }
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
func NewProvider ¶
func NewProvider(signingSecretKey []byte, algorithm Algorithm, options *NewProviderOptions) (provider *Provider, err error)
func (*Provider) IssueToken ¶
func (provider *Provider) IssueToken(data any, options *TokenOptions) (token string, err error)
func (*Provider) VerifyToken ¶
type TokenOptions ¶
type Type ¶
type Type string
const ( TypeJWT Type = "JWT" )
Source Files ¶
hmac.go jwt.go
- Version
- v0.0.0-20240218134121-094174641f6e (latest)
- Published
- Feb 18, 2024
- Platform
- linux/amd64
- Imports
- 12 packages
- Last checked
- 4 months ago –
Tools for package owners.