This commit is contained in:
Daniel Langbein 2022-09-02 13:27:24 +02:00
parent d2dae5faa0
commit 3c5edea2a4
3 changed files with 9 additions and 6 deletions

View File

@ -24,11 +24,11 @@ One can set the according parameters of `split_encode` to `False` to skip this s
sudo pacman -S --needed qrencode imagemagick
```
`enscript` is required to create a PDF containing the split secret in text form.
`enscript` and `ghostscript` (`ps2pdf`) are required to create a PDF containing the split secret in text form.
One can set the according parameters of `split_encode` to `False` to skip this step.
```shell
sudo pacman -S --needed enscript
sudo pacman -S --needed enscript ghostscript
```
## Usage
@ -42,7 +42,7 @@ cat > secret.txt
Split the secret into 5 lines:
```shell
./enpaper.py secret.txt
enpaper secret.txt
```
Manually delete up to 2 of the 5 lines in `secret.txt_txt.txt`.
@ -50,7 +50,7 @@ Manually delete up to 2 of the 5 lines in `secret.txt_txt.txt`.
Then recreate the secret:
```shell
./depaper.py secret.txt.split-text.txt
depaper secret.txt.split-text.txt
```
Print the secret:

View File

@ -3,7 +3,7 @@
[metadata]
name = paper-secret
version = 0.1.0
version = 0.1.1
author = Daniel Langbein
author_email = daniel@systemli.org
description = Shamir Secret Sharing on paper using gfshare

View File

@ -73,9 +73,12 @@ def split_encode(
txt_file.write_text(lines)
if create_text_pdf:
command = ['enscript', '-B', '--margins=24:24:', '-o', str(txt_pdf), '-f', 'Courier@12/12']
txt_ps = tmpdir / 'txt.ps'
command = ['enscript', '-B', '--margins=24:24:', '-o', str(txt_ps), '-f', 'Courier@12/12']
util.execute_stdin_capture(command, lines.replace('\n', '\n\n\n').encode('UTF-8'))
util.execute_stdin_capture(['ps2pdf', str(txt_ps), str(txt_pdf)])
if create_qr_codes and merge_qr_codes:
command = ['convert'] + [str(qrcode) for qrcode in qrcodes] + [str(qr_pdf)]
util.execute_stdin_capture(command)