login

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: MIT Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package login is doit's view of goclilogin: where the service is, which client this machine logs in as, and where its token and refresh lock live.

The Python doit wrote this machine's login, and still reads it for each unported verb. So each identifier below matches pyclilogin's for the product "doit": the config file, the keychain entry, the fallback token file and the refresh lock. Both sides then take one lock. After either side refreshes, the other reads the new token rather than replaying the rotated one.

Index

Constants

View Source
const KeyringService = "doit-cli"

KeyringService namespaces doit's entries in the OS keychain. It is a deployed identifier: renaming it orphans every stored token.

View Source
const Product = "doit"

Product names the config file's directory and the state directory.

Variables

View Source
var ErrNeedsLogin = errors.New("this machine is not logged in to doit's service; run `doit auth login`")

ErrNeedsLogin is a person's machine holding no token, which `doit auth login` fixes.

Functions

func Config

Config is the goclilogin view of a deployment.

StateDir is pyclilogin's, $XDG_STATE_HOME/doit, rather than goclilogin's default under the keyring service's name. Two directories would mean two refresh locks, and a refresh token rotated by one side would then fail on the other.

func DefaultClientID

func DefaultClientID() string

DefaultClientID is the client login names where neither the file nor --client-id does: doit-cli-<short hostname>.

func ForLogin

func ForLogin(ctx context.Context, api, clientID string) (goclilogin.Deployment, error)

ForLogin is the deployment `doit auth login` logs in to: the file's values, with whatever it lacks filled in from api, the service's metadata and clientID.

func Load

Load reads the service's deployment from the config file.

func Path

func Path() string

Path is where the config file goes, whether or not it exists.

func TokenSource

TokenSource is where every request's token comes from: the config file's token_command where it sets one, else the token this machine logged in for.

Types

This section is empty.

Jump to

Keyboard shortcuts

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