A container registry that uses the AT Protocol for manifest storage and S3 for blob storage. atcr.io
docker container atproto go
80
fork

Configure Feed

Select the types of activity you want to include in your feed.

remove unused code from credential-helper

-52
-52
cmd/credential-helper/main.go
··· 1 1 package main 2 2 3 3 import ( 4 - "bytes" 5 4 "encoding/json" 6 5 "fmt" 7 - "io" 8 - "net/http" 9 6 "os" 10 7 "path/filepath" 11 8 ··· 231 228 232 229 return nil 233 230 } 234 - 235 - // exchangeSessionForRegistryToken exchanges the session token for a registry JWT 236 - func exchangeSessionForRegistryToken(sessionToken, appViewURL string) (string, error) { 237 - // Call the AppView's /auth/exchange endpoint 238 - exchangeURL := fmt.Sprintf("%s/auth/exchange", appViewURL) 239 - 240 - reqBody := map[string]any{ 241 - "scope": []string{"repository:*:pull,push"}, 242 - } 243 - 244 - body, err := json.Marshal(reqBody) 245 - if err != nil { 246 - return "", fmt.Errorf("failed to marshal request: %w", err) 247 - } 248 - 249 - req, err := http.NewRequest("POST", exchangeURL, bytes.NewReader(body)) 250 - if err != nil { 251 - return "", fmt.Errorf("failed to create request: %w", err) 252 - } 253 - req.Header.Set("Content-Type", "application/json") 254 - req.Header.Set("Authorization", "Bearer "+sessionToken) 255 - 256 - client := &http.Client{} 257 - resp, err := client.Do(req) 258 - if err != nil { 259 - return "", fmt.Errorf("failed to call exchange endpoint: %w", err) 260 - } 261 - defer resp.Body.Close() 262 - 263 - if resp.StatusCode != http.StatusOK { 264 - // Read response body for debugging 265 - bodyBytes, _ := io.ReadAll(resp.Body) 266 - return "", fmt.Errorf("exchange failed with status %d: %s", resp.StatusCode, string(bodyBytes)) 267 - } 268 - 269 - var result struct { 270 - Token string `json:"token"` 271 - AccessToken string `json:"access_token"` 272 - } 273 - 274 - if err := json.NewDecoder(resp.Body).Decode(&result); err != nil { 275 - return "", fmt.Errorf("failed to decode response: %w", err) 276 - } 277 - 278 - if result.Token != "" { 279 - return result.Token, nil 280 - } 281 - return result.AccessToken, nil 282 - }