auth

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2026 License: LGPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

Package auth obtains an Argus JWT for calls to remote services, caching it between runs so a developer signs in roughly once a month.

Index

Constants

View Source
const (
	// DefaultAuthURL is the Argus auth service. Override with WORLD_AUTH_URL.
	DefaultAuthURL = "https://api.argus.dev"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Claims

type Claims struct {
	Email string `json:"email"`
	Exp   int64  `json:"exp"`
}

Claims is the subset of the Argus JWT this CLI reads.

func ParseClaims

func ParseClaims(jwt string) (Claims, error)

ParseClaims reads the payload without verifying the signature: the operator verifies it, and the CLI only needs the expiry to decide whether to re-use it.

func (Claims) ExpiresAt

func (c Claims) ExpiresAt() time.Time

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client runs the sign-in flow. Persistence belongs to store, so other commands can read the token without importing auth. The zero value is not usable; use New.

func New

func New() *Client

func (*Client) Token

func (c *Client) Token(ctx context.Context) (string, error)

Token returns a cached JWT, running the browser sign-in when there is none or it has expired. Blocks on the user completing sign-in.

Jump to

Keyboard shortcuts

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