← #134 Add CLI foundation with encrypt, upload, download, list, and delete

#101 Add automatic token refresh using refresh_jwt on expired sessions

closed medium · sable · 2026-03-02 23:37 · closed 2026-03-02 23:37 · feature · Phase 1: CLI Foundation

Comments — 1

sable note 2026-03-02 23:37

Supersedes #33 (closed as duplicate). When send_checked gets an ExpiredToken error (400), automatically call com.atproto.server.refreshSession with the refresh_jwt, update the in-memory session + persisted session.json, then retry the original request. This goes in XrpcClient.send_checked in opake-core/src/client.rs. The tricky part: XrpcClient needs interior mutability for the session (RefCell or similar) since send_checked takes &self. Also need to update the CLI's session.json on disk after refresh — either a callback/hook or the CLI checks after each command. Tests via MockTransport: (1) expired→refresh→retry succeeds, (2) expired→refresh fails→propagate error, (3) non-expired errors pass through unchanged.

Generated 2026-03-03 02:53 UTC