Skip to content

Commit 7623b11

Browse files
committed
chore(advanced-wallets): rename enclave to secure express
Ticket: WP-5298
1 parent 63acfb2 commit 7623b11

File tree

75 files changed

+642
-621
lines changed

Some content is hidden

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

75 files changed

+642
-621
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", "sbe", "docker"]],
99
"scope-empty": [0, "never"]
1010
},
1111
"parserPreset": {

CLAUDE.md

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

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

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

1921
### Container
22+
2023
- `yarn 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+
Secured BitGo Express is a secure cryptocurrency signing server with two operational modes:
28+
29+
### 1. Secured Express Mode (`APP_MODE=secured`)
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 Secured Express 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
46-
- `src/app.ts` - Main entry point that determines mode and starts the appropriate app
47-
- `src/enclavedApp.ts` - Enclaved Express mode implementation
52+
53+
- `src/securedApp.ts` - Secured Express mode implementation
4854
- `src/masterExpressApp.ts` - Master Express mode implementation
4955
- `src/initConfig.ts` - Configuration loading and validation
5056
- `src/routes/` - Express routes for both modes
@@ -53,47 +59,56 @@ Enclaved BitGo Express is a secure cryptocurrency signing server with two operat
5359
- `src/shared/` - Shared utilities and types
5460

5561
### Configuration
62+
5663
Configuration is managed through environment variables with defaults defined in `src/initConfig.ts`. The application requires specific environment variables depending on the mode:
5764

5865
#### Common Variables
59-
- `APP_MODE` - Set to "enclaved" or "master-express"
66+
67+
- `APP_MODE` - Set to "secured" or "master-express"
6068
- `TLS_MODE` - Set to "mtls" or "disabled"
6169
- `BIND` - Address to bind to (default: localhost)
6270
- `TIMEOUT` - Request timeout in milliseconds (default: 305000)
6371

64-
#### Enclaved Mode Specific
65-
- `ENCLAVED_EXPRESS_PORT` - Port to listen on (default: 3080)
72+
#### Secured Mode Specific
73+
74+
- `SECURED_EXPRESS_PORT` - Port to listen on (default: 3080)
6675
- `KMS_URL` - Required KMS service URL
6776

6877
#### Master Express Mode Specific
78+
6979
- `MASTER_EXPRESS_PORT` - Port to listen on (default: 3081)
7080
- `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
81+
- `SECURED_EXPRESS_URL` - Required URL for the Secured Express server
82+
- `SECURED_EXPRESS_CERT` - Required path to Secured Express certificate
7383

7484
## API Endpoints
7585

76-
### Enclaved Express (Port 3080)
86+
### Secured Express (Port 3080)
87+
7788
- `POST /ping` - Health check
7889
- `GET /version` - Version information
7990
- `POST /:coin/key/independent` - Generate independent keychain
8091

8192
### Master Express (Port 3081)
8293

8394
#### Health and Status Endpoints
95+
8496
- `POST /ping` - Health check
8597
- `GET /version` - Version information
86-
- `POST /ping/enclavedExpress` - Test connection to Enclaved Express
87-
- `GET /version/enclavedExpress` - Get Enclaved Express version information
98+
- `POST /ping/securedExpress` - Test connection to Secured Express
99+
- `GET /version/securedExpress` - Get Secured Express version information
88100

89101
#### Wallet Management
102+
90103
- `POST /api/:coin/wallet/generate` - Generate wallet (supports onchain and TSS multisig types)
91104

92105
#### Transaction Operations
106+
93107
- `POST /api/:coin/wallet/:walletId/sendMany` - Send transaction with multiple recipients
94108
- `POST /api/:coin/wallet/:walletId/accelerate` - Accelerate pending transactions (CPFP/RBF)
95109
- `POST /api/:coin/wallet/:walletId/consolidate` - Consolidate wallet addresses
96110
- `POST /api/:coin/wallet/:walletId/consolidateunspents` - Consolidate unspent transaction outputs
97111

98112
#### Recovery
99-
- `POST /api/:coin/wallet/recovery` - Recover wallet funds
113+
114+
- `POST /api/:coin/wallet/recovery` - Recover wallet funds

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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/secured-bitgo-express"]

README.md

Lines changed: 40 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
1-
# Enclaved BitGo Express
1+
# Secured BitGo Express
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: Secured Express (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+
- **Secured 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+
- **Secured Express** (Port 3080): Focused signing operations with KMS integration
17+
- **Master Express** (Port 3081): Full BitGo API functionality with secure communication to Secured Express
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: "secured" 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+
#### Secured Mode Specific
3535

36-
- `ENCLAVED_EXPRESS_PORT` - Port to listen on (default: 3080)
36+
- `SECURED_EXPRESS_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+
- `SECURED_EXPRESS_URL` - Secured Express server URL (required)
48+
- `SECURED_EXPRESS_CERT` - Path to Secured Express server certificate (required)
4949

5050
### TLS/mTLS Configuration
5151

@@ -76,7 +76,7 @@ Both modes use the same TLS configuration variables:
7676
### Logging and Debug
7777

7878
- `LOGFILE` - Path to log file (optional)
79-
- `DEBUG_NAMESPACE` - Debug namespaces to enable (e.g., 'enclaved:\*')
79+
- `DEBUG_NAMESPACE` - Debug namespaces to enable (e.g., 'secured:\*')
8080

8181
## Quick Start
8282

@@ -92,10 +92,10 @@ openssl genrsa -out server.key 2048
9292
openssl req -new -x509 -key server.key -out server.crt -days 365 -subj "/CN=localhost"
9393
```
9494

95-
### 2. Start Enclaved Express
95+
### 2. Start Secured Express
9696

9797
```bash
98-
APP_MODE=enclaved \
98+
APP_MODE=secured \
9999
KMS_URL=https://your-kms-service \
100100
TLS_KEY_PATH=./server.key \
101101
TLS_CERT_PATH=./server.crt \
@@ -113,19 +113,19 @@ APP_MODE=master-express \
113113
BITGO_ENV=test \
114114
TLS_KEY_PATH=./server.key \
115115
TLS_CERT_PATH=./server.crt \
116-
ENCLAVED_EXPRESS_URL=https://localhost:3080 \
117-
ENCLAVED_EXPRESS_CERT=./server.crt \
116+
SECURED_EXPRESS_URL=https://localhost:3080 \
117+
SECURED_EXPRESS_CERT=./server.crt \
118118
MTLS_REQUEST_CERT=false \
119119
ALLOW_SELF_SIGNED=true \
120120
yarn start
121121
```
122122

123123
### 4. Test the Connection
124124

125-
Test that Master Express can communicate with Enclaved Express:
125+
Test that Master Express can communicate with Secured Express:
126126

127127
```bash
128-
curl -k -X POST https://localhost:3081/ping/enclavedExpress
128+
curl -k -X POST https://localhost:3081/ping/securedExpress
129129
```
130130

131131
## Production Configuration
@@ -141,13 +141,13 @@ curl -k -X POST https://localhost:3081/ping/enclavedExpress
141141

142142
### Production Setup Example
143143

144-
#### Enclaved Express (Production)
144+
#### Secured Express (Production)
145145

146146
```bash
147-
APP_MODE=enclaved \
147+
APP_MODE=secured \
148148
KMS_URL=https://production-kms.example.com \
149-
TLS_KEY_PATH=/secure/path/enclaved.key \
150-
TLS_CERT_PATH=/secure/path/enclaved.crt \
149+
TLS_KEY_PATH=/secure/path/secured.key \
150+
TLS_CERT_PATH=/secure/path/secured.crt \
151151
MTLS_REQUEST_CERT=true \
152152
ALLOW_SELF_SIGNED=false \
153153
MTLS_ALLOWED_CLIENT_FINGERPRINTS=ABC123...,DEF456... \
@@ -161,8 +161,8 @@ APP_MODE=master-express \
161161
BITGO_ENV=prod \
162162
TLS_KEY_PATH=/secure/path/master.key \
163163
TLS_CERT_PATH=/secure/path/master.crt \
164-
ENCLAVED_EXPRESS_URL=https://enclaved.internal.example.com:3080 \
165-
ENCLAVED_EXPRESS_CERT=/secure/path/enclaved.crt \
164+
SECURED_EXPRESS_URL=https://secured.internal.example.com:3080 \
165+
SECURED_EXPRESS_CERT=/secure/path/secured.crt \
166166
MTLS_REQUEST_CERT=true \
167167
ALLOW_SELF_SIGNED=false \
168168
yarn start
@@ -176,22 +176,22 @@ First, build the container image:
176176
# For Master Express (default port 3081)
177177
yarn container:build
178178

179-
# For Enclaved Express (port 3080)
179+
# For Secured Express (port 3080)
180180
yarn container:build --build-arg PORT=3080
181181
```
182182

183-
For local development, you'll need to run both the Enclaved Express and Master Express containers:
183+
For local development, you'll need to run both the Secured Express and Master Express containers:
184184

185185
```bash
186-
# Start Enclaved Express container
186+
# Start Secured Express container
187187
podman run -d \
188188
-p 3080:3080 \
189189
-v $(pwd)/certs:/app/certs:Z \
190-
-e APP_MODE=enclaved \
190+
-e APP_MODE=secured \
191191
-e BIND=0.0.0.0 \
192192
-e TLS_MODE=mtls \
193-
-e TLS_KEY_PATH=/app/certs/enclaved-express-key.pem \
194-
-e TLS_CERT_PATH=/app/certs/enclaved-express-cert.pem \
193+
-e TLS_KEY_PATH=/app/certs/secured-express-key.pem \
194+
-e TLS_CERT_PATH=/app/certs/secured-express-cert.pem \
195195
-e KMS_URL=host.containers.internal:3000 \
196196
-e NODE_ENV=development \
197197
-e ALLOW_SELF_SIGNED=true \
@@ -212,33 +212,34 @@ podman run -d \
212212
-e TLS_MODE=mtls \
213213
-e TLS_KEY_PATH=/app/certs/test-ssl-key.pem \
214214
-e TLS_CERT_PATH=/app/certs/test-ssl-cert.pem \
215-
-e ENCLAVED_EXPRESS_URL=https://host.containers.internal:3080 \
216-
-e ENCLAVED_EXPRESS_CERT=/app/certs/enclaved-express-cert.pem \
215+
-e SECURED_EXPRESS_URL=https://host.containers.internal:3080 \
216+
-e SECURED_EXPRESS_CERT=/app/certs/secured-express-cert.pem \
217217
-e ALLOW_SELF_SIGNED=true \
218218
bitgo-onprem-express
219219

220220
# View logs
221221
podman logs -f <container_id>
222222

223223
# Test the endpoints (note: using https and mTLS)
224-
# For Enclaved Express
225-
curl -k --cert certs/test-ssl-cert.pem --key certs/enclaved-express-key.pem -X POST https://localhost:3080/ping
224+
# For Secured Express
225+
curl -k --cert certs/test-ssl-cert.pem --key certs/secured-express-key.pem -X POST https://localhost:3080/ping
226226

227227
# For Master Express
228228
curl -k --cert certs/test-ssl-cert.pem --key certs/test-ssl-key.pem -X POST https://localhost:3081/ping
229229

230230
# Test the connection
231-
curl -k -X POST https://localhost:3081/ping/enclavedExpress
231+
curl -k -X POST https://localhost:3081/ping/securedExpress
232232
```
233233

234234
Notes:
235+
235236
- `host.containers.internal` is a special DNS name that resolves to the host machine from inside containers
236237
- The `:Z` option in volume mounts is specific to SELinux-enabled systems and ensures proper volume labeling
237238
- The logs directory will be created with appropriate permissions if it doesn't exist
238239

239240
## API Endpoints
240241

241-
### Enclaved Express (Port 3080)
242+
### Secured Express (Port 3080)
242243

243244
- `POST /ping` - Health check
244245
- `GET /version` - Version information
@@ -248,8 +249,8 @@ Notes:
248249

249250
- `POST /ping` - Health check
250251
- `GET /version` - Version information
251-
- `POST /ping/enclavedExpress` - Test connection to Enclaved Express
252-
- `POST /api/:coin/wallet/generate` - Generate wallet (with Enclaved Express integration)
252+
- `POST /ping/securedExpress` - Test connection to Secured Express
253+
- `POST /api/:coin/wallet/generate` - Generate wallet (with Secured Express integration)
253254

254255
## Troubleshooting
255256

@@ -282,15 +283,15 @@ openssl x509 -in certificate.crt -text -noout
282283

283284
```bash
284285
# Check that required variables are set
285-
env | grep -E "(APP_MODE|KMS_URL|ENCLAVED_EXPRESS|TLS_)"
286+
env | grep -E "(APP_MODE|KMS_URL|SECURED_EXPRESS|TLS_)"
286287
```
287288

288289
### Debug Mode
289290

290291
Enable debug logging for detailed troubleshooting:
291292

292293
```bash
293-
DEBUG_NAMESPACE=enclaved:*,master:* yarn start
294+
DEBUG_NAMESPACE=secured:*,master:* yarn start
294295
```
295296

296297
## License

0 commit comments

Comments
 (0)