Repository navigation
Description
What to build
- New command group
gpg-keyininternal/copiacmd/root.go. gpg-key list(aliasls):GET /user/gpg_keys, all pages. Columns EMAIL (the key's emails joined with,), KEY ID, PUBLIC KEY (cut on a terminal), ADDED, EXPIRES (Neveror a date on a terminal, RFC3339 without one).--json id,key_id,primary_key_id,emails,public_key,created_at,expires_at,verified,can_sign. No keys:no GPG keys present in the Copia account.gpg-key add [<key-file>] [-s/--signature <file>](decision G1):POST /user/gpg_keyswitharmored_public_keyand, with--signature,armored_signature(a detached armored signature over the token ofGET /user/gpg_key_token). The key file and the signature file may not both be-. Success:GPG key added to your account.- Gitea's 422 for a duplicate key ID becomes gh's
the key already exists in your account, exit 1. Content without-----BEGINgets gh's armored-format hint withcopia-cli. Gitea's 404 for a key without a verified email is shown with a hint to sign the token with--signature(the token is printed as Gitea gives it: it is no secret and expires in minutes). gh's-t/--titleis left out (Gitea keys have no title). - The help and
docs/parity.mdshow the signature route:copia-cli api user/gpg_key_token | gpg -a --detach-sig > sig.asc, thencopia-cli gpg-key add key.asc --signature sig.asc. - Key fixture: the GPG part.
gpgfrom the runner with a temporaryGNUPGHOME, user IDit-run-<time>-<suffix>, added with the signature route. The stale sweep reads a key's user ID from itspublic_keywithgpg --show-keysand deletes only keys whose user ID has that form; unit tests of that user ID guard without a build tag.CLAUDE.mdnames the GPG part of the key fixture rule.
Follow gh's flags and messages as gh prints them without a terminal (upstream cli/cli) within the copia-cli conventions: a package per subcommand under pkg/cmd/<group>/<sub>/, raw net/http through cmdutil.NewHTTPClient(), -R/--repo and --host as today, success lines on stdout also without a terminal, warnings on stderr, --json/--jq/--template on every list with the API's snake_case field names, no interactive prompts (every delete and remove requires --yes), table-driven unit tests with httpmock and iostreams.Test(). A key file argument - (or no argument with stdin not a terminal) reads stdin. Gitea's error messages are shown as Gitea words them, with the HTTP status. copia-cli never prints or logs a key file's content in an error.
Stop rule (R6): if the first integration run shows a key route answering 404 (feature disabled) or a 403 naming a missing token scope (write:user), stop with the evidence (status code and Gitea's message, never a key, login or token) and set the slice blocked for the Lead, who brings the choice to the owner. The scope does not change silently.
This slice gets a security review.
Files: pkg/cmd/gpgkey/gpgkey.go, pkg/cmd/gpgkey/list/, pkg/cmd/gpgkey/add/, internal/copiacmd/root.go, test/integration/gpgkey_test.go, test/integration/keys_test.go, test/integration/keys_unit_test.go, CLAUDE.md, CHANGELOG.md, docs/parity.md, docs/site/manual/.
Acceptance criteria
- Unit tests cover list,
--json, add with and without--signature, stdin, both files-, a duplicate key, content that is not armored and a key without a verified email. - Unit tests cover the sweep's user ID guard for GPG keys.
- Integration test: generate a key with
gpg, sign the token, add it with--signature,gpg-key listshows it verified (byte-count helpers); the test never reads the account's email. horde-dev run go test ./...andhorde-dev run golangci-lint run ./...pass.horde-dev run go run script/gen-docs.goleaves no diff (the generated manual underdocs/site/manualis committed).CHANGELOG.mdhas an entry underUnreleased(Added);docs/parity.mdhas the slice's rows, its section text and the counts at the bottom updated.- Codecov
codecov/patch(80%) andcodecov/projectare green. - The PR's
integrationjob is green against live Copia. The integration test follows the no-logging guard oftest/workflows: not.Log/t.Logf, output checked only through the byte-count helpers oftest/integration/helpers_test.go, testify calls with literal messages only; no key, title, login or email in a passing test's output. Deploy keys and collaborators live in the run repository; user SSH and GPG keys come from the key fixture of slice 1 (generated in the test, title or user IDit-run-<base36 time>-<suffix>), never a fixed key or repository. Each test generates its own key: Gitea refuses one key as both a user key and a deploy key.
Blocked by
#47 (every slice of this epic changes CHANGELOG.md, docs/parity.md and the generated manual, so they run as one chain). Branch from epic/481-keys-and-access; the PR goes into it.
Part of the keys and access epic planned in the Horde (epic epic/481-keys-and-access, slice 3 of 8).
Activity
q-horde commentedon Nov 16, 2026
Fixed in epic/481-keys-and-access by 6c7c503 (PR #488).