Documentation ¶
Index ¶
- Constants
- Variables
- func Decode(pemEncoded string) *ecdsa.PrivateKey
- func Encode(privateKey *ecdsa.PrivateKey) string
- func FromBase64(key string) (*ecdsa.PrivateKey, error)
- func New() (*ecdsa.PrivateKey, *ecdsa.PublicKey)
- func NewBase64() string
- func NewToken(claim *RoleClaims, private interface{}) (string, error)
- type RoleClaims
Constants ¶
View Source
const (
DefaultKey = `` /* 358-byte string literal not displayed */
)
Variables ¶
View Source
var (
ErrInvalidRoleclaims = errors.New("invalid role claims")
)
Functions ¶
func Decode ¶
func Decode(pemEncoded string) *ecdsa.PrivateKey
func Encode ¶
func Encode(privateKey *ecdsa.PrivateKey) string
func FromBase64 ¶
func FromBase64(key string) (*ecdsa.PrivateKey, error)
func NewToken ¶
func NewToken(claim *RoleClaims, private interface{}) (string, error)
Types ¶
type RoleClaims ¶
type RoleClaims struct { Roles []string `json:"roles"` jwt.StandardClaims }
func NewRoleClaims ¶
func NewRoleClaims(roles []string) *RoleClaims
func ParseAndCheckToken ¶
func ParseAndCheckToken(token string, pubKey interface{}) (*RoleClaims, error)
func (*RoleClaims) String ¶
func (r *RoleClaims) String() string
Click to show internal directories.
Click to hide internal directories.