Skip to content

Commit b894a77

Browse files
committed
v0.2.0
1 parent 5842c68 commit b894a77

File tree

1 file changed

+56
-18
lines changed

1 file changed

+56
-18
lines changed

README.md

Lines changed: 56 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
1717
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
18+
1819
**Table of Contents**
1920

2021
- [Description](#description)
@@ -116,44 +117,79 @@ Usage:
116117

117118
### Rules
118119

120+
**dotenv-file vs env variables**
121+
122+
The program works with given arguments and/or given dotenv-file.
123+
124+
- if an entry is not defined (dotenv-file, environment variable, argument), the program exit with failure
125+
- a given argument overwrites a dotenv-file entry
126+
- if a given dotenv-file entry is missing, the program looks for the related environment variable
127+
128+
```mermaid
129+
flowchart TD;
130+
A["Variable"]-. "is defined in dotenv-file" .->B[["set environment variable"]]
131+
B-- "is empty" -->E("EXIT")
132+
B-- "not empty and valid" -->P[["encrypt or decrypt file"]]
133+
134+
A["Variable"]-. "is not defined in dotenv-file" .->C[["get environment variable"]]
135+
C-- "is empty" -->E("EXIT")
136+
C-- "not empty and valid" -->P[["encrypt or decrypt file"]]
137+
```
138+
139+
**encryption or decryption**
140+
119141
- if sourcefile given without a targetfile and sourcefile has not extension `.aes`, the targetfile will be encrypted as `<samePath>/<sourcefile>.aes`
120142
- if sourcefile has extension `.aes` without a targetfile, the targetfile will be decrypted `<samePath>/<sourcefile>` (without extension `.aes`)
121143

122144
```mermaid
123145
flowchart TD;
124146
A["path/to/sourcefile"]-. "has not .aes" .->B[[encrypt sourcefile]]
125-
B-- "has --target" -->C[["new/path/to/sourcefile.aes"]]
126-
B-- "has no --target" -->D[["path/to/sourcefile.aes"]]
147+
B-- "has --target" -->C["new/path/to/sourcefile.aes"]
148+
B-- "has no --target" -->D["path/to/sourcefile.aes"]
127149
128150
A["path/to/sourcefile"]-. "has .aes" .->F[["decrypt sourcefile"]]
129-
F-- "has --target" -->G[["new/path/to/sourcefile"]]
130-
F-- "has no --target" -->H[["path/to/sourcefile"]]
151+
F-- "has --target" -->G["new/path/to/sourcefile"]
152+
F-- "has no --target" -->H["path/to/sourcefile"]
131153
```
132154

133155
## Encryption
134156

157+
> \[!WARNING]
158+
> don't loose your password. Decryption/Recovery without valid password is impossible!
159+
135160
### Linux
136161

137-
```cli
138-
./file_encryption-decryption-x86_64.AppImage --source /path/to/sourcefile.xlsx
162+
**encrypt**
139163

140-
cli app to encrypt and decrypt a given file
141-
Usage:
142-
qt-cli_file_encryption-decryption [OPTION...]
164+
Encrypt `/path/to/sourcefile.xlsx` to `/path/to/sourcefile.xlsx.aes` with environment password-variable `my_secret_var`
143165

144-
-s, --source arg <path/to/sourcefile> to en-/de-crypt. Mandatory: -s | -d
145-
-t, --target arg target <path/to/outputfile>. Optional: -t | -d
146-
-p, --pwd arg name of password env variable. Mandatory: -p | -d
147-
-d, --dotenv arg <path/to/dotenv> file. Mandatory: -s | -p | -d
148-
-h, --help Print help
166+
```cli
167+
./file_encryption-decryption-x86_64.AppImage --source /path/to/sourcefile.xlsx --pwd my_secret_var
149168
```
150169

151-
> \[!WARNING]
152-
> don't loose your password. Decryption/Recovery without valid password is impossible!
170+
Encrypt `/path/to/sourcefile.xlsx` to `/new/path/to/targetfile.xlsx.aes` with dotenv-file (`PWD=$my_secret_var`)
171+
172+
```cli
173+
./file_encryption-decryption-x86_64.AppImage --source /path/to/sourcefile.xlsx --target /new/path/to/targetfile.xlsx --dotenv /my/configpath/.file_enc-dec
174+
```
153175

154176
## Decryption
155177

156-
_under construction_
178+
### Linux
179+
180+
**decrypt**
181+
182+
Decrypt `/path/to/sourcefile.xlsx.aes` to `/path/to/sourcefile.xlsx`
183+
184+
```cli
185+
./file_encryption-decryption-x86_64.AppImage --source /path/to/sourcefile.xlsx.aes
186+
```
187+
188+
Decrypt `/path/to/sourcefile.xlsx.aes` to `/new/path/to/targetfile.xlsx`
189+
190+
```cli
191+
./file_encryption-decryption-x86_64.AppImage --source /path/to/sourcefile.xlsx.aes --target /new/path/to/targetfile.xlsx
192+
```
157193

158194
## configuration: dotenv or env
159195

@@ -162,7 +198,7 @@ Example dotenv file `.env`
162198
```dotenv
163199
SOURCE_FILE=/inpath/to/file.xlsx # Mandatory or mandatory via argument --source
164200
TARGET_FILE=/outpath/to/file.xlsx # Optional or optional via argument --target
165-
PWD=my_env_secret # Mandatory get password from $my_env_secret or mandatory via --pwd
201+
PWD=my_env_secret # Mandatory get password from $my_env_secret or mandatory via --pwd my_env_secret
166202
```
167203

168204
Example pwd environmwent variable
@@ -258,6 +294,7 @@ An utility to load environment variables from a .env file
258294
## folder structure
259295

260296
<!-- readme-tree start -->
297+
261298
```
262299
.
263300
├── .github
@@ -306,6 +343,7 @@ An utility to load environment variables from a .env file
306343
307344
10 directories, 34 files
308345
```
346+
309347
<!-- readme-tree end -->
310348

311349
<p align="right">(<a href="#top">back to top</a>)</p>

0 commit comments

Comments
 (0)