Documentation
¶
Overview ¶
Package mapsauth is a thin client for auth.nw5w.com, the registration endpoint that issues per-device tokens for the Graywolf private map service. The package exists so handlers in pkg/webapi don't have to hand-roll JSON+timeout+error-mapping code, and so tests can swap in an httptest.Server via the BaseURL constructor argument.
Index ¶
Constants ¶
const DefaultBaseURL = "https://auth.nw5w.com"
DefaultBaseURL is the production registration endpoint. Override via NewClient when stubbing in tests.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the registration client. Construct via NewClient.
func NewClient ¶
NewClient returns a client pointed at baseURL. Pass DefaultBaseURL in production. The HTTP client has a 15-second total timeout — the auth worker is fast under normal load, and a slow server is more likely a routing problem than a real deferred response.
type Error ¶
type Error struct {
Status int `json:"-"`
Code string `json:"error"`
Message string `json:"message"`
}
Error wraps a non-2xx response from the auth server. Status holds the HTTP status; Code is the machine-readable error name from the response body (or a synthesized value for empty-body cases like 429); Message is the human-readable string the server returned and is intended to be surfaced to the user verbatim — it points them at https://github.com/chrissnell/graywolf/issues.
type RegisterResponse ¶
RegisterResponse is the success body emitted by POST /register.