rename JSON field 'hashcash' to 'pow_token' in API request body
All checks were successful
check / check (push) Successful in 2m12s

This commit is contained in:
user
2026-03-10 10:44:02 -07:00
parent 0d563adf31
commit 49517e754a
4 changed files with 5 additions and 5 deletions

View File

@@ -994,7 +994,7 @@ difficulty is advertised via `GET /api/v1/server` in the `hashcash_bits` field.
**Request Body:** **Request Body:**
```json ```json
{"nick": "alice", "hashcash": "1:20:260310:neoirc::3a2f1"} {"nick": "alice", "pow_token": "1:20:260310:neoirc::3a2f1"}
``` ```
| Field | Type | Required | Constraints | | Field | Type | Required | Constraints |
@@ -1030,7 +1030,7 @@ difficulty is advertised via `GET /api/v1/server` in the `hashcash_bits` field.
```bash ```bash
TOKEN=$(curl -s -X POST http://localhost:8080/api/v1/session \ TOKEN=$(curl -s -X POST http://localhost:8080/api/v1/session \
-H 'Content-Type: application/json' \ -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 echo $TOKEN
``` ```

View File

@@ -5,7 +5,7 @@ import "time"
// SessionRequest is the body for POST /api/v1/session. // SessionRequest is the body for POST /api/v1/session.
type SessionRequest struct { type SessionRequest struct {
Nick string `json:"nick"` Nick string `json:"nick"`
Hashcash string `json:"hashcash,omitempty"` Hashcash string `json:"pow_token,omitempty"` //nolint:tagliatelle
} }
// SessionResponse is the response from session creation. // SessionResponse is the response from session creation.

View File

@@ -147,7 +147,7 @@ func (hdlr *Handlers) handleCreateSession(
) { ) {
type createRequest struct { type createRequest struct {
Nick string `json:"nick"` Nick string `json:"nick"`
Hashcash string `json:"hashcash,omitempty"` Hashcash string `json:"pow_token,omitempty"` //nolint:tagliatelle
} }
var payload createRequest var payload createRequest

View File

@@ -146,7 +146,7 @@ function LoginScreen({ onLogin }) {
} }
const reqBody = { nick: nick.trim() }; const reqBody = { nick: nick.trim() };
if (hashcashStamp) { if (hashcashStamp) {
reqBody.hashcash = hashcashStamp; reqBody.pow_token = hashcashStamp;
} }
const res = await api("/session", { const res = await api("/session", {
method: "POST", method: "POST",