Skip to main content

Module secret_prompt

Module secret_prompt 

Expand description

The one password prompt: every secret Tilo asks for — a Wi-Fi passphrase, a polkit password, a VPN login, an unlock, a SIM PIN — is asked by this component, drawn the same by the shell and by apps.

It shows an icon and a title naming who asks and why (“Connect to TruffleBoys2026”), the resource line, the fields the kind asks for (each a secret TextInput with its own show/hide button), one notice line under them (an inline error after a wrong secret, Caps Lock, the PIN length or the attempts a SIM has left), a numeric keypad for the PIN kinds while touch is the input in use, and Cancel plus a primary button labelled by the action.

Three presentations of the same body: Presentation::Sheet, the modal sheet a painted host draws itself through the one modal chrome (super::modal_dialog) — Enter answers, Escape cancels, and it keeps the field clear of an on-screen keyboard (SecretPrompt::set_keyboard_inset); Presentation::Inline, inside another surface, with no title or sheet; and Presentation::DialogBody, the body of a retained ModalDialog, which draws the title and actions (SecretPrompt::into_dialog wires them).

The secret lives only in the fields’ zeroizing buffers and in the SecretAnswer handed out on submit, which zeroes itself on drop. It is never in the accessibility tree (fields report protected), a log (the answer’s Debug is redacted), a document or replicated state (fields are local, with no binding), or a screenshot (a painted secret marks the frame through crate::secret_paint, so hosts withhold it).

ⓘ
// A painted host:
let mut prompt = SecretPrompt::new(SecretKind::Secret)
    .with_icon(Icon::Wifi)
    .with_title("Connect to TruffleBoys2026")
    .with_resource("WPA2 Personal")
    .with_primary_label("Connect");
prompt.set_focus(true);
prompt.place(window, text, theme);
prompt.paint(scene, transform, text, theme);
prompt.handle_event(event, ctx);
match prompt.take_outcome() {
    Some(PromptOutcome::Submit(answer)) => connect(answer.secret),
    Some(PromptOutcome::Cancel) => close(),
    None => {}
}
// …and when the network refuses it:
prompt.reject("Wrong password");

Structs§

FieldSpec
One field a SecretKind::Fields prompt asks for.
PromptLayout
Where every part of the prompt landed in its last layout.
SecretAnswer
What the person typed, handed out once on submit. Every secret is in a buffer that zeroes itself when dropped; Debug shows none of them.
SecretPrompt
The password prompt. See the module documentation.

Enums§

FieldRole
What one field of a prompt holds.
NoticeTone
How the notice line reads.
Presentation
How the prompt is framed.
PromptOutcome
How the person answered.
SecretKind
What a prompt asks for.

Constants§

PUK_DIGITS
The digits a SIM’s PUK has.
SIM_PIN_DIGITS
The lengths a SIM PIN may have.