Documentation
¶
Overview ¶
Package carry brings what the computer the user works on already has for git — its Git name and email, its GitHub CLI's and GitLab CLI's sign-ins — to a computer linked to it, and makes an SSH key there for git (ADR-113, .ai/26-server.md § Bringing sign-ins).
Two halves, one per side of the link:
- On the laptop, Offer says what there is to bring, read from files, no token's content (readiness.GitIdentity, GHSignedIn, GLabHosts); Read reads one item's values for one send, running `gh auth token` or `glab config get token` only then.
- On the linked computer, Apply sets an item that arrived — `git config --global`, `gh auth login --with-token` and `gh auth setup-git`, `glab auth login --stdin` — the token on the program's standard input, never in its arguments, a file or a terminal; Remove signs one out there again.
A token is held in memory for the one request it travels in, inside the end-to-end encrypted channel to the user's own computer (ADR-058, ADR-067). It is in no answer, log line, event, file or terminal on either side: errors are redacted before they leave this package.
Index ¶
Constants ¶
const ( WhatGit = "git" WhatGitHub = "github" WhatGitLab = "gitlab" // WhatSSHKey makes an Ed25519 key there and adds it to the forges // signed in there; nothing of the laptop's travels with it. WhatSSHKey = "ssh_key" )
What names one item.
const GitHubHost = "github.com"
GitHubHost is the only GitHub host carried: the checklist's GitHub row is github.com's.
Variables ¶
var ErrNothing = errors.New("this computer has nothing to bring for that")
ErrNothing is an item this computer does not have to bring.
Functions ¶
This section is empty.
Types ¶
type Env ¶
type Env struct {
GOOS string
Home string
Getenv func(string) string
Run Runner
// Hostname names this computer in an SSH key's comment and title.
Hostname string
}
Env is one side's view: where its files are, and how it runs programs.
type Identity ¶
Identity is a Git name and email. Not a secret: the screen shows it before and after it is set.
type Ledger ¶
type Ledger struct {
Path string
// contains filtered or unexported fields
}
Ledger is carried.json in the data directory: per computer id, what was brought there.
type Offer ¶
type Offer struct {
Git *Identity `json:"git,omitempty"`
GitHub *readiness.ForgeHost `json:"github,omitempty"`
GitLab []readiness.ForgeHost `json:"gitlab"`
}
Offer is what this computer can bring to another one. Never a token.
type Payload ¶
type Payload struct {
What string `json:"what"`
Name string `json:"name,omitempty"`
Email string `json:"email,omitempty"`
Host string `json:"host,omitempty"`
User string `json:"user,omitempty"`
Token string `json:"token,omitempty"`
}
Payload is one item in flight: what, and its values. Only ever inside the channel; Token is never logged, answered or written.
type Result ¶
type Result struct {
What string `json:"what"`
// Detail is one line: "Ada <ada@example.com>", "signed in as octo".
Detail string `json:"detail"`
// Added and Refused are the forges an SSH key was added to, and those
// that refused it (a token without the scope), each with why.
Added []string `json:"added,omitempty"`
Refused []string `json:"refused,omitempty"`
}
Result is what Apply did there, in words the laptop shows. Never a token.
type Runner ¶
Runner runs a program with stdin as its standard input and answers its standard output; a failure carries what it printed on standard error. The daemon's runs the login shell's PATH; tests swap it, so no test runs a real gh, glab, git or ssh-keygen.
type Sent ¶
type Sent struct {
What string `json:"what"`
Host string `json:"host,omitempty"`
Detail string `json:"detail"`
At int64 `json:"at"`
// Removed is when *Remove from <name>* signed it out there; an item
// removed is never brought again by itself.
Removed int64 `json:"removed,omitempty"`
// Error is the last automatic try's failure, so it is not tried again
// on every page open; a click tries again.
Error string `json:"error,omitempty"`
}
Sent is one item brought to a computer, as the laptop keeps it: what, for which host, the line the computer answered, when, and whether it was removed there since. Never a token.