fosite: github.com/ory/fosite/token/hmac Index | Files

package hmac

import "github.com/ory/fosite/token/hmac"

Index

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
    sync.Mutex
}

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 5.1.4.2.2: 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 21 packages. Updated 2019-04-02. Refresh now. Tools for package owners.