main.rs

crates/veilvoice-cli/src/main.rs

veilvoice-cli · 3929 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

3929 lines defining 33 functions (0 public), 13 types and 1 constant. Everything below is read out of the source, so it cannot disagree with the code.

The types it owns.

  • struct Cli line 129 · The whole command line, which is one subcommand and nothing else.
  • enum Command line 144 · Everything veilvoice can be asked to do.
  • enum FixCommand line 857 · The corrections veilvoice conversation fix can make.
  • enum ConversationCommand line 942 · What veilvoice conversation can be asked to do: read a plan, or render one.
  • enum AppctlCommand line 1100 · What veilvoice capture can do.
  • enum InputCommand line 1133 · What veilvoice input can be asked to do: what is watching input now, or everything this build is able to notice.
  • enum CaptureCommand line 1149 · 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 1189 · What veilvoice mandate can do.
  • enum PolicyCommand line 1225 · What veilvoice policy can do.
  • enum SentryCommand line 1278 · What veilvoice sentry can do.
  • enum CleanPolicy line 1345 · What to do with the tags in a file veilvoice clean is given.
  • struct Tuning line 2498 · The engine settings a user can reach from the command line.
  • struct AtRest line 2575 · 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 32 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 1367"]
    n_explain_verification["explain_verification<br/>line 1387"]
    n_main["main<br/>line 1465"]
    n_run["run<br/>line 1508"]
    n_run_ffmpeg["run_ffmpeg<br/>line 2150"]
    n_list_volumes["list_volumes<br/>line 2225"]
    n_list_companions["list_companions<br/>line 2273"]
    n_print_launch_check["print_launch_check<br/>line 2317"]
    n_say_what_a_video_will_need["say_what_a_video_will_need<br/>line 2369"]
    n_offer_line["offer_line<br/>line 2391"]
    n_install_companion["install_companion<br/>line 2415"]
    n_reseed_range_from["reseed_range_from<br/>line 2517"]
    n_config["config<br/>line 2537"]
    n_describe_reseed_range["describe_reseed_range<br/>line 2556"]
    n_describe_reseed["describe_reseed<br/>line 2566"]
    n_anonymise["anonymise<br/>line 2585"]
    n_live["live<br/>line 2724"]
    n_list_devices["list_devices<br/>line 2956"]
    n_read_named["read_named<br/>line 3007"]
    n_video_plan["video_plan<br/>line 3022"]
    n_write_named["write_named<br/>line 3042"]
    n_write_new["write_new<br/>line 3052"]
    n_anonymise --> n_config
    n_anonymise --> n_describe_reseed_range
    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_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#L1367" "open the source"
    click n_explain_verification href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/main.rs#L1387" "open the source"
    click n_main href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/main.rs#L1465" "open the source"
    click n_run href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/main.rs#L1508" "open the source"
    click n_run_ffmpeg href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/main.rs#L2150" "open the source"
    click n_list_volumes href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/main.rs#L2225" "open the source"
    click n_list_companions href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/main.rs#L2273" "open the source"
    click n_print_launch_check href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/main.rs#L2317" "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#L2369" "open the source"
    click n_offer_line href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/main.rs#L2391" "open the source"
    click n_install_companion href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/main.rs#L2415" "open the source"
    click n_reseed_range_from href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/main.rs#L2517" "open the source"
    click n_config href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/main.rs#L2537" "open the source"
    click n_describe_reseed_range href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/main.rs#L2556" "open the source"
    click n_describe_reseed href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/main.rs#L2566" "open the source"
    click n_anonymise href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/main.rs#L2585" "open the source"
    click n_live href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/main.rs#L2724" "open the source"
    click n_list_devices href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/main.rs#L2956" "open the source"
    click n_read_named href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/main.rs#L3007" "open the source"
    click n_video_plan href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/main.rs#L3022" "open the source"
    click n_write_named href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/main.rs#L3042" "open the source"
    click n_write_new href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/main.rs#L3052" "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_write_new 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 struct129The whole command line, which is one subcommand and nothing else.
Command enum144Everything veilvoice can be asked to do.
conversation::Fix::from fn838
FixCommand enum857The corrections veilvoice conversation fix can make.
ConversationCommand enum942What veilvoice conversation can be asked to do: read a plan, or render one.
AppctlCommand enum1100What veilvoice capture can do.
InputCommand enum1133What veilvoice input can be asked to do: what is watching input now, or everything this build is able to notice.
CaptureCommand enum1149What 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 enum1189What veilvoice mandate can do.
PolicyCommand enum1225What veilvoice policy can do.
SentryCommand enum1278What veilvoice sentry can do.
CleanPolicy enum1345What to do with the tags in a file veilvoice clean is given.
Policy::from fn1353
flavour_for fn1367The verification script's spelling for a system, in one place.
explain_verification fn1387What checking a release actually involves, and who does which part.
main fn1465Parse the command line and turn a failure into an exit code and a message.
run fn1508Carry out one subcommand.
run_ffmpeg fn2150Roadmap items 87 and 88.
list_volumes fn2225Report the encrypted volumes this machine is offering.
list_companions fn2273Report every companion that means anything on this platform.
print_launch_check fn2317Roadmap item 163.
say_what_a_video_will_need fn2369Roadmap item 163.
offer_line fn2391One line describing what VeilVoice can do about a missing companion.
install_companion fn2415Act on one named companion.
Tuning struct2498The engine settings a user can reach from the command line.
reseed_range_from fn2517Turn --reseed-range into a range, or into the reason it was not one.
config fn2537The de-identification settings a Tuning describes, with every figure clamped.
describe_reseed_range fn2556How a randomised roll range reads in the output.
describe_reseed fn2566How the seed-rolling setting reads in the output.
AtRest struct2575What to do with the result once it exists.
anonymise fn2585veilvoice anonymise: veil a recording and write it somewhere else.
live fn2724veilvoice live: veil the microphone as it is heard, with an optional preview.
list_devices fn2956veilvoice devices: every input and output this machine reports.
read_named pub(crate) fn3007Read a file, naming it if that fails.
video_plan pub(crate) fn3022Read a --size and an --fps into a render plan, saying what was decided.
write_named pub(crate) fn3042Write a file, naming it if that fails.
write_new fn3052Create path with bytes, failing if anything is already there.
clean fn3062veilvoice clean: strip the metadata a file carries, in place.
encrypt fn3080veilvoice encrypt: seal a file, to a passphrase or to a public key.
decrypt fn3111veilvoice decrypt: open a sealed file, given the passphrase or the secret key.
load_secret_key fn3143Load a private key file, which is itself a password-locked container.
keygen fn3153veilvoice keygen: write a new key pair, refusing to overwrite either file.
watch fn3238Report, and keep reporting, what is using the microphone and camera.
shred fn3328Destroy a file's contents, then delete it.
default_veiled_path fn3398Where anonymise writes when no --output is given: the input's name with .veiled.wav in place of its extension, as its help says.
NETWORK_ACCESS const3407What veilvoice info says about the network.
info fn3410veilvoice info: the versions, and what this build was compiled to do.