account

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

create.go — `drift account create`. Two-step signup:

  1. Initiate — POST /signup/initiate with {username, password, email}. Password travels in plaintext over TLS; the auth service bcrypts on receipt before persisting. The CLI does NOT bcrypt — that keeps signup symmetric with login (which has always sent plaintext) and lets the server enforce its own password rules on the actual plaintext rather than on a hash.
  2. Verify — user enters the 6-digit OTP from email, CLI POSTs /signup/verify, server materialises the account and returns the JWT pair.

Password length and username shape are validated client-side as a UX nicety (so a typo doesn't round-trip the email-OTP step before failing). The server validates the same rules on receipt.

login.go — `drift account login`. POSTs `{username, password, device_id}` to /login; on success, persists the JWT pair to `~/.drift/session.json` (mode 0600). The device_id is a stable per-workstation random ID (see common/session.go :: GetOrCreateDeviceID) — refresh tokens are bound to it, so a stolen session.json without the matching device_id can't refresh.

Three ways to supply the password:

  • Interactive (default) — `drift account login` prompts for it with terminal echo disabled.
  • --password-stdin — `echo $PASS | drift account login -u alice --password-stdin`. The password never appears as a process argument; doesn't show up in `ps`, shell history, or process-listing logs. The pattern gh / docker login / kubectl / doctl / op all use. Recommended for CI.
  • --password (-p) — kept for backward compatibility but prints a deprecation warning. The password ends up in shell history and `ps` output. Migrate to --password-stdin.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DoLogin

func DoLogin(username, password string)

func FetchUsage

func FetchUsage() (usageResponse, error)

FetchUsage calls GET /ops/plan/usage and returns the parsed response.

func GetAccountCmd

func GetAccountCmd() *cobra.Command

GetAccountCmd returns the "drift account" command group. Subcommands: signup, login.

func GetCreateCmd

func GetCreateCmd() *cobra.Command

func GetLoginCmd

func GetLoginCmd() *cobra.Command

func GetPlanCmd

func GetPlanCmd() *cobra.Command

GetPlanCmd returns the "drift plan drift.yaml" command, which runs a pre-flight check of a manifest against the user's current plan quota.

func PrintUsage

func PrintUsage(u usageResponse)

PrintUsage is shared with GetAccountCmd.

Types

This section is empty.

Jump to

Keyboard shortcuts

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