NAME
App::FuguSeed::QR - the flow of fuguseed-qr
SYNOPSIS
use App::FuguSeed::QR;
exit App::FuguSeed::QR->run(@ARGV);
DESCRIPTION
App::FuguSeed::QR holds the flow of the program fuguseed-qr. It reads the 12 seed words from the first line of standard input, and it writes the SeedQR to standard output. It also holds the checksum check and the digit string of the 12 words.
It is the one module of the program that touches a stream. The three standard streams are the one contact of the program with the computer: no module of the program opens a file, spawns a process, or reads an environment variable.
The program takes no option and no argument. Standard output holds the digit string on one line, then the grid view, then the 25 zone views. After each zone view, the program reads one line from standard input before the next zone. At the end of the input, it prints the remaining zones without a pause.
A failure prints one line to standard error. The line can name the word position or the count that failed, never a word. A wrong checksum is a failure, and the program prints no SeedQR. fuguseed-last finds the check word.
valid
valid($words) returns true when the low 4 bits of index 12 are the 4 bits that BIP39 requires. The bits are the first bits of the SHA-256 of the 16 entropy bytes. The caller proves the words with App::FuguSeed::Mnemonic first.
digits
digits($words) returns the digit string: the 12 indexes, 0-based, each as 4 decimal digits with leading zeros, in word order. The string holds 48 digits. The caller proves the words first.
run
run(@argument) reads the words, prints the result, and returns the exit code.
RETURN VALUES
valid() returns true or false, and digits() returns 48 digits. run() returns 0 for a success, 1 for a failure, and 2 for a usage error.
ERRORS
An argument is a usage error: run() prints one usage line to standard error and returns 2. Another count than 12 words, a word outside the list, and a wrong checksum are failures: run() prints one line to standard error and returns 1.
SEE ALSO
fuguseed-qr(1), fuguseed-last(1), App::FuguSeed::Mnemonic, and App::FuguSeed::Text.
AUTHORS
Dick Olsson <hi@senzilla.io>