1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
//! Semantics for a secret input pre-filled with [`EXISTING_KEY_SENTINEL`].
//!
//! When a dialog opens on a provider that already has a stored key, the input
//! is seeded with the sentinel rather than the secret itself, so the key is
//! never rendered. That marker has to mean the same thing to everything that
//! looks at the field, and it did not: the renderer read it as "no key here"
//! while the save path read it as a value worth writing. The result was a
//! stored key that displayed as absent and was then overwritten with the
//! literal marker on the next save (#1039).
//!
//! One module, so both halves agree by construction:
//!
//! - [`is_configured`] — is a key set at all, stored or freshly typed? Drives
//! display.
//! - [`typed_secret`]: what did the user actually type, if anything? Drives
//! writes. The sentinel never survives this, alone or as a prefix.
//! - [`masked`] — what to show in the field, never the secret.
/// True when the field still carries the "a key is already stored" marker.
///
/// Prefix, not equality. Clearing on the first keystroke is best effort and was
/// missing on three voice fields, so a pre-filled field that is typed into can
/// hold `__EXISTING_KEY__<typed>`. An equality test reads that as a freshly
/// typed secret, which is how a real key ended up stored with the marker glued
/// to its front, a value that fails auth exactly like a wrong key with nothing
/// on screen to say why.
pub
/// The secret to persist, or `None` when the field says "leave what is on disk".
///
/// The only value a write may use. Strips a leading marker so the key typed
/// after it is kept rather than dropped, and returns `None` when nothing but
/// the marker (or whitespace) is left.
pub
/// Drop the seeded marker so an edit replaces the stored key instead of being
/// appended to it. Call before the first mutation of a secret input.
pub
/// True when a key exists for this provider, whether stored earlier or typed
/// just now. Use for display and for "is this configured?" checks. The
/// sentinel counts, because it only ever appears when a key is stored.
pub
/// What to render in the field. Never the secret: a stored key reads as saved,
/// a typed one as a fixed run of dots whose length says nothing about the key.
pub