/api/system/shutdown

POST

Delete the file-decryption password from RAM, then gracefully shut down the core. When a user logs out, nothing decryptable may remain in memory — so logging out and exiting the program are the same operation.

POST http://localhost:8080/api/system/shutdown
⚠️ Renamed endpoint

This endpoint replaces /api/system/logout. Unlike the old logout, it does not leave the core running: the response is sent, then the core stops its background workers, zeroes the key, and exits. The GUI should exit after calling it.

Description

In order, the endpoint:

  1. Overwrites the 32-byte derived key in RAM with zeroes.
  2. Sends the JSON response below.
  3. Stops the HTTP server loop and runs the core's full shutdown sequence — background workers are stopped, databases closed, remaining key material zeroed — and the process exits.

No coin file on disk is modified or deleted. Encrypted files stay encrypted; the next start of the core will require the password again (the startup encryption-status probe tells the GUI whether to prompt).

Why shutdown, not just "clear the key"?

Decrypted coin data may exist in process memory (caches, buffers) beyond the key itself. Exiting the process is the only reliable way to guarantee all of it is gone. A user who wants to keep working simply loads the password again on next start.

⚠️ In-flight work

Avoid calling this while a long task (deposit, encryption run, transfer) is in progress — the GUI should wait for running tasks to finish or warn the user first. Bulk encrypt/decrypt runs are safe against this: the logout revokes their write authority, so an in-flight run stops cleanly (its task reports failed: authority revoked — logout during run) rather than writing with a cleared key; re-running after the next login finishes the job.

Parameters

None. POST with an empty body. GET is rejected with 405.

Response

Success — 200 OK

JSON Response (sent before the process exits)
{
  "command": "shutdown",
  "success": true,
  "message": "Password deleted from RAM. Core is shutting down.",
  "key_set": false,
  "key_state": "none"
}

After this response the connection closes and the port stops accepting requests. Treat any subsequent connection failure as expected.

Example Usage

curl -X POST "http://localhost:8080/api/system/shutdown"
// GUI log-out flow: shut the core down, then exit the GUI.
await fetch('http://localhost:8080/api/system/shutdown', { method: 'POST' });
window.close(); // or app.quit() in Electron
import requests
requests.post('http://localhost:8080/api/system/shutdown')
# The core process exits after responding.

Related Endpoints