85 lines
3.4 KiB
Markdown
85 lines
3.4 KiB
Markdown
# Native CLI
|
|
|
|
This is a command-line terminal interface to the Master Password standard implementation.
|
|
|
|
To use the app, you'll first need to build it, then install it into your system's PATH.
|
|
|
|
|
|
## Building
|
|
|
|
To build the code to run on your specific system, run the `build` command:
|
|
|
|
./build
|
|
|
|
Note that the build depends on your system having certain dependencies already installed.
|
|
By default, you'll need to have at least `libsodium`, `libjson-c` and `libncurses` installed.
|
|
|
|
|
|
### Details
|
|
|
|
The build script comes with a default configuration which can be adjusted. Full details on the build script are available by opening the build script file.
|
|
|
|
[targets='...'] [mpw_feature=0|1 ...] [CFLAGS='...'] [LDFLAGS='...'] ./build [cc arguments ...]
|
|
|
|
By default, the build script only builds the `mpw` target. You can specify other targets or `all` to build all available targets. These are the currently available targets:
|
|
|
|
- `mpw` : The main app. It needs: `mpw_sodium`, optionally supports: `mpw_color`, `mpw_json`.
|
|
- `mpw-bench` : A benchmark utility. It needs: `mpw_sodium`.
|
|
- `mpw-tests` : An algorithm test suite. It needs: `mpw_sodium`, `mpw_xml`.
|
|
|
|
It is smart to build the test suite along with the app, eg.:
|
|
|
|
targets='mpw mpw-tests' ./build
|
|
|
|
The needed and supported features determine the dependencies that the build will require. The following features exist:
|
|
|
|
- `mpw_sodium` : Use Sodium for the crypto implementation. It needs libsodium.
|
|
- `mpw_json` : Support JSON-based user configuration format. It needs libjson-c.
|
|
- `mpw_color` : Show a colorized identicon. It needs libncurses.
|
|
- `mpw_xml` : Support XML parsing. It needs libxml2.
|
|
|
|
By default, all features are enabled. Each feature can be disabled or enabled explicitly by prefixing the build command with an assignment of it to `0` or `1`, eg.:
|
|
|
|
mpw_color=0 ./build
|
|
|
|
As a result of this command, you'd build the `mpw` target (which supports `mpw_color`) without color support. The build no longer requires `libncurses` but the resulting `mpw` binary will not have support for colorized identicons.
|
|
|
|
You can also pass CFLAGS or LDFLAGS to the build, or extra custom compiler arguments as arguments to the build script.
|
|
For instance, to add a custom library search path, you could use:
|
|
|
|
LDFLAGS='-L/usr/local/lib' ./build
|
|
|
|
|
|
## Testing
|
|
|
|
Once the client is built, you should run a test suite to make sure everything works as intended.
|
|
|
|
There are currently two test suites:
|
|
|
|
- `mpw-tests` : Tests the Master Password algorithm implementation.
|
|
- `mpw-cli-tests` : Tests the CLI application.
|
|
|
|
The `mpw-tests` suite is only available if you enabled its target during build (see "Details" above).
|
|
|
|
The `mpw-cli-tests` is a Bash shell script, hence depends on your system having Bash available.
|
|
|
|
|
|
## Installing
|
|
|
|
Once you're happy with the result, you can install the `mpw` application into your system's `PATH`.
|
|
|
|
Generally, all you need to do is copy the `mpw` file into a PATH directory, eg.:
|
|
|
|
cp mpw /usr/local/bin/
|
|
|
|
The directory that you should copy the `mpw` file into will depend on your system. Also note that `cp` is a POSIX command, if your system is not a POSIX system (eg. Windows) you'll need to adjust accordingly.
|
|
|
|
There is also an `install` script to help with this process, though it is a Bash script and therefore requires that you have Bash installed:
|
|
|
|
./install
|
|
|
|
After installing, you should be able to run `mpw` and use it from anywhere in the terminal:
|
|
|
|
mpw -h
|
|
mpw google.com
|