Skip to content

refactor: tear out CLI business logic into SDK and http infra crates#35

Merged
bordumb merged 11 commits intomainfrom
fn-31
Mar 6, 2026
Merged

refactor: tear out CLI business logic into SDK and http infra crates#35
bordumb merged 11 commits intomainfrom
fn-31

Conversation

@bordumb
Copy link
Contributor

@bordumb bordumb commented Mar 6, 2026

No description provided.

bordumb added 11 commits March 6, 2026 17:10
Remove duplicated build_device_context() in authorization.rs,
inline context construction in sign.rs, and build_sdk_context()
in init.rs. Replace all three with a single build_auths_context()
factory in factories/storage.rs that always uses
get_platform_keychain_with_config for consistent env config handling.
Add load_device_signing_material() to auths-sdk::pairing that loads the
controller identity, resolves the signing key alias, decrypts via the
injected passphrase provider, and derives DeviceSigningMaterial.

Replace inline keychain/key-parsing block in join.rs with a single call;
join.rs now builds AuthsContext with CliPassphraseProvider so the prompt
stays at the presentation boundary.

Also thread env_config through handle_join_lan → handle_join so LAN mode
uses the correct auths home directory.
…RegistryClaimClient port traits + PlatformError (fn-31.5)

Define three platform claim port traits in auths-sdk::ports::platform and
add PlatformError to auths-sdk::error with RFC 8628 status variants
(AuthorizationPending, SlowDown, AccessDenied, ExpiredToken) plus
Network wrapping auths-core::NetworkError.
…egistryClaimClient (fn-31.6)

Move PlatformError and platform port traits from auths-sdk to auths-core
(same circular-dep avoidance pattern as PairingRelayClient) so auths-infra-http
can implement them without creating an auths-id/witness-client cycle.

Implement three HTTP adapters in auths-infra-http:
- HttpGitHubOAuthProvider: RFC 8628 device flow with slow_down backoff (+5s per §3.5)
  Uses tokio::time::timeout(expires_in) to avoid banned Utc::now() call
- HttpGistPublisher: publishes claim proofs as public GitHub Gists
- HttpRegistryClaimClient: submits claims to /v1/identities/{did}/claims

poll_for_token takes expires_in: Duration (not DateTime) to avoid clock calls.
Add reqwest/form feature to auths-infra-http Cargo.toml.
auths-sdk::ports::platform and auths-sdk::error re-export from auths-core.
…ces/ (fn-31.7)

Add auths-sdk::workflows::platform with:
- PlatformClaim struct (promoted from services/platform_claim.rs)
- create_signed_platform_claim() with injected now: DateTime<Utc> (fixes Utc::now() violation)
- claim_github_identity() async orchestrator (device flow → claim → gist → registry)

Rewrite commands/id/claim.rs as thin wrapper (no HTTP, no crypto, no signing inline).
Update commands/init.rs prompt_platform_verification() to use port implementations directly.
Remove http_client param from handle_id() (no longer needed after claim.rs migration).
Delete crates/auths-cli/src/services/ entirely.
Add ArtifactPublishConfig, ArtifactPublishResult, ArtifactPublishError,
and publish_artifact<R: RegistryClient>() to auths-sdk workflows.
Add HttpRegistryClient::new_with_timeouts() for configurable timeouts.
Rewrite CLI publish.rs as thin wrapper; remove transmit_publish().
Add git_integration workflow module to auths-sdk with compute_allowed_signers(),
format_allowed_signers_file(), public_key_to_ssh(), and AllowedSignerEntry.
Rewrite CLI git.rs and init_helpers.rs to delegate domain logic to SDK;
file writing, hook installation, and git config remain in CLI.
Remove tokio-tungstenite, futures-util, json-canon, ssh-key from CLI
Cargo.toml — all migrated to auths-infra-http or auths-sdk.
Remove unused http_client field from CliConfig and delete factories/network.rs.
@bordumb bordumb self-assigned this Mar 6, 2026
@vercel
Copy link

vercel bot commented Mar 6, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
auths Ready Ready Preview, Comment Mar 6, 2026 6:27pm

@bordumb bordumb changed the title Fn 31 refactor: tear out CLI business logic into SDK and http infra crates Mar 6, 2026
@bordumb bordumb merged commit d42690b into main Mar 6, 2026
8 checks passed
@bordumb bordumb deleted the fn-31 branch March 6, 2026 18:32
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