gauth

package
v0.0.14 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2026 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultFilepath

func DefaultFilepath() (string, error)

DefaultFilepath returns a default config path for this application. On Unix-like systems: $XDG_CONFIG_HOME/firestore-viewer/service_accounts.json On macOS: ~/Library/Application Support/firestore-viewer/service_accounts.json On Windows: %AppData%/firestore-viewer/service_accounts.json

func DeleteRefreshToken

func DeleteRefreshToken() error

DeleteRefreshToken removes the stored refresh token from the keychain

func GetGCloudProjects

func GetGCloudProjects(ctx context.Context) (projects []*cloudresourcemanager.Project, err error)

func GetRefreshToken

func GetRefreshToken() (string, error)

GetRefreshToken retrieves a stored token from the keychain

func GoogleAuthCommand

func GoogleAuthCommand() *cli.Command

func NewServiceAccountsUI

func NewServiceAccountsUI(store Store, serviceAccounts []ServiceAccountDbo) (tea.Model, error)

func StartInteractiveLogin

func StartInteractiveLogin(ctx context.Context, scopes []string) (*oauth2.Token, error)

StartInteractiveLogin runs an interactive OAuth login with the provided scopes, stores the refresh token in keychain, and returns the acquired token.

Types

type AddServiceAccountCanceledMsg

type AddServiceAccountCanceledMsg struct{}

AddServiceAccountCanceledMsg is emitted when the user cancels the form.

type AddServiceAccountSubmittedMsg

type AddServiceAccountSubmittedMsg struct{ Account ServiceAccountDbo }

AddServiceAccountSubmittedMsg is emitted by the form when user confirms submission. The payload is the validated ServiceAccountDbo to be persisted by a parent model. It is defined in this file to keep coupling low.

type FileStore

type FileStore struct {
	// Filepath is the full path to the JSON file.
	Filepath string
}

func (FileStore) Load

func (s FileStore) Load() ([]ServiceAccountDbo, error)

Load implements Store.Load.

func (FileStore) Save

func (s FileStore) Save(list []ServiceAccountDbo) error

Save implements Store.Save.

func (FileStore) Validate

func (s FileStore) Validate() error

Validate implements Validate for FileStore to comply with the project style.

type ServiceAccountDbo

type ServiceAccountDbo struct {
	Name string `json:"name"`
	Path string `json:"path"`
}

func (ServiceAccountDbo) Validate

func (sa ServiceAccountDbo) Validate() error

Validate implements the interface { Validate() error } required by the project.

type ServiceAccountsUpdatedMsg

type ServiceAccountsUpdatedMsg []ServiceAccountDbo

ServiceAccountsUpdatedMsg is emitted by fbauth UIs to notify parent models that the list of service accounts has changed. Payload is the full, current list.

type Store

type Store interface {
	// Load returns the list of service accounts and optional active index/name if needed later.
	Load() ([]ServiceAccountDbo, error)
	// Save persists the list of service accounts.
	Save([]ServiceAccountDbo) error
}

Jump to

Keyboard shortcuts

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