feat: add CLI commands and server default behavior
- Introduced CLI commands for server, login, upload, sign, verify, and more using `clap`. - Updated Dockerfile and docker-compose to default to `server` command on startup. - Enhanced `test_local.sh` for testing the server and client operations. - Added multipart support to `reqwest` and new CLI documentation in `README.md`. - Updated `Cargo.toml` with new dependencies to support CLI and multipart uploads.
This commit is contained in:
parent
c662dfbfd8
commit
26e81cef17
7 changed files with 461 additions and 29 deletions
42
README.md
42
README.md
|
@ -7,6 +7,7 @@ This project implements a hierarchical document signing system using HashiCorp V
|
|||
- **Hierarchical Signing**: Requires 3 of 5 signatures to validate a document, with at least 1 signature from each department
|
||||
- **Department Structure**: Two departments (Legal and Finance) with 5 users each
|
||||
- **Document API**: Upload, sign, and verify documents through a RESTful API
|
||||
- **CLI Client**: Interact with the system through command-line interface
|
||||
- **Vault Integration**: Leverages HashiCorp Vault's Transit engine for cryptographic operations
|
||||
|
||||
## System Architecture
|
||||
|
@ -50,7 +51,46 @@ The system consists of:
|
|||
- Legal department: legal1/legal1pass through legal5/legal5pass
|
||||
- Finance department: finance1/finance1pass through finance5/finance5pass
|
||||
|
||||
### API Usage Examples
|
||||
### CLI Commands
|
||||
|
||||
The project includes a command-line interface to interact with the API:
|
||||
|
||||
1. **Start the Server**:
|
||||
```bash
|
||||
cargo run server [--vault-addr URL] [--api-port PORT]
|
||||
```
|
||||
|
||||
2. **Login**:
|
||||
```bash
|
||||
cargo run login --username USER --password PASS [--api-url URL]
|
||||
```
|
||||
|
||||
3. **Upload Document**:
|
||||
```bash
|
||||
cargo run upload --name NAME --file PATH [--api-url URL]
|
||||
```
|
||||
|
||||
4. **Sign Document**:
|
||||
```bash
|
||||
cargo run sign --document-id ID --username USER --token TOKEN [--api-url URL]
|
||||
```
|
||||
|
||||
5. **Verify Document**:
|
||||
```bash
|
||||
cargo run verify --document-id ID [--api-url URL]
|
||||
```
|
||||
|
||||
6. **List Documents**:
|
||||
```bash
|
||||
cargo run list [--api-url URL]
|
||||
```
|
||||
|
||||
7. **Get Document Details**:
|
||||
```bash
|
||||
cargo run get --document-id ID [--api-url URL]
|
||||
```
|
||||
|
||||
### API Usage Examples (curl)
|
||||
|
||||
1. **Login**:
|
||||
```bash
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue