Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateSignedHMAC ¶ added in v1.0.4
func RandomBytes ¶ added in v0.4.0
RandomBytes returns n random bytes by reading from crypto/rand.Reader
Types ¶
type HMACStrategy ¶
type HMACStrategy struct {
TokenEntropy int
GlobalSecret []byte
RotatedGlobalSecrets [][]byte
PrivateKey *rsa.PrivateKey
sync.Mutex
}
HMACStrategy is responsible for generating and validating challenges.
func (*HMACStrategy) Generate ¶
func (c *HMACStrategy) Generate() (string, string, error)
Generate generates a token and a matching signature or returns an error. This method implements rfc6819 Section 5.1.4.2.2: Use High Entropy for Secrets.
func (*HMACStrategy) GetExpirationTime ¶ added in v1.0.5
func (c *HMACStrategy) GetExpirationTime(token string) (time.Time, error)
GetExpirationTime - Get Expiration Time from Token in UTC
func (*HMACStrategy) Signature ¶
func (c *HMACStrategy) Signature(token string) string
Signature - Return Signature Out of HmacToken
func (*HMACStrategy) Valid ¶ added in v1.0.5
func (c *HMACStrategy) Valid(token string) bool
Valid - Check for Expiry of HMAC Token
func (*HMACStrategy) Validate ¶
func (c *HMACStrategy) Validate(token string) (err error)
Validate validates a token and returns its signature or an error if the token is not valid.
type OldHMACStrategy ¶ added in v1.0.5
type OldHMACStrategy struct {
TokenEntropy int
GlobalSecret []byte
RotatedGlobalSecrets [][]byte
sync.Mutex
}
OldHMACStrategy is responsible for generating and validating challenges.
func (*OldHMACStrategy) Generate ¶ added in v1.0.5
func (c *OldHMACStrategy) Generate() (string, string, error)
Generate generates a token and a matching signature or returns an error. This method implements rfc6819 Section 5.1.4.2.2: Use High Entropy for Secrets.
func (*OldHMACStrategy) Signature ¶ added in v1.0.5
func (c *OldHMACStrategy) Signature(token string) string
func (*OldHMACStrategy) Validate ¶ added in v1.0.5
func (c *OldHMACStrategy) Validate(token string) (err error)
Validate validates a token and returns its signature or an error if the token is not valid.