feat: secure notes + password history + custom fields + quick-win bundle
Big feature trio
- Secure notes (kind='login'|'note') reusing the encrypted_password+iv
pipeline for the body. New sidebar entry, slideover variant (title +
multiline body), distinct card / table-view rendering, badge in name
column, copy-content button replacing the password copy on note rows.
- Password history: entries_password_history table keeps up to 20 prior
ciphertexts per entry. HandleUpdateEntry pushes the pre-update
encrypted_password into history ONLY when it actually differs from
the incoming one (JS reuses originalEncrypted bit-for-bit when the
plaintext is unchanged — avoids spamming history on title/folder edits).
GET /entries/{id}/history endpoint. Slideover modal lists versions
with mask/reveal/copy/revert. Master-pw rotation wipes history (old
ciphertext can't be decrypted with the new key).
- Custom fields: per-entry encrypted JSON array of {label, value,
is_secret}. Same crypto pipeline as the password. Slideover row UI
with label/value inputs, secret toggle (eye), copy, delete. Re-
encryption flows through bulk-import, change-master-password, and
duplicate.
Quick wins
- Cheatsheet overlay (press '?' or topbar button or Ctrl+K). Lists all
hotkeys + global / tray / card actions. SVG icons inline so the
cheatsheet matches the actual app glyphs (no emoji mismatch).
- Open URL button on entry cards: ShellExecute via cmd://app/open-url,
http(s) only, validates entry.site looks like a real hostname.
- Trash auto-purge: setting "Empty trash after N days" (never/7/30/90).
DELETE /entries/trash/old?days=N called at every unlock.
Favicon strategy
- Subdomains (chat.deepseek.com, app.X.com…) now try the SLD first
(deepseek.com.ico) before the full host. DDG often returns a generic
placeholder for subdomains that passes the byte threshold; the SLD-first
switch surfaces the real brand icon.
- Cap bumped 64 KB → 256 KB on all three sides (Delphi fetch, server
endpoint, JS upload). DDG sometimes serves the full-res asset.
UX polish
- Click-outside-slideover: stopPropagation everywhere it bites. Custom
fields buttons (add / delete / secret toggle / copy / eye) all stop
the click bubble so the document-level "close on outside click" handler
doesn't fire when rerender() detaches the target from the DOM.
- Native search-cancel button restyled: cyan accent X via mask-image,
cursor: pointer, breathing room before the Ctrl+K kbd chip.
- Password history modal: scrollable body, multiline wrapped passwords,
hover border highlight.
- Cheatsheet panel widened (560 → 720 px) so the descriptions no longer
ellipsis-clip.
- "+ New" topbar splits into a small dropdown: New login / New note.
- Notes show a "note" badge in table-view name column, italic
"Encrypted note" placeholder in the username column.
Internals
- duplicateEntry copies kind + custom_fields too (one-line forgotten
earlier).
- entries_password_history dropped on master-pw rotation — the old
ciphertexts are unrecoverable with the new key.
- bulk-import re-encryption path includes custom_fields.
CLAUDE.md
- "Entry payload — call sites à toucher ensemble" lists the 6 spots
to update when adding a new (en)crypted field. Notes the historical
miss of kind in duplicateEntry and custom_fields in the rotation +
duplicate.
Repo hygiene
- .gitattributes forces CRLF on Delphi sources (RAD Studio refuses LF).
text=auto for web frontend / docs, binary for .res / .exe / images.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -189,6 +189,25 @@ begin
|
||||
' created_at DATETIME DEFAULT CURRENT_TIMESTAMP,' +
|
||||
' FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE' +
|
||||
')');
|
||||
// Password history — keeps the last N versions of each entry's
|
||||
// encrypted_password + iv. Populated by HandleUpdateEntry before each
|
||||
// PUT overwrites the row; pruned to 20 entries per row after each insert.
|
||||
// kind mirrors vault_entries.kind so notes can be restored too.
|
||||
FConn.ExecSQL(
|
||||
'CREATE TABLE IF NOT EXISTS entries_password_history (' +
|
||||
' id INTEGER PRIMARY KEY AUTOINCREMENT,' +
|
||||
' entry_id INTEGER NOT NULL,' +
|
||||
' user_id INTEGER NOT NULL,' +
|
||||
' encrypted_password TEXT NOT NULL,' +
|
||||
' iv TEXT NOT NULL,' +
|
||||
' kind TEXT NOT NULL DEFAULT ''login'',' +
|
||||
' changed_at DATETIME DEFAULT CURRENT_TIMESTAMP,' +
|
||||
' FOREIGN KEY (entry_id) REFERENCES vault_entries(id) ON DELETE CASCADE,' +
|
||||
' FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE' +
|
||||
')');
|
||||
FConn.ExecSQL(
|
||||
'CREATE INDEX IF NOT EXISTS idx_history_entry ' +
|
||||
' ON entries_password_history(entry_id, changed_at DESC)');
|
||||
end;
|
||||
|
||||
function TPMDatabase.ColumnExists(const ATable, AColumn: string): Boolean;
|
||||
@@ -241,6 +260,17 @@ begin
|
||||
// sees the plaintext secret. NULL = no TOTP configured for this entry.
|
||||
AddColumnIfMissing('vault_entries', 'totp_secret', 'TEXT');
|
||||
AddColumnIfMissing('vault_entries', 'totp_iv', 'TEXT');
|
||||
// Entry kind: 'login' (default — site/user/encrypted_password/iv/totp)
|
||||
// or 'note' (free-text secure note — body stored in encrypted_password
|
||||
// + iv, site/username/totp_* unused). Legacy rows default to 'login'.
|
||||
AddColumnIfMissing('vault_entries', 'kind', 'TEXT DEFAULT ''login''');
|
||||
// Custom fields: opaque encrypted JSON array of
|
||||
// [{label, value, is_secret}, ...]
|
||||
// Same crypto pipeline as encrypted_password (AES-GCM with the vault
|
||||
// key). NULL = no custom fields configured. The server treats both
|
||||
// columns as opaque ciphertext + IV.
|
||||
AddColumnIfMissing('vault_entries', 'custom_fields', 'TEXT');
|
||||
AddColumnIfMissing('vault_entries', 'custom_fields_iv', 'TEXT');
|
||||
// Cached favicon as a base64 data URI (e.g. "data:image/png;base64,...").
|
||||
// Fetched on demand by the Delphi favicon proxy when the user opts in.
|
||||
// NULL = no icon cached → JS falls back to the first-letter avatar.
|
||||
|
||||
Reference in New Issue
Block a user