Command-line entry point #
The IO shell: read the secret or the shares, fetch OS randomness for split, and write output.
All the logic lives in the pure QedShareCli.Pipeline and the verified core.
Read stream to its end, or until more than limit bytes were read. In that case the
result is longer than limit and the rest is left unread, so an oversized input is refused
without first being loaded into memory.
Equations
- readUpTo stream limit = readUpTo.loop stream limit ByteArray.empty
Instances For
Loop for streamLines. reserved says that the bytes kept for the current line already
have room for a whole share.
Read the stream to its end and call onLine with each line (its number, counting from 1,
and its bytes without the line feed), one at a time: the stream is never held as a whole.
Equations
- streamLines stream onLine = do let st ← streamLinesLoop stream onLine { } false match st.finish with | (n, l) => onLine n l
Instances For
Create the new file path for its owner only and write content to it.
writeNew fails if path already exists, so nothing is ever overwritten, even if the file
appears between an earlier check and this call. The access rights are narrowed while the file is
still empty, before any content is written. If writing fails, the unfinished file is removed.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Fail if path exists: split and combine never overwrite a file.
Equations
Instances For
Run convert. Nothing is printed unless every share can be converted.
Shares in regular files are read twice: once to check that every one converts, and once more to print each converted share as soon as it is made, so that no output is held. (If a file changes between the two, the second pass stops with the error, after the shares before it.) Shares on stdin, or in something that can be read only once, are kept as packed records until the last one is read, and then printed one by one.
Equations
- One or more equations did not get rendered due to their size.