Files
regent/data/resources/ui/keys.blp
raucao 969154d790 keys: set the vault passphrase before the first key
The passphrase used to be set as a side effect of adding the first
identity key, in the same dialog. Split it into a first-run "Set up your
vault" step, so the first key afterwards only *checks* the passphrase,
and make the three forms HIG action dialogs that stay open on error.

A passphrase with no keys is now representable: keys.json gains an
optional NIP-49 `verifier` (a fixed 32-byte constant, so it round-trips
through EncryptedSecretKey). has_vault() accepts it, set_passphrase
writes it (only while keyless — that is also the "forgot it" reset, which
loses nothing), unlock and verify_passphrase check it, and add_user_key
clears it once a key is stored, so a keyed vault is byte-for-byte the old
shape. change_passphrase re-encrypts it too. A malformed verifier is
dropped on load rather than quarantining the file. The version stays 1:
serde ignores the unknown field, so an older Regent reads a
verifier-only vault as empty and its next add drops the verifier —
accepted, no keys were lost.

Setup/Create/Import are now plain AdwDialog action dialogs: the action
starts insensitive and is re-evaluated on every keystroke, which also
marks the offending row with libadwaita's `.error` class, so a too-short
or mismatched passphrase can never be submitted (no error dialog at all).
Only an unknowable error — a wrong vault passphrase — is shown, as a
toast inside the dialog, which stays open and keeps the input. Return
submits, the first field takes initial focus, and closing wipes the
fields (L5). An AdwAlertDialog cannot do this: it always closes when a
response is activated.

The Identities window is 460 wide so its dialogs present as centered
floating cards instead of sheets docked to the bottom edge (libadwaita
switches below 450px), and the dialog footer is equal-width buttons like
an alert dialog's response area.
2026-11-30 15:28:33 +04:00

17 lines
451 B
Plaintext

using Gtk 4.0;
using Adw 1;
Adw.ApplicationWindow keys_window {
title: "Identities";
// Wider than libadwaita's 450px bottom-sheet threshold (`max-width: 450px`),
// so dialogs parented to this window present as centered floating cards rather
// than sheets docked to the bottom edge. See `adw-dialog.c`.
default-width: 460;
default-height: 560;
content: Adw.ToolbarView toolbar_view {
[top]
Adw.HeaderBar header_bar {}
};
}