Skip to content

pkg: device-flow steps, repository files and manual signing sets for embedding programs - #41

Merged
Interlap01 merged 2 commits into
mainfrom
lib/app-signing-setup
Oct 10, 2026
Merged

Interlap01 merged 2 commits into
mainfrom
lib/app-signing-setup

Conversation

@Interlap01

Copy link
Copy Markdown
Collaborator

A program with its own UI (the MobAI desktop app's signing step) could not reuse the GitHub login, read or write builder.json without a checkout, or take a user's own certificate and profiles the way builder signing setup --certificate --profile does. This exposes those three pieces through pkg/.

Library

  • auth: RequestDeviceCode and PollForToken, the two halves of Login, exported. The token comes back unstored so the caller keeps it in its own secret store.
  • github: ListRepositories (pushed first, every page), ListBranches, GetFile and PutFile through the contents API, with ErrFileNotFound so "no builder.json yet" is distinguishable from a failure.
  • signing: SetupOptions.SaveConfig lets the caller persist builder.json itself (through the API, say); nil keeps writing it in the working directory. SetupManual, ManualType and MatchExtensionProfiles are the manual half of signing setup, moved out of the CLI. BuildP12 is exported for a caller that holds a key and a certificate.

CLI

No behavior change. signing setup keeps its prompts and output; the manual path now calls SetupManual for its upload, profile and save steps, in the same order, and matchExtensionProfiles / manualSigningType delegate under their old names so the existing tests cover the move. Login still prints the code and stores the token as before. Setup and EnsureSecrets save builder.json exactly where they did.

Tests

internal/github/contents_test.go (pagination and query of the repo listing, base64 decoding and the 404 sentinel of GetFile, request body and path escaping of PutFile) and internal/signing/manual_test.go (upload and SaveConfig capture, failed upload still writes the profile, failed save, the nil-SaveConfig default, type and extension matching). Full suite passes with -race; gofmt and vet clean.

…embedding programs

A program with its own UI could not reuse the GitHub login, read or write
builder.json without a checkout, or take a user's own certificate and
profiles the way `builder signing setup --certificate --profile` does.

- auth: RequestDeviceCode and PollForToken are Login's two halves, exported.
  Login itself still prints the code and stores the token as before.
- github: ListRepositories, ListBranches, GetFile and PutFile (contents API),
  with ErrFileNotFound for a missing file.
- signing: SetupOptions.SaveConfig lets the caller persist builder.json;
  nil keeps writing it in the working directory. SetupManual, ManualType and
  MatchExtensionProfiles move the manual half of signing setup out of the
  CLI; the CLI calls them under its old names, so its prompts, output and
  tests are unchanged.
@Interlap01
Interlap01 force-pushed the lib/app-signing-setup branch from 064ddf5 to 8991a66 Compare October 10, 2026 19:45
@Interlap01
Interlap01 merged commit 17cb1c3 into main Oct 10, 2026
8 checks passed
@Interlap01
Interlap01 deleted the lib/app-signing-setup branch October 10, 2026 19:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant