auth

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultServerURL = "https://nimbusgo.space"

DefaultServerURL is the default Nimbus Cloud API & OAuth server.

Variables

This section is empty.

Functions

func AuthFilePath

func AuthFilePath() (string, error)

AuthFilePath returns the absolute path to ~/.nimbus/auth.json.

func ClearCredentials

func ClearCredentials() error

ClearCredentials removes ~/.nimbus/auth.json.

func ConfigDir

func ConfigDir() (string, error)

ConfigDir returns the path to ~/.nimbus directory.

func GetServerURL

func GetServerURL() string

GetServerURL returns the configured Nimbus Cloud URL (checking NIMBUS_CLOUD_URL env var).

func SaveCredentials

func SaveCredentials(creds *Credentials) error

SaveCredentials writes credentials to ~/.nimbus/auth.json with 0600 permissions.

Types

type Credentials

type Credentials struct {
	AccessToken  string    `json:"access_token"`
	RefreshToken string    `json:"refresh_token,omitempty"`
	Email        string    `json:"email"`
	Name         string    `json:"name"`
	Plan         string    `json:"plan"` // e.g. "free", "pro", "team", "enterprise"
	HasSub       bool      `json:"has_subscription"`
	ExpiresAt    time.Time `json:"expires_at"`
	ServerURL    string    `json:"server_url"`
}

Credentials represents authenticated developer credentials for Nimbus Cloud.

func FetchProfile

func FetchProfile(creds *Credentials) (*Credentials, error)

FetchProfile queries the Nimbus Cloud API to verify the token and get the latest profile.

func LoadCredentials

func LoadCredentials() (*Credentials, error)

LoadCredentials loads stored credentials from ~/.nimbus/auth.json.

func Login

func Login(ctx *cli.Context, serverURL string) (*Credentials, error)

Login performs the browser-based OAuth authorization flow with Nimbus Cloud.

func (*Credentials) IsExpired

func (c *Credentials) IsExpired() bool

IsExpired reports whether the access token has expired.

Jump to

Keyboard shortcuts

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