Skip to content

Commit 42b7b35

Browse files
authored
Merge pull request #100 from BitGo/WP-5298-rename-enclave-to-akm
feat(mbe, awm): switch to advanced wallet manager naming
2 parents be461c2 + 0e4877b commit 42b7b35

File tree

85 files changed

+932
-754
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+932
-754
lines changed

.commitlintrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"header-max-length": [2, "always", 72],
66
"references-empty": [1, "never"],
77
"subject-case": [0],
8-
"scope-enum": [2, "always", ["mbe", "ebe", "docker"]],
8+
"scope-enum": [2, "always", ["mbe", "awm", "docker"]],
99
"scope-empty": [0, "never"]
1010
},
1111
"parserPreset": {

CLAUDE.md

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,46 +5,53 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
55
## Commands
66

77
### Development
8+
89
- `npm start` - Start the application in development mode using nodemon for auto-reloading
910
- `npm run build` - Build the TypeScript code (creates /dist folder)
1011
- `npm run lint` - Run ESLint to check for code issues
1112
- `npm run lint:fix` - Run ESLint and automatically fix issues when possible
1213

1314
### Testing
15+
1416
- `npm test` - Run all tests
1517
- `npm run test:watch` - Run tests in watch mode
1618
- `npm run test:coverage` - Run tests with coverage report
1719
- `npm run generate-test-ssl` - Generate self-signed SSL certificates for testing
1820

1921
### Container
22+
2023
- `npm run container:build` - Build the container image using Podman (optionally use --build-arg PORT=3080)
2124

2225
## Architecture Overview
2326

24-
Enclaved BitGo Express is a secure cryptocurrency signing server with two operational modes:
27+
Advanced Wallet Manager is a secure cryptocurrency signing server with two operational modes:
28+
29+
### 1. Advanced Wallet Manager Mode (`APP_MODE=advanced-wallet-manager`)
2530

26-
### 1. Enclaved Express Mode (`APP_MODE=enclaved`)
2731
- Lightweight server focused solely on secure signing operations
2832
- Runs on port 3080 by default
2933
- Integrates with KMS for key management
3034
- Handles cryptographic operations securely
3135
- Exposes minimal endpoints focused on key generation and signing
3236

3337
### 2. Master Express Mode (`APP_MODE=master-express`)
38+
3439
- Full BitGo API functionality with integrated signing capabilities
3540
- Runs on port 3081 by default
36-
- Acts as an API gateway and communicates with Enclaved Express for signing operations
41+
- Acts as an API gateway and communicates with Advanced Wallet Manager for signing operations
3742
- Provides a broader set of BitGo wallet operations and transaction handling
3843

3944
### Security Architecture
45+
4046
- Both modes support mutual TLS (mTLS) authentication
4147
- Certificates can be loaded from files or environment variables
4248
- Client certificate validation for secure communications
4349
- Option to validate client certificate fingerprints
4450

4551
### Code Structure
52+
4653
- `src/app.ts` - Main entry point that determines mode and starts the appropriate app
47-
- `src/enclavedApp.ts` - Enclaved Express mode implementation
54+
- `src/advancedWalletManagerApp.ts` - Advanced Wallet Manager mode implementation
4855
- `src/masterExpressApp.ts` - Master Express mode implementation
4956
- `src/initConfig.ts` - Configuration loading and validation
5057
- `src/routes/` - Express routes for both modes
@@ -53,23 +60,27 @@ Enclaved BitGo Express is a secure cryptocurrency signing server with two operat
5360
- `src/shared/` - Shared utilities and types
5461

5562
### Configuration
63+
5664
Configuration is managed through environment variables with defaults defined in `src/initConfig.ts`. The application requires specific environment variables depending on the mode:
5765

5866
#### Common Variables
59-
- `APP_MODE` - Set to "enclaved" or "master-express"
67+
68+
- `APP_MODE` - Set to "advanced-wallet-manager" or "master-express"
6069
- `TLS_MODE` - Set to "mtls" or "disabled"
6170
- `BIND` - Address to bind to (default: localhost)
6271
- `TIMEOUT` - Request timeout in milliseconds (default: 305000)
6372

64-
#### Enclaved Mode Specific
65-
- `ENCLAVED_EXPRESS_PORT` - Port to listen on (default: 3080)
73+
#### Advanced Wallet Manager Mode Specific
74+
75+
- `ADVANCED_WALLET_MANAGER_PORT` - Port to listen on (default: 3080)
6676
- `KMS_URL` - Required KMS service URL
6777

6878
#### Master Express Mode Specific
79+
6980
- `MASTER_EXPRESS_PORT` - Port to listen on (default: 3081)
7081
- `BITGO_ENV` - BitGo environment (default: test)
71-
- `ENCLAVED_EXPRESS_URL` - Required URL for the Enclaved Express server
72-
- `ENCLAVED_EXPRESS_CERT` - Required path to Enclaved Express certificate
82+
- `ADVANCED_WALLET_MANAGER_URL` - Required URL for the Advanced Wallet Manager
83+
- `ADVANCED_WALLET_MANAGER_CERT` - Required path to Advanced Wallet Manager certificate
7384

7485

7586
## Abbreviations and Nomenclature
@@ -95,7 +106,7 @@ API responses follow a standard error format with `error` and `details` fields.
95106

96107
## API Endpoints
97108

98-
### Enclaved Express (Port 3080)
109+
### Advanced Wallet Manager (Port 3080)
99110

100111
#### Health and Information
101112
- `POST /ping` - Health check
@@ -120,19 +131,23 @@ API responses follow a standard error format with `error` and `details` fields.
120131
### Master Express (Port 3081)
121132

122133
#### Health and Status Endpoints
134+
123135
- `POST /ping` - Health check
124136
- `GET /version` - Version information
125-
- `POST /ping/enclavedExpress` - Test connection to Enclaved Express
126-
- `GET /version/enclavedExpress` - Get Enclaved Express version information
137+
- `POST /ping/advancedWalletManager` - Test connection to Advanced Wallet Manager
138+
- `GET /version/advancedWalletManager` - Get Advanced Wallet Manager version information
127139

128140
#### Wallet Management
141+
129142
- `POST /api/:coin/wallet/generate` - Generate wallet (supports onchain and TSS multisig types)
130143

131144
#### Transaction Operations
145+
132146
- `POST /api/:coin/wallet/:walletId/sendMany` - Send transaction with multiple recipients
133147
- `POST /api/:coin/wallet/:walletId/accelerate` - Accelerate pending transactions (CPFP/RBF)
134148
- `POST /api/:coin/wallet/:walletId/consolidate` - Consolidate wallet addresses
135149
- `POST /api/:coin/wallet/:walletId/consolidateunspents` - Consolidate unspent transaction outputs
136150

137151
#### Recovery
138-
- `POST /api/:coin/wallet/recovery` - Recover wallet funds
152+
153+
- `POST /api/:coin/wallet/recovery` - Recover wallet funds

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ RUN --mount=type=cache,target=/usr/src/app/.npm-cache \
4848
COPY . .
4949

5050
# Build TypeScript code with deterministic output
51-
RUN npm run build
51+
RUN npm run build
5252

5353
FROM node:22.1.0-alpine@sha256:487dc5d5122d578e13f2231aa4ac0f63068becd921099c4c677c850df93bede8 AS production
5454

@@ -91,4 +91,4 @@ USER bitgo
9191
EXPOSE ${PORT}
9292

9393
# Start the application using the binary
94-
CMD ["./bin/enclaved-bitgo-express"]
94+
CMD ["./bin/advanced-wallet-manager"]

README.md

Lines changed: 39 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
1-
# Enclaved BitGo Express
1+
# Advanced Wallet Manager
22

3-
A secure, mTLS-enabled cryptocurrency signing server with two operational modes: Enclaved Express (dedicated signer) and Master Express (API gateway with integrated signing capabilities).
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).
44

55
## Overview
66

77
This application provides secure cryptocurrency operations with mutual TLS (mTLS) authentication:
88

9-
- **Enclaved Mode**: Lightweight signing server for secure key operations
9+
- **Advanced Wallet Manager Mode**: Lightweight signing server for secure key operations
1010
- **Master Express Mode**: Full BitGo Express functionality with integrated signing
1111
- **mTLS Security**: Client certificate validation for secure communications
1212
- **Flexible Configuration**: Environment-based setup with file or variable-based certificates
1313

1414
## Architecture
1515

16-
- **Enclaved Express** (Port 3080): Focused signing operations with KMS integration
17-
- **Master Express** (Port 3081): Full BitGo API functionality with secure communication to Enclaved Express
16+
- **Advanced Wallet Manager** (Port 3080): Focused signing operations with KMS integration
17+
- **Master Express** (Port 3081): Full BitGo API functionality with secure communication to Advanced Wallet Manager
1818

1919
## Configuration
2020

2121
Configuration is managed through environment variables:
2222

2323
### Required Settings
2424

25-
- `APP_MODE` - Application mode (required: "enclaved" or "master-express")
25+
- `APP_MODE` - Application mode (required: "advanced-wallet-manager" or "master-express")
2626

2727
### Network Settings
2828

@@ -31,9 +31,9 @@ Configuration is managed through environment variables:
3131
- `KEEP_ALIVE_TIMEOUT` - Keep-alive timeout (optional)
3232
- `HEADERS_TIMEOUT` - Headers timeout (optional)
3333

34-
#### Enclaved Mode Specific
34+
#### Advanced Wallet Manager Mode Specific
3535

36-
- `ENCLAVED_EXPRESS_PORT` - Port to listen on (default: 3080)
36+
- `ADVANCED_WALLET_MANAGER_PORT` - Port to listen on (default: 3080)
3737
- `KMS_URL` - KMS service URL (required)
3838

3939
#### Master Express Mode Specific
@@ -44,8 +44,8 @@ Configuration is managed through environment variables:
4444
- `BITGO_AUTH_VERSION` - Authentication version (default: 2)
4545
- `BITGO_CUSTOM_ROOT_URI` - Custom BitGo API root URI (optional)
4646
- `BITGO_CUSTOM_BITCOIN_NETWORK` - Custom Bitcoin network (optional)
47-
- `ENCLAVED_EXPRESS_URL` - Enclaved Express server URL (required)
48-
- `ENCLAVED_EXPRESS_CERT` - Path to Enclaved Express server certificate (required)
47+
- `ADVANCED_WALLET_MANAGER_URL` - Advanced Wallet Manager URL (required)
48+
- `ADVANCED_WALLET_MANAGER_CERT` - Path to Advanced Wallet Manager certificate (required)
4949

5050
### TLS/mTLS Configuration
5151

@@ -100,10 +100,10 @@ openssl genrsa -out server.key 2048
100100
openssl req -new -x509 -key server.key -out server.crt -days 365 -subj "/CN=localhost"
101101
```
102102

103-
### 2. Start Enclaved Express
103+
### 2. Start Advanced Wallet Manager
104104

105105
```bash
106-
export APP_MODE=enclaved
106+
export APP_MODE=advanced-wallet-manager
107107
export KMS_URL=https://your-kms-service
108108
export TLS_KEY_PATH=./server.key
109109
export TLS_CERT_PATH=./server.crt
@@ -121,19 +121,19 @@ export APP_MODE=master-express
121121
export BITGO_ENV=test
122122
export TLS_KEY_PATH=./server.key
123123
export TLS_CERT_PATH=./server.crt
124-
export ENCLAVED_EXPRESS_URL=https://localhost:3080
125-
export ENCLAVED_EXPRESS_CERT=./server.crt
124+
export ADVANCED_WALLET_MANAGER_URL=https://localhost:3080
125+
export ADVANCED_WALLET_MANAGER_CERT=./server.crt
126126
export MTLS_REQUEST_CERT=false
127127
export ALLOW_SELF_SIGNED=true
128128
npm start
129129
```
130130

131131
### 5. Test the Connection
132132

133-
Test that Master Express can communicate with Enclaved Express:
133+
Test that Master Express can communicate with Advanced Wallet Manager:
134134

135135
```bash
136-
curl -k -X POST https://localhost:3081/ping/enclavedExpress
136+
curl -k -X POST https://localhost:3081/ping/advancedWalletManager
137137
```
138138

139139
## Production Configuration
@@ -149,13 +149,13 @@ curl -k -X POST https://localhost:3081/ping/enclavedExpress
149149

150150
### Production Setup Example
151151

152-
#### Enclaved Express (Production)
152+
#### Advanced Wallet Manager (Production)
153153

154154
```bash
155-
export APP_MODE=enclaved
155+
export APP_MODE=advanced-wallet-manager
156156
export KMS_URL=https://production-kms.example.com
157-
export TLS_KEY_PATH=/secure/path/enclaved.key
158-
export TLS_CERT_PATH=/secure/path/enclaved.crt
157+
export TLS_KEY_PATH=/secure/path/advanced-wallet-manager.key
158+
export TLS_CERT_PATH=/secure/path/advanced-wallet-manager.crt
159159
export MTLS_REQUEST_CERT=true
160160
export ALLOW_SELF_SIGNED=false
161161
export MTLS_ALLOWED_CLIENT_FINGERPRINTS=ABC123...,DEF456...
@@ -169,8 +169,8 @@ export APP_MODE=master-express
169169
export BITGO_ENV=prod
170170
export TLS_KEY_PATH=/secure/path/master.key
171171
export TLS_CERT_PATH=/secure/path/master.crt
172-
export ENCLAVED_EXPRESS_URL=https://enclaved.internal.example.com:3080
173-
export ENCLAVED_EXPRESS_CERT=/secure/path/enclaved.crt
172+
export ADVANCED_WALLET_MANAGER_URL=https://advanced-wallet-manager.internal.example.com:3080
173+
export ADVANCED_WALLET_MANAGER_CERT=/secure/path/advanced-wallet-manager.crt
174174
export MTLS_REQUEST_CERT=true
175175
export ALLOW_SELF_SIGNED=false
176176
npm start
@@ -184,22 +184,22 @@ First, build the container image:
184184
# For Master Express (default port 3081)
185185
npm run container:build
186186

187-
# For Enclaved Express (port 3080)
187+
# For Advanced Wallet Manager (port 3080)
188188
npm run container:build --build-arg PORT=3080
189189
```
190190

191-
For local development, you'll need to run both the Enclaved Express and Master Express containers:
191+
For local development, you'll need to run both the Advanced Wallet Manager and Master Express containers:
192192

193193
```bash
194-
# Start Enclaved Express container
194+
# Start Advanced Wallet Manager container
195195
podman run -d \
196196
-p 3080:3080 \
197197
-v $(pwd)/certs:/app/certs:Z \
198-
-e APP_MODE=enclaved \
198+
-e APP_MODE=advanced-wallet-manager \
199199
-e BIND=0.0.0.0 \
200200
-e TLS_MODE=mtls \
201-
-e TLS_KEY_PATH=/app/certs/enclaved-express-key.pem \
202-
-e TLS_CERT_PATH=/app/certs/enclaved-express-cert.pem \
201+
-e TLS_KEY_PATH=/app/certs/advanced-wallet-manager-key.pem \
202+
-e TLS_CERT_PATH=/app/certs/advanced-wallet-manager-cert.pem \
203203
-e KMS_URL=host.containers.internal:3000 \
204204
-e NODE_ENV=development \
205205
-e ALLOW_SELF_SIGNED=true \
@@ -220,23 +220,23 @@ podman run -d \
220220
-e TLS_MODE=mtls \
221221
-e TLS_KEY_PATH=/app/certs/test-ssl-key.pem \
222222
-e TLS_CERT_PATH=/app/certs/test-ssl-cert.pem \
223-
-e ENCLAVED_EXPRESS_URL=https://host.containers.internal:3080 \
224-
-e ENCLAVED_EXPRESS_CERT=/app/certs/enclaved-express-cert.pem \
223+
-e ADVANCED_WALLET_MANAGER_URL=https://host.containers.internal:3080 \
224+
-e ADVANCED_WALLET_MANAGER_CERT=/app/certs/advanced-wallet-manager-cert.pem \
225225
-e ALLOW_SELF_SIGNED=true \
226226
bitgo-onprem-express
227227

228228
# View logs
229229
podman logs -f <container_id>
230230

231231
# Test the endpoints (note: using https and mTLS)
232-
# For Enclaved Express
233-
curl -k --cert certs/test-ssl-cert.pem --key certs/enclaved-express-key.pem -X POST https://localhost:3080/ping
232+
# For Advanced Wallet Manager
233+
curl -k --cert certs/test-ssl-cert.pem --key certs/advanced-wallet-manager-key.pem -X POST https://localhost:3080/ping
234234

235235
# For Master Express
236236
curl -k --cert certs/test-ssl-cert.pem --key certs/test-ssl-key.pem -X POST https://localhost:3081/ping
237237

238238
# Test the connection
239-
curl -k -X POST https://localhost:3081/ping/enclavedExpress
239+
curl -k -X POST https://localhost:3081/ping/advancedWalletManager
240240
```
241241

242242
Notes:
@@ -247,7 +247,7 @@ Notes:
247247

248248
## API Endpoints
249249

250-
### Enclaved Express (Port 3080)
250+
### Advanced Wallet Manager (Port 3080)
251251

252252
- `POST /ping` - Health check
253253
- `GET /version` - Version information
@@ -257,8 +257,8 @@ Notes:
257257

258258
- `POST /ping` - Health check
259259
- `GET /version` - Version information
260-
- `POST /ping/enclavedExpress` - Test connection to Enclaved Express
261-
- `POST /api/:coin/wallet/generate` - Generate wallet (with Enclaved Express integration)
260+
- `POST /ping/advancedWalletManager` - Test connection to Advanced Wallet Manager
261+
- `POST /api/:coin/wallet/generate` - Generate wallet (with Advanced Wallet Manager integration)
262262

263263
## Troubleshooting
264264

@@ -291,17 +291,10 @@ openssl x509 -in certificate.crt -text -noout
291291

292292
```bash
293293
# Check that required variables are set
294-
env | grep -E "(APP_MODE|KMS_URL|ENCLAVED_EXPRESS|TLS_)"
295-
```
296-
297-
### Debug Mode
298-
299-
Enable debug logging for detailed troubleshooting:
300-
301-
```bash
302-
DEBUG_NAMESPACE=enclaved:*,master:* npm run start
303-
```
294+
env | grep -E "(APP_MODE|KMS_URL|ADVANCED_WALLET_MANAGER|TLS_)"
295+
``
304296

305297
## License
306298

307299
MIT
300+
```

0 commit comments

Comments
 (0)