Wallet API Auth and Security¶
How wrkz-wallet-api authenticates callers, and the wallet-state and view-only rules the middleware enforces before a handler runs.
Implementation: src/walletapi/ApiDispatcher.cpp, src/walletapi/ParseArguments.cpp
Authentication¶
Wallet API requires --rpc-password at startup.
Clients must send:
X-API-KEY: <rpc-password>
The server derives and compares a PBKDF2-HMAC-SHA256 hash of the supplied value.
Missing or invalid X-API-KEY returns 401.
CORS¶
When --enable-cors is set, response includes:
Access-Control-Allow-Origin: <configured value>Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, X-API-KEY
Wallet state and permission checks¶
Middleware enforces:
- Wallet must be open for most operational endpoints
- Wallet must be closed for open/create/import operations
- Some endpoints are blocked for view-only wallets
Common status codes:
401unauthorized403wrong wallet state400invalid request or restricted view-wallet operation
Auth Examples¶
Missing API key (401):
Valid API key:
Invalid API key (401):
CORS preflight: