Command-line arguments #
Parsing is pure and total. There is deliberately no option that takes the secret itself:
the secret comes from stdin or a file, never from argv, which would leak into shell history and
the process list (README: Threat model).
How shares are written: qs3-… hex, or BIP-39 words.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Equations
Equations
- QedShare.Cli.instBEqShareForm.beq x✝ y✝ = (x✝.ctorIdx == y✝.ctorIdx)
Instances For
What the user asked for.
- split (k n : Nat) (input outDir : Option String) (form : ShareForm) : Command
Split a secret: threshold, share count, optional input file, optional output directory, and the form of the shares.
- combine (files : List String) (out : Option String) : Command
Combine shares from files (or from stdin when the list is empty), writing the secret to
out(or to stdout when there is none). - convert (form : ShareForm) (files : List String) : Command
Rewrite shares (from files, or stdin when the list is empty) in the given form.
- verify (files : List String) : Command
Check that shares rebuild a secret, without writing the secret anywhere.
- info (files : List String) : Command
Describe shares (format, set id, index, threshold, secret length) without combining them.
- help : Command
- version : Command
Instances For
Equations
- QedShare.Cli.instReprCommand = { reprPrec := QedShare.Cli.instReprCommand.repr }
Equations
- One or more equations did not get rendered due to their size.
- QedShare.Cli.instReprCommand.repr QedShare.Cli.Command.help prec✝ = Repr.addAppParen (Std.Format.nest (if prec✝ ≥ 1024 then 1 else 2) (Std.Format.text "QedShare.Cli.Command.help")).group prec✝
Instances For
Equations
Equations
- One or more equations did not get rendered due to their size.
- QedShare.Cli.instBEqCommand.beq (QedShare.Cli.Command.combine a a_1) (QedShare.Cli.Command.combine b b_1) = (a == b && a_1 == b_1)
- QedShare.Cli.instBEqCommand.beq (QedShare.Cli.Command.convert a a_1) (QedShare.Cli.Command.convert b b_1) = (a == b && a_1 == b_1)
- QedShare.Cli.instBEqCommand.beq (QedShare.Cli.Command.verify a) (QedShare.Cli.Command.verify b) = (a == b)
- QedShare.Cli.instBEqCommand.beq (QedShare.Cli.Command.info a) (QedShare.Cli.Command.info b) = (a == b)
- QedShare.Cli.instBEqCommand.beq QedShare.Cli.Command.help QedShare.Cli.Command.help = true
- QedShare.Cli.instBEqCommand.beq QedShare.Cli.Command.version QedShare.Cli.Command.version = true
- QedShare.Cli.instBEqCommand.beq x✝¹ x✝ = false
Instances For
Read a count such as 3: decimal digits only. (String.toNat? alone also accepts 1_0,
which is more likely a typo than a number when it sets a threshold.)
Equations
Instances For
true for an argument that is an option rather than a file name: it starts with -.
(A lone - is left alone, as a file name.)
Equations
- QedShare.Cli.isOption a = (a.startsWith "-" && a != "-")
Instances For
Parse the options of split. A repeated option is an error: silently keeping the last
--threshold could split a secret with a threshold the user did not mean.
Equations
- One or more equations did not get rendered due to their size.
- QedShare.Cli.parseSplitOpts opts [] = Except.ok opts
- QedShare.Cli.parseSplitOpts opts ("--words" :: rest) = QedShare.Cli.parseSplitOpts { k := opts.k, n := opts.n, input := opts.input, outDir := opts.outDir, words := true } rest
- QedShare.Cli.parseSplitOpts opts (flag :: rest) = Except.error (toString "unknown or incomplete option '" ++ toString flag ++ toString "' for split")
Instances For
Parse the arguments of a command that reads share files (cmd names it in errors).
--out/-o is accepted when allowOut, --words/--hex when allowForm. Any other argument
starting with - is an error rather than a file name, so a mistyped option is reported as one;
after -- every argument is a file name.
Equations
Instances For
true if the arguments ask for help.
Equations
- QedShare.Cli.wantsHelp args = (args.contains "--help" || args.contains "-h")
Instances For
Parse the full argument list.
Equations
- One or more equations did not get rendered due to their size.
- QedShare.Cli.parseArgs [] = Except.ok QedShare.Cli.Command.help
- QedShare.Cli.parseArgs ["--help"] = Except.ok QedShare.Cli.Command.help
- QedShare.Cli.parseArgs ["-h"] = Except.ok QedShare.Cli.Command.help
- QedShare.Cli.parseArgs ["help"] = Except.ok QedShare.Cli.Command.help
- QedShare.Cli.parseArgs ["--version"] = Except.ok QedShare.Cli.Command.version
- QedShare.Cli.parseArgs ["-V"] = Except.ok QedShare.Cli.Command.version
- QedShare.Cli.parseArgs (cmd :: tail) = Except.error (toString "unknown command '" ++ toString cmd ++ toString "'")