porting all github actions from bluesky-social/indigo to tangled CI

vendor in password auth req/resp schemas

Changed files
+32 -5
atproto
+32 -5
atproto/client/password_auth.go
··· 8 8 "strings" 9 9 "sync" 10 10 11 - comatproto "github.com/bluesky-social/indigo/api/atproto" 12 11 "github.com/bluesky-social/indigo/atproto/identity" 13 12 "github.com/bluesky-social/indigo/atproto/syntax" 14 13 ) ··· 43 42 } 44 43 } 45 44 45 + type createSessionRequest struct { 46 + //AllowTakendown *bool `json:"allowTakendown,omitempty" cborgen:"allowTakendown,omitempty"` 47 + AuthFactorToken *string `json:"authFactorToken,omitempty" cborgen:"authFactorToken,omitempty"` 48 + // identifier: Handle or other identifier supported by the server for the authenticating user. 49 + Identifier string `json:"identifier" cborgen:"identifier"` 50 + Password string `json:"password" cborgen:"password"` 51 + } 52 + 53 + type createSessionResponse struct { 54 + AccessJwt string `json:"accessJwt" cborgen:"accessJwt"` 55 + Active *bool `json:"active,omitempty" cborgen:"active,omitempty"` 56 + Did string `json:"did" cborgen:"did"` 57 + //Email *string `json:"email,omitempty" cborgen:"email,omitempty"` 58 + //EmailAuthFactor *bool `json:"emailAuthFactor,omitempty" cborgen:"emailAuthFactor,omitempty"` 59 + //EmailConfirmed *bool `json:"emailConfirmed,omitempty" cborgen:"emailConfirmed,omitempty"` 60 + //Handle string `json:"handle" cborgen:"handle"` 61 + RefreshJwt string `json:"refreshJwt" cborgen:"refreshJwt"` 62 + Status *string `json:"status,omitempty" cborgen:"status,omitempty"` 63 + } 64 + 65 + type refreshSessionResponse struct { 66 + AccessJwt string `json:"accessJwt" cborgen:"accessJwt"` 67 + Active *bool `json:"active,omitempty" cborgen:"active,omitempty"` 68 + Did string `json:"did" cborgen:"did"` 69 + //Handle string `json:"handle" cborgen:"handle"` 70 + RefreshJwt string `json:"refreshJwt" cborgen:"refreshJwt"` 71 + Status *string `json:"status,omitempty" cborgen:"status,omitempty"` 72 + } 73 + 46 74 func (a *PasswordAuth) DoWithAuth(c *http.Client, req *http.Request, endpoint syntax.NSID) (*http.Response, error) { 47 75 accessToken, refreshToken := a.GetTokens() 48 76 req.Header.Set("Authorization", "Bearer "+accessToken) ··· 138 166 return eb.APIError(resp.StatusCode) 139 167 } 140 168 141 - var out comatproto.ServerRefreshSession_Output 169 + var out refreshSessionResponse 142 170 if err := json.NewDecoder(resp.Body).Decode(&out); err != nil { 143 171 return err 144 172 } ··· 219 247 func LoginWithPasswordHost(ctx context.Context, host, username, password, authToken string, cb RefreshCallback) (*APIClient, error) { 220 248 221 249 c := NewAPIClient(host) 222 - reqBody := comatproto.ServerCreateSession_Input{ 250 + reqBody := createSessionRequest{ 223 251 Identifier: username, 224 252 Password: password, 225 253 } ··· 227 255 reqBody.AuthFactorToken = &authToken 228 256 } 229 257 230 - // TODO: copy/vendor in session objects 231 - var out comatproto.ServerCreateSession_Output 258 + var out createSessionResponse 232 259 if err := c.Post(ctx, syntax.NSID("com.atproto.server.createSession"), &reqBody, &out); err != nil { 233 260 return nil, err 234 261 }