New internal/atproto package implements the atproto OAuth profile as a public client: handle/DID resolution with bidirectional verification, PDS and authorization-server metadata discovery, PAR + PKCE, ES256 DPoP proofs with server-nonce retry, and token exchange/refresh with sub verification. Sessions (tokens + DPoP key) are saved 0600. 'latha-auth atproto' collects the code via the existing deploy relay; 'latha-auth atproto-token' prints a refreshed access token.
1.6 KiB
1.6 KiB
latha-auth
Zero-localhost OAuth CLI for remote VMs authenticating against Gitea (git.site.latha.org), Zitadel (auth.site.latha.org), and AT Protocol (any PDS).
Commands
latha-auth gitea: Authenticates with Gitea via PKCE + thehttps://deploy.site.latha.org/oauth/callbackrelay, configurestea login(latha), and sets up git credentials.latha-auth k3s: Runs Zitadel OAuth 2.0 Device Code flow for K3s Headlamp (dash.latha.org,client_id=400047321930268787) and saves the token to~/.config/latha-auth/k3s-token.json(0600).latha-auth oidc --client-id <id> [--scope "..."] [--out <path>]: Generic Zitadel Device Code flow for anyauth.site.latha.orgservice.latha-auth atproto --identifier <handle|did> [--scope "..."] [--out <path>]: AT Protocol OAuth (PAR + PKCE + DPoP) as a public client, collecting the code via the same deploy relay. Saves the session — tokens plus the DPoP private key they are bound to — to~/.config/latha-auth/atproto-session.json(0600). One-time setup: host the output oflatha-auth atproto --print-client-metadataat the client_id URL (defaulthttps://deploy.site.latha.org/oauth/atproto-client-metadata.json, override with--client-idorLATHA_ATPROTO_CLIENT_ID).latha-auth atproto-token [--refresh] [--json]: Prints a valid access token from the saved session, refreshing in place when expired. Note tokens are DPoP-bound: consumers must sign per-request DPoP proofs with the session key, so this is for DPoP-aware tooling.
Install
go build -o ~/.local/bin/latha-auth ./cmd/latha-auth