fosite: Index | Files

package hmac

import ""


Package Files

bytes.go hmacsha.go

func RandomBytes Uses

func RandomBytes(n int) ([]byte, error)

RandomBytes returns n random bytes by reading from crypto/rand.Reader

type HMACStrategy Uses

type HMACStrategy struct {
    TokenEntropy         int
    GlobalSecret         []byte
    RotatedGlobalSecrets [][]byte

HMACStrategy is responsible for generating and validating challenges.

func (*HMACStrategy) Generate Uses

func (c *HMACStrategy) Generate() (string, string, error)

Generate generates a token and a matching signature or returns an error. This method implements rfc6819 Section Use High Entropy for Secrets.

func (*HMACStrategy) Signature Uses

func (c *HMACStrategy) Signature(token string) string

func (*HMACStrategy) Validate Uses

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.

Package hmac imports 10 packages (graph) and is imported by 40 packages. Updated 2019-04-02. Refresh now. Tools for package owners.