util

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: May 31, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InStringSlice

func InStringSlice(ss []string, str string) (index int, exists bool)

func JwtCreate

func JwtCreate(claims JwtClaims, secret string) (string, error)

func RemoveStringSlice

func RemoveStringSlice(ss []string, str string) []string

func RemoveStringSliceByIndex

func RemoveStringSliceByIndex(ss []string, index int) []string

Types

type JwtAuthInfo

type JwtAuthInfo struct {
	Slug      string    `json:"slug"` // namespace/name
	CreatedAt time.Time `json:"created_at"`
	Signature string    `json:"signature"`
}

func (*JwtAuthInfo) BuildSign

func (j *JwtAuthInfo) BuildSign(secret string) string

func (*JwtAuthInfo) CheckSign

func (j *JwtAuthInfo) CheckSign(secret string) bool

type JwtClaims

type JwtClaims struct {
	Auth *JwtAuthInfo `json:",inline"`
	jwt.RegisteredClaims
}

func JwtParse

func JwtParse(tokenStr string, secret string) (*JwtClaims, error)

Jump to

Keyboard shortcuts

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