Skip to content
Docs

Keystore

Threat model

Encryption helps at rest; XSS, malware, and weak PINs remain critical risks.

Overview

Keystore reduces casual disk snooping; it does not make a compromised device or XSS-safe web app safe for hot wallets.

In scope (mitigated)

  • At-rest secrets on disk when encryption: true and PIN is strong
  • Accidental plaintext secret rows in SQLite / KV
  • The Gray3 Cloud API never receives seed phrases

Out of scope / residual risk

  • XSS on pages that can call keystore APIs or read localStorage after unlock
  • Device malware / rooted phones that scrape process memory while unlocked
  • Weak PINs — scrypt helps; short numeric PINs remain brute-forceable offline against a stolen DB
  • Plaintext metadata — addresses, labels, Monero sync cache reveal activity even when secrets are sealed
  • encryption: false — secrets stored plaintext (dev only)

Recommendations

FieldRequiredDescription
Node / desktopNoSQLite + strong password; OS file permissions on the DB path
MobileNoexpo-sqlite plus a strong PIN, or encryptionKey kept in Keychain / Keystore behind biometrics
WebNoSQLite web backend; lock on sign-out; strict CSP; keep keys out of extension content scripts
MoneroNogray.monero.syncConnection() carries your project secret key: use it only on your server, never in a browser or mobile app

Error codes

FieldRequiredDescription
unauthorizedNoLocked keystore or bad PIN — do not distinguish beyond UX needs
internalNoCorrupt master key / envelope — treat store as damaged
js
import { isGrayError } from "@gray3/core";
if (isGrayError(err) && err.code === "unauthorized") { /* re-prompt PIN */ }