Documentation
¶
Index ¶
- func DefaultHashedFileName(appKey string) string
- func DefaultTokenDir(cwd string) (string, error)
- func FindProjectRoot(start string) (string, bool)
- func HashAppKey(appKey string) string
- func JSONFileOnly(name string) bool
- func PrefixedHashedFileName(prefix string) func(string) string
- func PrefixedJSONFileOnly(prefix string) func(string) bool
- type Entry
- type Manager
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultHashedFileName ¶
DefaultHashedFileName returns "<hash>.json" for appKey.
func DefaultTokenDir ¶
DefaultTokenDir resolves the default token directory.
func FindProjectRoot ¶
FindProjectRoot walks up from start and returns the directory containing go.mod.
func HashAppKey ¶
HashAppKey returns the first 12 chars of sha256(appKey).
func PrefixedHashedFileName ¶
PrefixedHashedFileName returns "<prefix><hash>.json" builder.
func PrefixedJSONFileOnly ¶
PrefixedJSONFileOnly returns a file predicate for prefixed *.json files.
Types ¶
type Entry ¶
type Entry struct {
AccessToken string `json:"access_token"`
ExpiresAt time.Time `json:"expires_at"`
AppKey string `json:"app_key"`
}
Entry represents one cached token record.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager stores tokens in memory and persists them on disk.
func (*Manager) DeleteToken ¶ added in v0.14.0
DeleteToken removes the cached token for appKey from memory and disk.
func (*Manager) WaitForAuth ¶
WaitForAuth enforces per-appKey token issuance throttling.
Click to show internal directories.
Click to hide internal directories.