@barusu/tool-git-cipher
- Fully encrypt the git repository
-
Prepare a directory
plaintextRootDir
, which tracks (or uses it as the source repository directly) the git repository to be encrypted. Every time the encrypt command is executed, the content under the pathplaintextRootDir
will be encrypted and stored into directoryciphertextRootDir
, and the structure of the file will be saved inindexFilepath
. -
Support incremental update content, determine whether the file needs to be re-encrypted by comparing the latest modified time of the source file.
-
The secret key to encrypt the
plaintextRootDir
directory is encrypted by a password entered by the user and saved in thesecretFilepath
file. This file also saves the encrypted result of the mac value of the original key, which is used to verify whether the subsequent input password is correct. -
Default algorithm
AES-256 gcm
.
-
Install
npm install -g @barusu/tool-git-cipher
-
yarn
yarn global add @barusu/tool-git-cipher
Usage
-
init
barusu-git-cipher init <workspace dir>
-
encrypt
barusu-git-cipher encrypt <workspace dir>
-
decrypt
barusu-git-cipher decrypt <workspace dir>
Options
Overview
$ barusu-git-cipher --help
Usage: barusu-git-cipher [options] [command]
Options:
-V, --version output the version number
--log-level <level> specify logger's level.
--log-name <name> specify logger's name.
--log-mode <'normal' | 'loose'> specify logger's name.
--log-flag <option> specify logger' option. [[no-]<date|colorful|inline>] (default: [])
--log-output <filepath> specify logger' output path.
--log-encoding <encoding> specify output file encoding.
-c, --config-path <config filepath> (default: [])
--parastic-config-path <parastic config filepath>
--parastic-config-entry <parastic config filepath>
--encoding <encoding> default encoding of files in the workspace
--secret-filepath <secretFilepath> path of secret file
--secret-file-encoding <secretFileEncoding> encoding of secret file
--index-filepath <indexFilepath> path of index file of ciphertext files
--index-file-encoding <indexFileEncoding> encoding of index file
--ciphertext-root-dir <ciphertextRootDir> the directory where the encrypted files are stored
--plaintext-root-dir <plaintextRootDir> the directory where the source plaintext files are stored
--show-asterisk whether to print password asterisks
--minimum-password-length the minimum size required of password
-h, --help display help for command
Commands:
init|i <workspace>
encrypt|e [options] <workspace>
decrypt|d <workspace>
help [command] display help for command
init
$ barusu-git-cipher init --help
Usage: barusu-git-cipher init|i [options] <workspace>
Options:
-h, --help display help for command
encrypt
$ barusu-git-cipher encrypt --help
Usage: barusu-git-cipher encrypt|e [options] <workspace>
Options:
--full full quantity update
--update-before-encrypt perform 'git fetch --all' before run encryption
-h, --help display help for command
decrypt
$ barusu-git-cipher decrypt --help
Usage: barusu-git-cipher decrypt|d [options] <workspace>
Options:
--out-dir <outDir> root dir of outputs (decrypted files)
-h, --help display help for command
Examples
-
Basic:
You can specify configs into
package.json
like below:{ "name": "private-repository-demo", "version": "0.0.0", "private": true, "scripts": { "encrypt": "barusu-git-cipher encrypt .", "decrypt": "barusu-git-cipher decrypt ." }, "devDependencies": { "@barusu/tool-git-cipher": "^0.0.23" }, "@barusu/tool-git-cipher": { "__globalOptions__": { "logLevel": "info", "encoding": "utf-8", "secretFilepath": ".barusu-secret", "secretFileEncoding": "utf-8", "indexFilepath": ".barusu-index", "indexFileEncoding": "utf-8", "ciphertextRootDir": "barusu-ciphertext", "plaintextRootDir": "barusu-plaintext", "showAsterisk": true }, "encrypt": { "updateBeforeEncrypt": true }, "decrypt": { "outDir": "barusu-plaintext-bak" } } }
While
__globalOptions__
is the global option,encrypt
is the option for the sub-commandencrypt
and etc.