device

package
v0.138.3 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package device provides DataTug's shared auth.sneat.co device-login command.

Package device provides DataTug's shared auth.sneat.co device-login command.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Command

func Command() *cobra.Command

Command returns the DataTug auth.sneat.co commands. It is separate from auth google and the GitHub repository authorization flow, which grant different provider permissions and remain unchanged.

func LoginCommand

func LoginCommand() *cobra.Command

LoginCommand, StatusCommand, and LogoutCommand are mounted directly under `datatug auth` so the shared sign-in has the conventional CLI shape.

func LogoutCommand

func LogoutCommand() *cobra.Command

func ProductBearer added in v0.132.0

func ProductBearer(ctx context.Context, options ProductOptions) (string, error)

ProductBearer validates current product state for each request. No cached credential or successful earlier call can extend the original hard expiry.

func ProductCommand added in v0.132.0

func ProductCommand() *cobra.Command

ProductCommand is additive: the existing auth login/status/logout retain their legacy behavior until the coordinated credential-family cutover.

func SavedTokenSource added in v0.51.0

func SavedTokenSource(ctx context.Context, insecure bool) (oauth2.TokenSource, error)

SavedTokenSource loads the DataTug CLI's own audience- and product-scoped login. It never borrows a Sneat or Google credential. The insecure flag must match the explicit --insecure-storage choice made during auth login.

func StatusCommand

func StatusCommand() *cobra.Command

func WhoamiCommand added in v0.131.0

func WhoamiCommand() *cobra.Command

WhoamiCommand returns the top-level `datatug whoami` command. It reports the signed-in DataTug account (auth.sneat.co) in the same human-facing style as `wrangler whoami`. It is mounted at the root because it is the everyday "am I signed in, and as whom?" command; it is not a credential-management verb the way login/status/logout are.

Types

type ProductOptions added in v0.132.0

type ProductOptions struct {
	Issuer, Realm   string
	InsecureStorage bool
}

ProductOptions selects a separate credential family. It never loads the legacy Firebase account, exchanges a custom token, or refreshes a session.

type ProductReadCredential added in v0.132.1

type ProductReadCredential struct {
	Bearer    string
	Subject   string
	Realm     string
	ExpiresAt time.Time
}

ProductReadCredential preserves the verified login identity and its original hard expiry through buffered reads. It is never an authorization decision.

func ProductCredentialForRead added in v0.132.1

func ProductCredentialForRead(ctx context.Context, options ProductOptions) (ProductReadCredential, error)

type RefreshSession

type RefreshSession func(context.Context, string) (session, error)

RefreshSession exchanges a Firebase refresh token for the current session. It is injected so the identity endpoint is never hard-wired in tests.

type TokenSource

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

TokenSource loads the DataTug Firebase session, refreshes it before expiry, and atomically replaces the scoped credential before returning a bearer. Authenticated DataTug commands use this rather than a static one-shot token.

func (*TokenSource) Token

func (s *TokenSource) Token() (*oauth2.Token, error)

func (*TokenSource) TokenContext added in v0.51.0

func (s *TokenSource) TokenContext(ctx context.Context) (*oauth2.Token, error)

TokenContext lets a long-running client bound a refresh by its individual request deadline. Token() retains oauth2.TokenSource compatibility.

Jump to

Keyboard shortcuts

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