Skip to content

Commit 21a192f

Browse files
committed
docs: copy edited readme dx-2276
1 parent 68b5c0b commit 21a192f

File tree

1 file changed

+66
-69
lines changed

1 file changed

+66
-69
lines changed

README.md

Lines changed: 66 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
# Advanced Wallets
22

3-
A secure, mTLS-enabled cryptocurrency signing server with two operational modes: Advanced Wallet Manager (dedicated signer) and Master Express (API gateway with integrated signing capabilities).
3+
Advanced wallets are a type of self-custody cryptocurrency wallet that securely enable mutual TLS (mTLS) signing servers with two operational modes:
4+
5+
- **Advanced Wallet Manager Mode** - A lightweight, dedicated keygen/signing server that you can use for secure key operations. This mode includes support for wallet recoveries.
6+
- **Master Express Mode** - An Express application that's the orchestrator between the Advanced Wallet Manager and [BitGo APIs](https://developers.bitgo.com/reference/overview#/). This mode serves as an API gateway with integrated signing capabilities.
7+
8+
Security includes:
9+
10+
- **mTLS Security** - Client certificate validation for secure communications.
11+
- **Flexible Configuration** - Environment-based setup with file or variable-based certificates.
412

513
## Table of Contents
614

7-
- [Overview](#overview)
815
- [Architecture](#architecture)
916
- [Installation](#installation)
1017
- [Prerequisites](#prerequisites)
@@ -18,55 +25,45 @@ A secure, mTLS-enabled cryptocurrency signing server with two operational modes:
1825
- [Production Setup](#production-setup)
1926
- [License](#license)
2027

21-
## Overview
22-
23-
This application provides secure cryptocurrency operations with mutual TLS (mTLS) authentication:
24-
25-
- **Advanced Wallet Manager Mode**: Lightweight keygen/signing server for secure key operations. Includes support for recovery.
26-
- **Master Express Mode**: An express app that acts as the orchestrator between the Advanced Wallet Manager and BitGo APIs.
27-
- **mTLS Security**: Client certificate validation for secure communications
28-
- **Flexible Configuration**: Environment-based setup with file or variable-based certificates
29-
3028
## Architecture
3129

32-
- **Advanced Wallet Manager** (Port 3080): Isolated signing server with no internet access, only connects to KMS API for key operations.
33-
- **Master Express** (Port 3081): API gateway providing end-to-end wallet creation and transaction support, integrating BitGo APIs with secure communication to Advanced Wallet Manager
30+
- **Advanced Wallet Manager** (Port 3080) - An isolated signing server with no internet access that only connects to the key management service (KMS) API for key operations.
31+
- **Master Express** (Port 3081) - An API gateway providing end-to-end wallet creation and transaction support, integrating [BitGo APIs](https://developers.bitgo.com/reference/overview#/) with secure communication to Advanced Wallet Manager.
3432

3533
## Installation
3634

3735
### Prerequisites
3836

39-
- **Node.js** 22.1.0 or higher
40-
- **npm** or **yarn** package manager
41-
- **OpenSSL** for certificate generation
42-
- **Docker** and **Docker Compose** (for containerized deployment)
43-
- **Podman** (alternative to Docker for containerized deployment)
44-
- **KMS API Implementation** - Advanced Wallet Manager requires a KMS (Key Management Service) API for secure key operations. See implementation guides:
37+
- **Node.js** 22.1.0 or higher.
38+
- **npm** or **yarn** package manager.
39+
- **OpenSSL** for certificate generation.
40+
- **Docker** and **Docker Compose** for containerized deployment (or you can use **Podman** as alternative to Docker).
41+
- **KMS API Implementation** - Advanced Wallet Manager requires a KMS API for secure key operations. For example:
4542
- [AWS HSM Implementation](./demo-kms-script/aws-interface.md)
4643
- [Dinamo HSM Implementation](./demo-kms-script/dinamo-interface.md)
4744

4845
### Setup
4946

50-
1. **Clone the repository:**
47+
#### 1. Clone the Repository
5148

5249
```bash
5350
git clone <repository-url>
5451
cd advanced-wallets
5552
```
5653

57-
2. **Install dependencies:**
54+
#### 2. Install Dependencies
5855

5956
```bash
6057
npm install
6158
```
6259

63-
3. **Build the project:**
60+
#### 3. Build the Project
6461

6562
```bash
6663
npm run build
6764
```
6865

69-
4. **Generate test certificates (optional):**
66+
#### 4. Generate Test Certificates (Optional)
7067

7168
```bash
7269
# Generate private key and certificate for testing
@@ -117,7 +114,7 @@ npm start
117114

118115
#### 2. Start Master BitGo Express (Port 3081)
119116

120-
In a new terminal:
117+
Run the following in a new terminal:
121118

122119
```bash
123120
TLS_MODE=disabled \
@@ -128,7 +125,7 @@ ADVANCED_WALLET_MANAGER_URL=http://localhost:3080 \
128125
npm start
129126
```
130127

131-
#### 3. Test the Connection
128+
#### 3. Test Connection
132129

133130
```bash
134131
# Test Advanced Wallet Manager
@@ -141,7 +138,7 @@ curl -X POST http://localhost:3081/ping
141138
curl -X POST http://localhost:3081/ping/advancedWalletManager
142139
```
143140

144-
**Note:** `TLS_MODE=disabled` should only be used for local development and testing. Always use mTLS in production environments. See the [Production Setup](#production-setup) section for production mTLS configuration.
141+
> **Note:** You should only use `TLS_MODE=disabled` for local development and testing. Always use mTLS in production environments. For information about configuring mTLS in production, see the [Production Setup](#production-setup) section.
145142
146143
## Configuration
147144

@@ -162,7 +159,7 @@ curl -X POST http://localhost:3081/ping/advancedWalletManager
162159
| `ADVANCED_WALLET_MANAGER_PORT` | Port to listen on | `3080` ||
163160
| `KMS_URL` | KMS service URL | - ||
164161

165-
**Note:** See [Prerequisites](#prerequisites) for KMS API implementation requirements.
162+
> **Note:** For KMS API implementation requirements, see the [Prerequisites](#prerequisites).
166163
167164
### Master Express Settings
168165

@@ -236,7 +233,7 @@ curl -X POST http://localhost:3081/ping/advancedWalletManager
236233
| `KMS_SERVER_CA_CERT` | KMS server CA certificate (alternative) | PEM string |
237234
| `KMS_SERVER_CERT_ALLOW_SELF_SIGNED` | Allow self-signed KMS server certificates | Boolean (default: `false`) |
238235

239-
**Note:** When `TLS_MODE=mtls`, outbound client certificates are required and cannot reuse server certificates for security reasons. In `TLS_MODE=disabled` mode, these certificates are not required.
236+
> **Note:** For security reasons, when `TLS_MODE=mtls`, outbound client certificates are required and cannot reuse server certificates. When `TLS_MODE=disabled`, these certificates aren't required.
240237
241238
## Container Deployment with Podman
242239

@@ -256,7 +253,7 @@ npm run container:build:advanced-wallet-manager -- --build-arg PORT=3082
256253

257254
### Run Containers
258255

259-
For local development, you'll need to run both the Advanced Wallet Manager and Master Express containers:
256+
For local development, you must run both the Advanced Wallet Manager and the Master Express containers:
260257

261258
```bash
262259
# Start Advanced Wallet Manager container
@@ -307,11 +304,11 @@ curl -k --cert certs/test-ssl-cert.pem --key certs/test-ssl-key.pem -X POST http
307304
curl -k -X POST https://localhost:3081/ping/advancedWalletManager
308305
```
309306

310-
**Notes:**
311-
312-
- `host.containers.internal` is a special DNS name that resolves to the host machine from inside containers
313-
- The `:Z` option in volume mounts is specific to SELinux-enabled systems and ensures proper volume labeling
314-
- The logs directory will be created with appropriate permissions if it doesn't exist
307+
>**Note:**
308+
>
309+
> - `host.containers.internal` is a special DNS name that resolves to the host machine from inside containers.
310+
> - The `:Z` option in volume mounts is specific to SELinux-enabled systems and ensures proper volume labeling.
311+
> - The logs directory is created with appropriate permissions if it doesn't already exist.
315312
316313
## Docker Compose Deployment
317314

@@ -321,9 +318,9 @@ The application includes a Docker Compose configuration that runs both Advanced
321318

322319
The Docker Compose setup creates two isolated services:
323320

324-
- **Advanced Wallet Manager (AWM)**: Runs in an isolated internal network with no external access for maximum security
325-
- **Master BitGo Express (MBE)**: Connected to both internal network (for AWM communication) and public network (for external API access)
326-
- **Network Isolation**: AWM is completely isolated from external networks and only accessible through MBE
321+
- **Advanced Wallet Manager (AWM)**: Runs in an isolated internal network with no external access for maximum security.
322+
- **Master BitGo Express (MBE)**: Connects to both internal network (for AWM communication) and public network (for external API access).
323+
- **Network Isolation**: AWM is completely isolated from external networks and only accessible through MBE.
327324

328325
### Network Configuration
329326

@@ -347,7 +344,7 @@ The setup creates two distinct networks:
347344

348345
### Quick Start
349346

350-
1. **Start the services:**
347+
#### 1. Start Services
351348

352349
```bash
353350
# Navigate to project directory
@@ -357,7 +354,7 @@ cd advanced-wallet
357354
docker-compose up -d
358355
```
359356

360-
2. **Stop the services:**
357+
#### 2. Stop Services
361358

362359
```bash
363360
# Stop and remove containers
@@ -368,38 +365,38 @@ docker-compose down
368365

369366
### Advanced Wallet Manager (Port 3080)
370367

371-
- `POST /ping` - Health check
372-
- `GET /version` - Version information
373-
- `POST /:coin/key/independent` - Generate independent keychain
368+
- `POST /ping` - Health check.
369+
- `GET /version` - Version information.
370+
- `POST /:coin/key/independent` - Generate independent keychain.
374371

375372
### Master Express (Port 3081)
376373

377-
- `POST /ping` - Health check
378-
- `GET /version` - Version information
379-
- `POST /ping/advancedWalletManager` - Test connection to Advanced Wallet Manager
380-
- `POST /api/:coin/wallet/generate` - Generate wallet (with Advanced Wallet Manager integration)
374+
- `POST /ping` - Health check.
375+
- `GET /version` - Version information.
376+
- `POST /ping/advancedWalletManager` - Test connection to Advanced Wallet Manager.
377+
- `POST /api/:coin/wallet/generate` - Generate wallet (with Advanced Wallet Manager integration).
381378

382379
### API Documentation
383380

384381
**Master Express OpenAPI Specification**
385382

386-
The OpenAPI specification for Master Express is available at [`masterBitgoExpress.json`](./masterBitgoExpress.json).
383+
You can vew the OpenAPI specification for Master Express at [`masterBitgoExpress.json`](./masterBitgoExpress.json).
387384

388385
To regenerate the API documentation:
389386

390387
```bash
391388
npm run generate:openapi:masterExpress
392389
```
393390

394-
This will generate/update the `masterBitgoExpress.json` file with the latest API specification. You can view this file with any OpenAPI viewer such as:
391+
This generates or updates the `masterBitgoExpress.json` file with the latest API specification. You can view this file with any OpenAPI viewer such as:
395392

396393
- [Swagger Editor](https://editor.swagger.io/)
397394
- [Redoc](https://redocly.github.io/redoc/)
398395
- VS Code OpenAPI extensions
399396

400397
## Production Setup
401398

402-
### Quick Start (With mTLS)
399+
### Quick Start (with mTLS)
403400

404401
For production deployments with proper mTLS security:
405402

@@ -427,7 +424,7 @@ npm start
427424

428425
#### 2. Start Master Express (Port 3081)
429426

430-
In a new terminal:
427+
Run the following in a new terminal:
431428

432429
```bash
433430
export APP_MODE=master-express
@@ -449,9 +446,9 @@ export MTLS_ALLOWED_CLIENT_FINGERPRINTS=sha256:7g8h9i...,sha256:0j1k2l...
449446
npm start
450447
```
451448

452-
#### 3. Test the Connection
449+
#### 3. Test Connection
453450

454-
For testing, you can use the server's IP address or `localhost` if running locally. In production deployments, configure your DNS or load balancer to point to the appropriate servers.
451+
For testing, you can use the IP address of the server or `localhost` if you're running it locally. In production deployments, configure your DNS or load balancer to point to the appropriate servers.
455452

456453
```bash
457454
# Test Advanced Wallet Manager (replace localhost with your server IP/hostname)
@@ -474,20 +471,20 @@ curl --cert /path/to/client-cert.crt --key /path/to/client-key.key \
474471

475472
For local testing, you can generate and use demo certificates with the self-signed configuration flags:
476473

477-
- Generate demo certificates: `npm run generate-test-ssl` (creates `demo.key` and `demo.crt`)
478-
- Set `CLIENT_CERT_ALLOW_SELF_SIGNED=true`, `KMS_SERVER_CERT_ALLOW_SELF_SIGNED=true`, and `AWM_SERVER_CERT_ALLOW_SELF_SIGNED=true`
479-
- Use the demo certificates for all certificate paths (server and client)
480-
- **Important:** Demo certificates and self-signed configurations should never be used in production
474+
- Generate demo certificates: `npm run generate-test-ssl` (creates `demo.key` and `demo.crt`).
475+
- Set `CLIENT_CERT_ALLOW_SELF_SIGNED=true`, `KMS_SERVER_CERT_ALLOW_SELF_SIGNED=true`, and `AWM_SERVER_CERT_ALLOW_SELF_SIGNED=true`.
476+
- Use the demo certificates for all certificate paths (server and client).
477+
- **Important:** Demo certificates and self-signed configurations should never be used in production.
481478

482479
### Best Practices
483480

484-
1. **Use CA-signed certificates** instead of self-signed
485-
2. **Set `CLIENT_CERT_ALLOW_SELF_SIGNED=false`** and server-specific allow self-signed flags to `false` in production
486-
3. **Configure client certificate allowlisting** with `MTLS_ALLOWED_CLIENT_FINGERPRINTS`
487-
4. **Use separate certificates** for each service (server, AWM client, KMS client)
488-
5. **Regularly rotate certificates**
489-
6. **Secure private key storage** and use appropriate file permissions
490-
7. **Always use `TLS_MODE=mtls`** in production environments
481+
1. **Use CA-signed certificates** instead of self-signed.
482+
2. **Set `CLIENT_CERT_ALLOW_SELF_SIGNED=false`** and server-specific allow self-signed flags to `false` in production.
483+
3. **Configure client certificate allowlisting** with `MTLS_ALLOWED_CLIENT_FINGERPRINTS`.
484+
4. **Use separate certificates** for each service (server, AWM client, KMS client).
485+
5. **Regularly rotate certificates**.
486+
6. **Secure private key storage** and use appropriate file permissions.
487+
7. **Always use `TLS_MODE=mtls`** in production environments.
491488

492489
### Certificate Management
493490

@@ -499,20 +496,20 @@ To obtain certificate fingerprints for `MTLS_ALLOWED_CLIENT_FINGERPRINTS`:
499496
openssl x509 -in /path/to/client-cert.crt -noout -fingerprint -sha256 | cut -d'=' -f2
500497
```
501498

502-
The output will be in the format: `sha256:AB:CD:EF:...` which you can use in the configuration.
499+
The output format is: `sha256:AB:CD:EF:...` which you can use in the configuration.
503500

504501
#### Certificate Requirements for Production
505502

506-
- All certificates should be CA-signed certificates issued by your organization's PKI
507-
- Each service must use separate certificates (server cert, AWM client cert, KMS client cert)
508-
- Client certificates for outbound connections must be different from server certificates
503+
- All certificates should be CA-signed certificates issued by your organization's PKI.
504+
- Each service must use separate certificates (server cert, AWM client cert, KMS client cert).
505+
- Client certificates for outbound connections must be different from server certificates.
509506
- Store private keys in secure locations with restricted file permissions:
510507
```bash
511508
chmod 400 /secure/certs/*.key
512509
chown root:root /secure/certs/*.key
513510
```
514-
- Use `BIND=0.0.0.0` only if the service needs to be accessible from other machines
515-
- Regularly rotate certificates according to your security policy
511+
- Use `BIND=0.0.0.0` only if the service needs to be accessible from other machines.
512+
- Regularly rotate certificates according to your security policy.
516513

517514
## License
518515

0 commit comments

Comments
 (0)