/api/system/encryption-status

GET

Lightweight probe used by clients to decide whether to prompt the user for a login password.

Description

Reports two facts about the running server:

  • key_set — Has the user logged in this session? (Has /api/system/login already been called and is the derived key still in memory?)
  • encrypted_files_exist — Are there any .bin files in the registered wallets' Bank or Fracked folders whose on-disk header marks them as encrypted?

From those two facts the server derives login_required: true if encrypted files exist AND no key is set (the user must log in before any encrypted-coin operation can succeed). The client can branch on login_required instead of running its own scan.

Use this before login

This endpoint is the recommended first call for a fresh client. It tells you whether the user even needs a password prompt — many users will see encrypted_files_exist: false and can skip the login step entirely.

Parameters

None.

Response

Success — 200 OK

No encrypted files yet, no login
{
  "command": "encryption-status",
  "success": true,
  "key_set": false,
  "encrypted_files_exist": false,
  "login_required": false
}
Encrypted files exist; user has not logged in yet
{
  "command": "encryption-status",
  "success": true,
  "key_set": false,
  "encrypted_files_exist": true,
  "login_required": true
}
User is logged in
{
  "command": "encryption-status",
  "success": true,
  "key_set": true,
  "encrypted_files_exist": true,
  "login_required": false
}

Response Fields

FieldTypeDescription
key_setbooltrue if a derived encryption key is currently held in memory (someone has logged in and not logged out).
encrypted_files_existbooltrue if at least one .bin file in any registered wallet's Bank or Fracked folder has encryption_type != 0 in its header.
login_requiredboolConvenience: encrypted_files_exist && !key_set. Branch on this in the client.

Decision table for clients

key_setencrypted_files_existlogin_requiredWhat the client should do
falsefalsefalseNo password is needed. Coin operations work in plaintext mode. The user MAY still log in to start encrypting future writes.
falsetruetruePrompt for password and POST to /api/system/login before any wallet operation.
trueanyfalseAlready logged in this session. Proceed.

Example Usage

curl "http://localhost:8080/api/system/encryption-status"
const res = await fetch('http://localhost:8080/api/system/encryption-status');
const s = await res.json();

if (s.login_required) {
  // show password prompt, then POST /api/system/login
} else if (!s.key_set && !s.encrypted_files_exist) {
  // optional: ask the user if they want to set a password now
}
import requests
s = requests.get('http://localhost:8080/api/system/encryption-status').json()
print(s)
# {'command': 'encryption-status', 'success': True,
#  'key_set': False, 'encrypted_files_exist': True, 'login_required': True}

Related Endpoints