crates/veilvoice-cli/src/decoy.rs
veilvoice-cli · 559 lines · read the source here · or on GitHub
veilvoice decoy, and what a second passphrase is worth and what it is not.
What it is worth is printed on the way in, not behind a flag
Every path that reports on a decoy or sets one up prints veilvoice_crypto::decoy::SCOPE, and the two that set one print veilvoice_crypto::decoy::WHY_NO_DESTRUCTION with it, for the same reason crate::lock prints the lock's own: somebody who believes a decoy hides that a second passphrase exists has been made less safe by it, not more. They would rely on an argument they do not have.
Removing one is the exception and prints neither. Nothing is being taken on trust there, and a reader who has just asked for the feature to go does not need a page on what it was worth.
The window prints the same two passages from the same two constants, so neither front end can soften it without the other.
In plain words
Explains the decoy passphrase, and sets, changes or removes one.
A decoy opens VeilVoice with nothing in it. It is there for the situation where somebody is standing over you asking you to unlock your computer: it gives you something true to say.
It does not hide that a second passphrase might exist, and no passphrase destroys your recordings. Both of those are printed every time, and the second is deliberate: on modern storage, deleting a file does not reliably remove it, so a feature that claimed to would be lying to you at the worst possible moment.
Setting or removing a decoy asks for your real passphrase first, so nobody can do either at a window you left unlocked.
WHAT THIS FILE CONTAINS
559 lines defining 14 functions (2 public), 1 type and 0 constants. Everything below is read out of the source, so it cannot disagree with the code.
The types it owns.
enum Actionline 49 · What veilvoice decoy can be asked to do.
What happens when it runs. These are the ways in: public, and nothing else in this file calls them, so they are what an outside caller reaches first.
runline 66 · Dispatch veilvoice decoy, or explain the feature when nothing was asked.
reachesexplain,remove,set,status,print_no_destruction,print_pair_rule,print_scope,lock_or_explain,text,allowed,read_twice,print_wrapped
WHAT CALLS WHAT
The functions this file defines, and the calls between them. An edge means the callee's name appears, called, inside the caller's body. This is a syntactic reading, not a type-resolved one.
The same graph as Mermaid source
%%{init: {"theme":"base","themeVariables":{"background":"#1a1b26","primaryColor":"#1f2335","primaryTextColor":"#c0caf5","primaryBorderColor":"#7aa2f7","secondaryColor":"#16161e","tertiaryColor":"#16161e","lineColor":"#737aa2","textColor":"#c0caf5","mainBkg":"#1f2335","nodeBorder":"#7aa2f7","clusterBkg":"#16161e","clusterBorder":"#2f3549","fontFamily":"ui-monospace, SFMono-Regular, Consolas, monospace","fontSize":"14px"}}}%%
flowchart TD
n_run(["run<br/>line 66"])
n_explain["explain<br/>line 77"]
n_status["status<br/>line 119"]
n_set["set<br/>line 219"]
n_remove["remove<br/>line 309"]
n_allowed["allowed<br/>line 339"]
n_lock_or_explain["lock_or_explain<br/>line 360"]
n_read_twice["read_twice<br/>line 376"]
n_text["text<br/>line 393"]
n_print_scope["print_scope<br/>line 399"]
n_print_no_destruction["print_no_destruction<br/>line 404"]
n_print_wrapped["print_wrapped<br/>line 412"]
n_print_pair_rule["print_pair_rule<br/>line 423"]
n_paragraphs["paragraphs<br/>line 450"]
n_explain --> n_print_no_destruction
n_explain --> n_print_pair_rule
n_explain --> n_print_scope
n_print_no_destruction --> n_print_wrapped
n_print_scope --> n_print_wrapped
n_print_wrapped --> n_paragraphs
n_remove --> n_lock_or_explain
n_remove --> n_text
n_run --> n_explain
n_run --> n_remove
n_run --> n_set
n_run --> n_status
n_set --> n_allowed
n_set --> n_lock_or_explain
n_set --> n_print_no_destruction
n_set --> n_print_pair_rule
n_set --> n_print_scope
n_set --> n_read_twice
n_set --> n_text
n_status --> n_print_scope
click n_run href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/decoy.rs#L66" "open the source"
click n_explain href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/decoy.rs#L77" "open the source"
click n_status href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/decoy.rs#L119" "open the source"
click n_set href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/decoy.rs#L219" "open the source"
click n_remove href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/decoy.rs#L309" "open the source"
click n_allowed href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/decoy.rs#L339" "open the source"
click n_lock_or_explain href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/decoy.rs#L360" "open the source"
click n_read_twice href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/decoy.rs#L376" "open the source"
click n_text href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/decoy.rs#L393" "open the source"
click n_print_scope href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/decoy.rs#L399" "open the source"
click n_print_no_destruction href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/decoy.rs#L404" "open the source"
click n_print_wrapped href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/decoy.rs#L412" "open the source"
click n_print_pair_rule href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/decoy.rs#L423" "open the source"
click n_paragraphs href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/decoy.rs#L450" "open the source"
classDef entry fill:#1f2335,stroke:#7aa2f7,color:#c0caf5
class n_run entry
classDef api fill:#1f2335,stroke:#7dcfff,color:#c0caf5
class n_explain api
classDef helper fill:#1f2335,stroke:#bb9af7,color:#c0caf5
class n_status,n_set,n_remove,n_allowed,n_lock_or_explain,n_read_twice,n_text,n_print_scope,n_print_no_destruction,n_print_wrapped,n_print_pair_rule,n_paragraphs helper
subgraph chart_key ["Key"]
direction LR
key_entry["entry: a way in: public, and nothing in this file calls it"]
key_api["api: public, and also used inside this file"]
key_helper["helper: private to this file"]
end
class key_entry entry
class key_api api
class key_helper helper
This site loads no third-party script, so it cannot run Mermaid; the diagram above is the same nodes and edges drawn by the generator instead. GitHub renders the source below directly.
ITEMS
| Item | Line | Documentation |
|---|---|---|
Action pub enum | 49 | What veilvoice decoy can be asked to do. |
run pub fn | 66 | Dispatch veilvoice decoy, or explain the feature when nothing was asked. |
explain pub fn | 77 | Explain the feature and its limits. |
status fn | 119 | veilvoice decoy status: whether a decoy is set, and where it lives. |
set fn | 219 | veilvoice decoy set and veilvoice decoy change, which are one path. |
remove fn | 309 | veilvoice decoy remove: take the decoy off, after proving the real one. |
allowed fn | 339 | Whether the state on disk allows what was asked, and what to say first. |
lock_or_explain fn | 360 | The app lock, or a message saying what to do about there not being one. |
read_twice fn | 376 | Read the decoy twice, without echoing it, and check the two agree. |
text fn | 393 | A typed passphrase as text. |
print_scope fn | 399 | What a decoy is worth, wrapped, from the one constant both front ends read. |
print_no_destruction fn | 404 | Why no passphrase destroys anything, from the same place. |
print_wrapped fn | 412 | Print an indented, wrapped passage, with the blank lines left blank. |
print_pair_rule fn | 423 | The rule about the pair, and why there is one. |
paragraphs fn | 450 | Wrap text that has paragraphs in it, and keep the paragraphs. |