main.rs

crates/veilvoice-cli/src/main.rs

veilvoice-cli · 3787 lines · read the source here · or on GitHub

veilvoice, the command-line interface.

Everything VeilVoice does, available without a desktop: it runs over SSH, in a container, and on machines that have no GUI toolkit at all. The same engine backs both this and the graphical app.

What is here

Twenty subcommands, and they divide into five groups:

  • Audio -- anonymise a file, live scramble a microphone, list devices, conversation for a recording with several people in it.
  • Privacy of the files themselves -- clean metadata, encrypt, decrypt, keygen, shred.
  • Watching the machine -- watch the microphone and camera, guard VeilVoice's own files against tampering, sentry for canaries and how fast a folder is changing, capture for which screen recorders are running.
  • The app lock -- lock set|status|change|remove, and policy for settings somebody has fixed so the interface cannot turn them off.
  • Getting it onto the machine -- install, uninstall, companions, and gui to open the desktop application.

That last group is a front end over veilvoice_setup, which the desktop application's setup tab also calls. The careful part -- editing PATH -- has one implementation and one set of tests, rather than one per front end.

Two behaviours that surprise people, on purpose

anonymise writes <out>.veil, not a bare WAV. Recordings are encrypted at rest by default. --encrypt=false opts out and requires --yes, because an unsealed recording is the thing somebody later wishes they had not produced. The wiki explains where the WAV went.

The front-ends refuse rather than downgrade. Asked to encrypt with nothing to encrypt with, this exits with an error instead of writing plain audio and mentioning it. Quiet degradation to a weaker posture is the defect class this project has found in itself most often.

Passphrase prompts cannot be piped

rpassword needs a real console; piping a passphrase in blocks on CONIN$ rather than reading it. That is a property of terminal input, not a bug here, and it means anything that prompts cannot be smoke-tested from a non-interactive shell. The layer beneath each prompt is therefore tested instead -- see crate::atrest and crate::lock, where the logic lives precisely so it can be reached without a terminal.

A clap ordering rule worth knowing

An argument declared beside #[command(subcommand)] must precede the subcommand on the command line unless it is marked global = true. So veilvoice lock --path X status parses and veilvoice lock status --path X does not, except that --path is now global specifically so both do.

In plain words

This is VeilVoice without a window.

Everything the program does, typed instead of clicked: disguise a recording, scramble a microphone while you talk, seal a file, strip a photograph's hidden labels, handle a recording with several people in it.

It is the same code underneath, so it works the same way -- over a remote connection, on a machine with no desktop, or from a script that runs it a thousand times.

WHAT THIS FILE CONTAINS

3787 lines defining 31 functions (0 public), 13 types and 0 constants. Everything below is read out of the source, so it cannot disagree with the code.

The types it owns.

  • struct Cli line 127 · The whole command line, which is one subcommand and nothing else.
  • enum Command line 142 · Everything veilvoice can be asked to do.
  • enum FixCommand line 844 · The corrections veilvoice conversation fix can make.
  • enum ConversationCommand line 929 · What veilvoice conversation can be asked to do: read a plan, or render one.
  • enum AppctlCommand line 1087 · What veilvoice capture can do.
  • enum InputCommand line 1120 · What veilvoice input can be asked to do: what is watching input now, or everything this build is able to notice.
  • enum CaptureCommand line 1136 · What veilvoice capture can be asked to do about the microphone and camera, with the same pairing as InputCommand: what is happening now, and what this build is able to notice at all.
  • enum MandateCommand line 1176 · What veilvoice mandate can do.
  • enum PolicyCommand line 1212 · What veilvoice policy can do.
  • enum SentryCommand line 1265 · What veilvoice sentry can do.
  • enum CleanPolicy line 1332 · What to do with the tags in a file veilvoice clean is given.
  • struct Tuning line 2460 · The engine settings a user can reach from the command line.
  • struct AtRest line 2537 · What to do with the result once it exists.

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. 22 of 30 functions are drawn; the diagram is bounded at 22 so it stays readable.

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_flavour_for["flavour_for<br/>line 1354"]
    n_explain_verification["explain_verification<br/>line 1374"]
    n_main["main<br/>line 1452"]
    n_run["run<br/>line 1494"]
    n_run_ffmpeg["run_ffmpeg<br/>line 2112"]
    n_list_volumes["list_volumes<br/>line 2187"]
    n_list_companions["list_companions<br/>line 2235"]
    n_print_launch_check["print_launch_check<br/>line 2279"]
    n_say_what_a_video_will_need["say_what_a_video_will_need<br/>line 2331"]
    n_offer_line["offer_line<br/>line 2353"]
    n_install_companion["install_companion<br/>line 2377"]
    n_reseed_range_from["reseed_range_from<br/>line 2479"]
    n_config["config<br/>line 2499"]
    n_describe_reseed_range["describe_reseed_range<br/>line 2518"]
    n_describe_reseed["describe_reseed<br/>line 2528"]
    n_anonymise["anonymise<br/>line 2547"]
    n_live["live<br/>line 2690"]
    n_list_devices["list_devices<br/>line 2922"]
    n_read_named["read_named<br/>line 2973"]
    n_video_plan["video_plan<br/>line 2988"]
    n_write_named["write_named<br/>line 3005"]
    n_clean["clean<br/>line 3010"]
    n_anonymise --> n_config
    n_anonymise --> n_describe_reseed_range
    n_clean --> n_read_named
    n_describe_reseed_range --> n_describe_reseed
    n_install_companion --> n_offer_line
    n_list_companions --> n_offer_line
    n_list_companions --> n_print_launch_check
    n_live --> n_config
    n_live --> n_describe_reseed_range
    n_main --> n_run
    n_print_launch_check --> n_offer_line
    n_run --> n_anonymise
    n_run --> n_clean
    n_run --> n_config
    n_run --> n_explain_verification
    n_run --> n_flavour_for
    n_run --> n_install_companion
    n_run --> n_list_companions
    n_run --> n_list_devices
    n_run --> n_list_volumes
    n_run --> n_live
    n_run --> n_reseed_range_from
    n_run --> n_run_ffmpeg
    n_run --> n_say_what_a_video_will_need
    n_run --> n_video_plan
    click n_flavour_for href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/main.rs#L1354" "open the source"
    click n_explain_verification href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/main.rs#L1374" "open the source"
    click n_main href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/main.rs#L1452" "open the source"
    click n_run href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/main.rs#L1494" "open the source"
    click n_run_ffmpeg href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/main.rs#L2112" "open the source"
    click n_list_volumes href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/main.rs#L2187" "open the source"
    click n_list_companions href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/main.rs#L2235" "open the source"
    click n_print_launch_check href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/main.rs#L2279" "open the source"
    click n_say_what_a_video_will_need href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/main.rs#L2331" "open the source"
    click n_offer_line href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/main.rs#L2353" "open the source"
    click n_install_companion href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/main.rs#L2377" "open the source"
    click n_reseed_range_from href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/main.rs#L2479" "open the source"
    click n_config href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/main.rs#L2499" "open the source"
    click n_describe_reseed_range href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/main.rs#L2518" "open the source"
    click n_describe_reseed href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/main.rs#L2528" "open the source"
    click n_anonymise href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/main.rs#L2547" "open the source"
    click n_live href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/main.rs#L2690" "open the source"
    click n_list_devices href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/main.rs#L2922" "open the source"
    click n_read_named href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/main.rs#L2973" "open the source"
    click n_video_plan href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/main.rs#L2988" "open the source"
    click n_write_named href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/main.rs#L3005" "open the source"
    click n_clean href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/main.rs#L3010" "open the source"
    classDef helper fill:#1f2335,stroke:#bb9af7,color:#c0caf5
    class n_flavour_for,n_explain_verification,n_main,n_run,n_run_ffmpeg,n_list_volumes,n_list_companions,n_print_launch_check,n_say_what_a_video_will_need,n_offer_line,n_install_companion,n_reseed_range_from,n_config,n_describe_reseed_range,n_describe_reseed,n_anonymise,n_live,n_list_devices,n_read_named,n_video_plan,n_write_named,n_clean helper
    subgraph chart_key ["Key"]
        direction LR
        key_helper["helper: private to this file"]
    end
    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

ItemLineDocumentation
Cli struct127The whole command line, which is one subcommand and nothing else.
Command enum142Everything veilvoice can be asked to do.
conversation::Fix::from fn825
FixCommand enum844The corrections veilvoice conversation fix can make.
ConversationCommand enum929What veilvoice conversation can be asked to do: read a plan, or render one.
AppctlCommand enum1087What veilvoice capture can do.
InputCommand enum1120What veilvoice input can be asked to do: what is watching input now, or everything this build is able to notice.
CaptureCommand enum1136What veilvoice capture can be asked to do about the microphone and camera, with the same pairing as InputCommand: what is happening now, and what this build is able to notice at all.
MandateCommand enum1176What veilvoice mandate can do.
PolicyCommand enum1212What veilvoice policy can do.
SentryCommand enum1265What veilvoice sentry can do.
CleanPolicy enum1332What to do with the tags in a file veilvoice clean is given.
Policy::from fn1340
flavour_for fn1354The verification script's spelling for a system, in one place.
explain_verification fn1374What checking a release actually involves, and who does which part.
main fn1452Parse the command line and turn a failure into an exit code and a message.
run fn1494Carry out one subcommand.
run_ffmpeg fn2112Roadmap items 87 and 88.
list_volumes fn2187Report the encrypted volumes this machine is offering.
list_companions fn2235Report every companion that means anything on this platform.
print_launch_check fn2279Roadmap item 163.
say_what_a_video_will_need fn2331Roadmap item 163.
offer_line fn2353One line describing what VeilVoice can do about a missing companion.
install_companion fn2377Act on one named companion.
Tuning struct2460The engine settings a user can reach from the command line.
reseed_range_from fn2479Turn --reseed-range into a range, or into the reason it was not one.
config fn2499The de-identification settings a Tuning describes, with every figure clamped.
describe_reseed_range fn2518How a randomised roll range reads in the output.
describe_reseed fn2528How the seed-rolling setting reads in the output.
AtRest struct2537What to do with the result once it exists.
anonymise fn2547veilvoice anonymise: veil a recording and write it somewhere else.
live fn2690veilvoice live: veil the microphone as it is heard, with an optional preview.
list_devices fn2922veilvoice devices: every input and output this machine reports.
read_named pub(crate) fn2973Read a file, naming it if that fails.
video_plan pub(crate) fn2988Read a --size and an --fps into a render plan, saying what was decided.
write_named pub(crate) fn3005Write a file, naming it if that fails.
clean fn3010veilvoice clean: strip the metadata a file carries, in place.
encrypt fn3028veilvoice encrypt: seal a file, to a passphrase or to a public key.
decrypt fn3059veilvoice decrypt: open a sealed file, given the passphrase or the secret key.
load_secret_key fn3091Load a private key file, which is itself a password-locked container.
keygen fn3101veilvoice keygen: write a new key pair, refusing to overwrite either file.
watch fn3177Report, and keep reporting, what is using the microphone and camera.
shred fn3267Destroy a file's contents, then delete it.
info fn3336veilvoice info: the versions, and what this build was compiled to do.