Documentation ¶
Index ¶
- Variables
- func Decode(secret []byte, token []byte) (map[string]interface{}, error)
- func DecodeEmbedded(secret []byte, tokenBytes []byte, v interface{}) error
- func DecodeStruct(secret []byte, tokenBytes []byte, v interface{}) error
- func Encode(secret []byte, t time.Duration, payload map[string]interface{}) (string, error)
- func EncodeEmbedded(secret []byte, t time.Duration, v interface{}) (string, error)
- func EncodeStruct(secret []byte, t time.Duration, v interface{}) (string, error)
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func DecodeEmbedded ¶
DecodeEmbedded validates and parses a JWT token into a struct. It expects the struct's payload to be attached to the key `claim` of the actual JWT claim. Note that the struct should have json tags
func DecodeStruct ¶
DecodeStruct validates and parses a JWT token into a struct.
func Encode ¶
Encodes generates and signs a JWT token for the given payload using the HMAC algorithm.
func EncodeEmbedded ¶
EncodeEmbedded attaches the payload as an entry to the final claim using the key `claim` to prevent clashes with JWT field names.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.