···2424// TODO:
2525//func NewRefreshAuth(pdsHost, accountIdentifier, password string) (*RefreshAuth, error) {
26262727-func (a *RefreshAuth) DoWithAuth(httpReq *http.Request, httpClient *http.Client) (*http.Response, error) {
2828- httpReq.Header.Set("Authorization", "Bearer "+a.AccessToken)
2727+func (a *RefreshAuth) DoWithAuth(req *http.Request, c *http.Client) (*http.Response, error) {
2828+ req.Header.Set("Authorization", "Bearer "+a.AccessToken)
2929 // XXX: check response. if it is 403, because access token is expired, then take a lock and do a refresh
3030 // TODO: when doing a refresh request, copy at least the User-Agent header from httpReq, and re-use httpClient
3131- return httpClient.Do(httpReq)
3232-}
3333-3434-// Admin bearer token auth does not involve an account DID
3535-func (a *RefreshAuth) AccountDID() syntax.DID {
3636- return a.DID
3131+ return c.Do(httpReq)
3732}
38333934// updates the client with the new auth method
+2-7
atproto/client/service_auth.go
···2727 }
2828}
29293030-func (a *ServiceAuth) DoWithAuth(req *http.Request, httpClient *http.Client) (*http.Response, error) {
3030+func (a *ServiceAuth) DoWithAuth(req *http.Request, c *http.Client) (*http.Response, error) {
3131 // TODO: detect audience from request headers (atproto-proxy)
3232 // TODO: extract endpoint (LXM) from request
33333434 thing := ""
3535 req.Header.Set("Authorization", "Bearer "+thing)
3636- return httpClient.Do(req)
3737-}
3838-3939-// Admin bearer token auth does not involve an account DID
4040-func (a *ServiceAuth) AccountDID() syntax.DID {
4141- return a.Issuer
3636+ return c.Do(req)
4237}
···1212// API for clients which pull data from the public atproto network.
1313//
1414// Implementations of this interface might resolve PDS instances for DIDs, and fetch data from there. Or they might talk to an archival relay or other network mirroring service.
1515-type SyncClient interface {
1515+type NetworkClient interface {
1616 // Fetches record JSON, without verification or validation. A version (CID) can optionally be specified; use empty string to fetch the latest.
1717 // Returns the record as JSON, and the CID indicated by the server. Does not verify that the data (as CBOR) matches the CID, and does not cryptographically verify a "proof chain" to the record.
1818 GetRecordJSON(ctx context.Context, aturi syntax.ATURI, version syntax.CID) (*json.RawMessage, *syntax.CID, error)
···2525 GetRepoCAR(ctx context.Context, did syntax.DID, since string) (*io.Reader, error)
26262727 // Fetches indicated blob. Does not validate the CID. Returns a reader (which calling code is responsible for closing).
2828- GetBlob(ctx context.Context, did syntax.DID, cid syntax.CID) (*io.Reader, error)
2929- CheckAccountStatus(ctx context.Context, did syntax.DID) (*AccountStatus, error)
2828+ GetBlob(ctx context.Context, did syntax.DID, cid syntax.CID) (*io.ReadCloser, error)
2929+ GetAccountStatus(ctx context.Context, did syntax.DID) (*AccountStatus, error)
3030}
31313232// XXX: type alias to codegen? or just copy? this is protocol-level