Documentation ¶
Index ¶
- Constants
- Variables
- func Create(sub, aud, expIn string) (string, int64, error)
- func GetSubject(userID, deviceID string) string
- func InitPrvKey(filepath string) error
- func InitPubKey(filepath string) error
- func ParseSubject(sub string) (userID, deviceID string)
- func Verify(tokenString string, aud string) (sub string, err error)
Constants ¶
View Source
const ( TokenIssuer string = "github.com/JuneKimDev/token" TokenSubjectDelimiter string = "#" )
Constants
Variables ¶
View Source
var ( ErrNoFilepath = errors.New("Filepath is empty") ErrPrvKeyNotInitiated = errors.New("Private key is not initiated") ErrPubKeyNotInitiated = errors.New("Public key is not initiated") ErrInvalidToken = errors.New("Token is invalid") )
Errors
Functions ¶
func Create ¶ added in v0.0.1
Create outputs JWT signed token string, expiration timestamp, and errors
"expIn" is a string as in time.ParseDuration: e.g. 1h, 10m, 1.5s, -300ms, 1h20m
func GetSubject ¶
GetSubject returns properly formatted subject that perme micro-services can understand
func ParseSubject ¶
ParseSubject parses subject and returns user id and device id
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.