github.com/whoyao/protocol@v0.0.0-20230519045905-2d8ace718ca5/auth/interfaces.go (about)

     1  package auth
     2  
     3  import (
     4  	"errors"
     5  )
     6  
     7  //go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 -generate
     8  
     9  var (
    10  	ErrKeysMissing = errors.New("missing API key or secret key")
    11  )
    12  
    13  //counterfeiter:generate . TokenVerifier
    14  type TokenVerifier interface {
    15  	Identity() string
    16  	Verify(key interface{}) (*ClaimGrants, error)
    17  }
    18  
    19  //counterfeiter:generate . KeyProvider
    20  type KeyProvider interface {
    21  	GetSecret(key string) string
    22  	NumKeys() int
    23  }