webhooks and chirps by user id

This commit is contained in:
2025-03-13 22:47:03 +02:00
parent bad1d140ee
commit 66be0a2b40
13 changed files with 195 additions and 24 deletions

View File

@@ -96,3 +96,12 @@ func MakeRefreshToken() (string, error) {
token := hex.EncodeToString(key)
return token, nil
}
func GetAPIKey(headers http.Header) (string, error) {
auth := headers.Get("Authorization")
auth = strings.TrimPrefix(auth, "ApiKey ")
if auth == "" {
return "", errors.New("missing Authorization header")
}
return auth, nil
}