token

package
v0.1.19 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 15, 2024 License: Apache-2.0 Imports: 9 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	AllKinds = []Kind{KindAccess, KindRefresh}
)

Functions

func Delete

func Delete(kind Kind, audience string) error

Delete removes the token for the given audience, if it exists. No error is returned if the token doesn't exist.

func DeleteAll

func DeleteAll() error

DeleteAll removes all Chainguard tokens and empty audience directories.

func Load

func Load(kind Kind, audience string) ([]byte, error)

Load returns the token for the given audience if it exists, or an error if it doesn't.

func Path

func Path(kind Kind, audience string) (string, error)

Path is the filepath of the token for the given audience.

func RemainingLife

func RemainingLife(kind Kind, audience string, less time.Duration) time.Duration

RemainingLife returns the amount of time remaining before the token for the given audience expires. Returns 0 for expired and non-existent tokens.

func Save

func Save(token []byte, kind Kind, audience string) error

Save saves the given token to cache/audience

Types

type Kind added in v0.1.10

type Kind string
const (
	KindAccess  Kind = "oidc-token"
	KindRefresh Kind = "refresh-token"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL