Version: 1.0.0 Category: authentication Schema: JSON Schema Draft-07 Description: Authentication schemas for webapp, consensus network, and streaming services.
Webapp login request.
POST /api/auth/login| Field | Type | Required | Description |
|---|---|---|---|
| username | string | Yes | Player username |
| password | string | Yes | Player password |
Webapp login response.
| Field | Type | Required | Description |
|---|---|---|---|
| success | boolean | Yes | Login success status |
| message | string | No | Response message |
Webapp session data.
| Field | Type | Required | Format | Description |
|---|---|---|---|---|
| cookie | string | Yes | Session cookie (PHPSESSID) | |
| expires | string | No | date-time | Session expiration time |
| lastUsed | string | No | date-time | Last session usage time |
Consensus network account information.
| Field | Type | Required | Format | Description |
|---|---|---|---|---|
| address | string | Yes | blockchain-address | Account address |
| pub_key | object | No | Public key | |
| account_number | string | Yes | Account number | |
| sequence | string | Yes | Account sequence (nonce) |
Transaction signer information.
| Field | Type | Required | Sensitive | Description |
|---|---|---|---|---|
| address | string | Yes | No | Signer address (blockchain-address format) |
| privateKey | string | No | Yes | Private key (never expose in production) |
| publicKey | string | No | No | Public key |
| sequence | string | No | No | Current sequence number |
Signed transaction ready for submission.
| Field | Type | Required | Description |
|---|---|---|---|
| body | object | Yes | Transaction body |
| auth_info | object | Yes | Authentication information |
| signatures | array of string | Yes | Transaction signatures |
| Field | Type | Required | Description |
|---|---|---|---|
| messages | array | Yes | Transaction messages |
| memo | string | No | Transaction memo |
| Field | Type | Required | Description |
|---|---|---|---|
| signer_infos | array | Yes | Signer information |
| fee | object | Yes | Transaction fee |
The fee object:
| Field | Type | Description |
|---|---|---|
| amount | array | Fee amount |
| gas_limit | string | Gas limit |
NATS connection configuration.
| Field | Type | Required | Description |
|---|---|---|---|
| url | string | Yes | NATS server URL: nats://localhost:4222 or ws://localhost:1443 |
| protocol | string | Yes | Protocol, always NATS |
| transport | string | No | Transport protocol: tcp or WebSocket |
| authentication | object | No | NATS authentication (optional, see below) |
| Field | Type | Description |
|---|---|---|
| type | string | Authentication type: token or username_password |
| token | string | NATS token (if type is token) |
| username | string | NATS username (if type is username_password) |
| password | string | NATS password (if type is username_password). Sensitive. |
Complete authentication configuration covering all three services.
| Field | Type | Sensitive | Description |
|---|---|---|---|
| baseURL | string | No | Webapp base URL |
| username | string | No | Webapp username |
| password | string | Yes | Webapp password |
| session | WebappSession | No | Current session data |
| Field | Type | Description |
|---|---|---|
| rpcURL | string | RPC URL |
| apiURL | string | API URL |
| signer | TransactionSigner | Signer information |
Uses the NATSConnection structure defined above.
ID: webapp-login
Status: Needs Verification
Session-based authentication for webapp API.
Steps:
Cookie: header in subsequent requests.Error Handling:
| Code | Action |
|---|---|
| 401 | Session expired, re-authenticate |
| 403 | Invalid credentials or insufficient permissions |
ID: consensus-transaction
Status: Implemented
Transaction signing for consensus network.
Steps:
account.account.sequence for replay protection.signedTransaction.Error Handling:
| Code | Action |
|---|---|
| 400 | Invalid transaction format |
| 401 | Invalid signature |
| 500 | Network error, retry with backoff |
ID: nats-connection
Status: Implemented
NATS connection for GRASS streaming (authentication optional).
Steps:
structs.player.*, structs.planet.*).Error Handling:
| Error | Action |
|---|---|
| connection_failed | Retry with exponential backoff |
| authentication_failed | Check NATS credentials if authentication enabled |
ID: wallet-signature
Status: Planned
Wallet signature authentication (planned feature).
Steps:
This flow is planned but not yet implemented. See roadmap.md for status.
ID: api-key
Status: Planned
API key authentication (planned feature).
Steps:
X-API-Key: header in requests.This flow is planned but not yet implemented. See roadmap.md for status.
| Service | Status | Description | Implementation |
|---|---|---|---|
| Webapp | Implemented | Session-based authentication for webapp API | PHP Symfony application (structs-webapp). Main user-facing API. |
| Consensus | Implemented | Transaction signing required for all transactions | All transactions must be signed with private key |
| Streaming | Implemented | NATS authentication is optional | NATS connection works without authentication; optional if configured |
| Wallet Signature | Planned | Wallet signature authentication | Not yet implemented, see roadmap.md |
| API Key | Planned | API key authentication | Not yet implemented, see roadmap.md |
| OAuth | Planned | OAuth integration | Not yet implemented, see roadmap.md |
protocols/authentication.md - Complete authentication protocolprotocols/error-handling.md - Error handling for authenticationprotocols/streaming.md - NATS connection detailsroadmap.md - Planned authentication features