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 ¶
- func Command() *cobra.Command
- func LoginCommand() *cobra.Command
- func LogoutCommand() *cobra.Command
- func ProductBearer(ctx context.Context, options ProductOptions) (string, error)
- func ProductCommand() *cobra.Command
- func SavedTokenSource(ctx context.Context, insecure bool) (oauth2.TokenSource, error)
- func StatusCommand() *cobra.Command
- func WhoamiCommand() *cobra.Command
- type ProductOptions
- type RefreshSession
- type TokenSource
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func 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 ¶
LoginCommand, StatusCommand, and LogoutCommand are mounted directly under `datatug auth` so the shared sign-in has the conventional CLI shape.
func LogoutCommand ¶
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
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
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 WhoamiCommand ¶ added in v0.131.0
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
ProductOptions selects a separate credential family. It never loads the legacy Firebase account, exchanges a custom token, or refreshes a session.
type RefreshSession ¶
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) TokenContext ¶ added in v0.51.0
TokenContext lets a long-running client bound a refresh by its individual request deadline. Token() retains oauth2.TokenSource compatibility.