diff --git a/README.md b/README.md index 6cc1d1a..0668f9f 100644 --- a/README.md +++ b/README.md @@ -994,7 +994,7 @@ difficulty is advertised via `GET /api/v1/server` in the `hashcash_bits` field. **Request Body:** ```json -{"nick": "alice", "hashcash": "1:20:260310:neoirc::3a2f1"} +{"nick": "alice", "pow_token": "1:20:260310:neoirc::3a2f1"} ``` | Field | Type | Required | Constraints | @@ -1030,7 +1030,7 @@ difficulty is advertised via `GET /api/v1/server` in the `hashcash_bits` field. ```bash TOKEN=$(curl -s -X POST http://localhost:8080/api/v1/session \ -H 'Content-Type: application/json' \ - -d '{"nick":"alice","hashcash":"1:20:260310:neoirc::3a2f1"}' | jq -r .token) + -d '{"nick":"alice","pow_token":"1:20:260310:neoirc::3a2f1"}' | jq -r .token) echo $TOKEN ``` diff --git a/internal/cli/api/types.go b/internal/cli/api/types.go index 7a8714b..b9ae32e 100644 --- a/internal/cli/api/types.go +++ b/internal/cli/api/types.go @@ -5,7 +5,7 @@ import "time" // SessionRequest is the body for POST /api/v1/session. type SessionRequest struct { Nick string `json:"nick"` - Hashcash string `json:"hashcash,omitempty"` + Hashcash string `json:"pow_token,omitempty"` //nolint:tagliatelle } // SessionResponse is the response from session creation. diff --git a/internal/handlers/api.go b/internal/handlers/api.go index bdfecb8..9e87aa7 100644 --- a/internal/handlers/api.go +++ b/internal/handlers/api.go @@ -147,7 +147,7 @@ func (hdlr *Handlers) handleCreateSession( ) { type createRequest struct { Nick string `json:"nick"` - Hashcash string `json:"hashcash,omitempty"` + Hashcash string `json:"pow_token,omitempty"` //nolint:tagliatelle } var payload createRequest diff --git a/web/src/app.jsx b/web/src/app.jsx index c2eb2db..2bea255 100644 --- a/web/src/app.jsx +++ b/web/src/app.jsx @@ -146,7 +146,7 @@ function LoginScreen({ onLogin }) { } const reqBody = { nick: nick.trim() }; if (hashcashStamp) { - reqBody.hashcash = hashcashStamp; + reqBody.pow_token = hashcashStamp; } const res = await api("/session", { method: "POST",