package agent

import (
	"net/http"
	"strings"
)

type keyChecker struct {}

func (a *keyChecker) check(c *client, r *http.Request) bool {
	if c.authenticated {
		return true
	}
	if apikey, ok := r.Header["X-Api-Key"]; ok {
		if len(apikey) > 0 && strings.HasPrefix(apikey[0], "simpletest2025_") {
			c.setApiKey(apikey[0])
			return true
		}
	}
	return false
}