Skip to content

Commit b489fd8

Browse files
feat: add claude context
1 parent 15c27bd commit b489fd8

File tree

2 files changed

+214
-3
lines changed

2 files changed

+214
-3
lines changed

CLAUDE.md

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Commands
6+
7+
### Development
8+
- `yarn start` - Start the application in development mode using nodemon for auto-reloading
9+
- `yarn build` - Build the TypeScript code (creates /dist folder)
10+
- `yarn lint` - Run ESLint to check for code issues
11+
- `yarn lint:fix` - Run ESLint and automatically fix issues when possible
12+
13+
### Testing
14+
- `yarn test` - Run all tests
15+
- `yarn test:watch` - Run tests in watch mode
16+
- `yarn test:coverage` - Run tests with coverage report
17+
- `yarn generate-test-ssl` - Generate self-signed SSL certificates for testing
18+
19+
### Container
20+
- `yarn container:build` - Build the container image using Podman (optionally use --build-arg PORT=3080)
21+
22+
## Architecture Overview
23+
24+
Enclaved BitGo Express is a secure cryptocurrency signing server with two operational modes:
25+
26+
### 1. Enclaved Express Mode (`APP_MODE=enclaved`)
27+
- Lightweight server focused solely on secure signing operations
28+
- Runs on port 3080 by default
29+
- Integrates with KMS for key management
30+
- Handles cryptographic operations securely
31+
- Exposes minimal endpoints focused on key generation and signing
32+
33+
### 2. Master Express Mode (`APP_MODE=master-express`)
34+
- Full BitGo API functionality with integrated signing capabilities
35+
- Runs on port 3081 by default
36+
- Acts as an API gateway and communicates with Enclaved Express for signing operations
37+
- Provides a broader set of BitGo wallet operations and transaction handling
38+
39+
### Security Architecture
40+
- Both modes support mutual TLS (mTLS) authentication
41+
- Certificates can be loaded from files or environment variables
42+
- Client certificate validation for secure communications
43+
- Option to validate client certificate fingerprints
44+
45+
### 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
48+
- `src/masterExpressApp.ts` - Master Express mode implementation
49+
- `src/initConfig.ts` - Configuration loading and validation
50+
- `src/routes/` - Express routes for both modes
51+
- `src/api/` - API implementation for both modes
52+
- `src/kms/` - KMS client and operations
53+
- `src/shared/` - Shared utilities and types
54+
55+
### Configuration
56+
Configuration is managed through environment variables with defaults defined in `src/initConfig.ts`. The application requires specific environment variables depending on the mode:
57+
58+
#### Common Variables
59+
- `APP_MODE` - Set to "enclaved" or "master-express"
60+
- `TLS_MODE` - Set to "mtls" or "disabled"
61+
- `BIND` - Address to bind to (default: localhost)
62+
- `TIMEOUT` - Request timeout in milliseconds (default: 305000)
63+
64+
#### Enclaved Mode Specific
65+
- `ENCLAVED_EXPRESS_PORT` - Port to listen on (default: 3080)
66+
- `KMS_URL` - Required KMS service URL
67+
68+
#### Master Express Mode Specific
69+
- `MASTER_EXPRESS_PORT` - Port to listen on (default: 3081)
70+
- `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
73+
74+
## API Endpoints
75+
76+
### Enclaved Express (Port 3080)
77+
- `POST /ping` - Health check
78+
- `GET /version` - Version information
79+
- `POST /:coin/key/independent` - Generate independent keychain
80+
81+
### Master Express (Port 3081)
82+
83+
#### Health and Status Endpoints
84+
- `POST /ping` - Health check
85+
- `GET /version` - Version information
86+
- `POST /ping/enclavedExpress` - Test connection to Enclaved Express
87+
- `GET /version/enclavedExpress` - Get Enclaved Express version information
88+
89+
#### Wallet Management
90+
- `POST /api/:coin/wallet/generate` - Generate wallet (supports onchain and TSS multisig types)
91+
92+
#### Transaction Operations
93+
- `POST /api/:coin/wallet/:walletId/sendMany` - Send transaction with multiple recipients
94+
- `POST /api/:coin/wallet/:walletId/accelerate` - Accelerate pending transactions (CPFP/RBF)
95+
- `POST /api/:coin/wallet/:walletId/consolidate` - Consolidate wallet addresses
96+
- `POST /api/:coin/wallet/:walletId/consolidateunspents` - Consolidate unspent transaction outputs
97+
98+
#### Recovery
99+
- `POST /api/:coin/wallet/recovery` - Recover wallet funds

masterBitgoExpress.json

Lines changed: 115 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,120 @@
66
"description": "BitGo Enclaved Express - Secure enclave for BitGo signing operations with mTLS"
77
},
88
"paths": {
9+
"/api/{coin}/wallet/{walletId}/accelerate": {
10+
"post": {
11+
"parameters": [
12+
{
13+
"name": "walletId",
14+
"in": "path",
15+
"required": true,
16+
"schema": {
17+
"type": "string"
18+
}
19+
},
20+
{
21+
"name": "coin",
22+
"in": "path",
23+
"required": true,
24+
"schema": {
25+
"type": "string"
26+
}
27+
}
28+
],
29+
"requestBody": {
30+
"content": {
31+
"application/json": {
32+
"schema": {
33+
"type": "object",
34+
"properties": {
35+
"pubkey": {
36+
"type": "string"
37+
},
38+
"source": {
39+
"type": "string",
40+
"enum": [
41+
"user",
42+
"backup"
43+
]
44+
},
45+
"cpfpTxIds": {
46+
"type": "array",
47+
"items": {
48+
"type": "string"
49+
}
50+
},
51+
"cpfpFeeRate": {
52+
"type": "number"
53+
},
54+
"maxFee": {
55+
"type": "number"
56+
},
57+
"rbfTxIds": {
58+
"type": "array",
59+
"items": {
60+
"type": "string"
61+
}
62+
},
63+
"feeMultiplier": {
64+
"type": "number"
65+
}
66+
},
67+
"required": [
68+
"pubkey",
69+
"source"
70+
]
71+
}
72+
}
73+
}
74+
},
75+
"responses": {
76+
"200": {
77+
"description": "OK",
78+
"content": {
79+
"application/json": {
80+
"schema": {
81+
"type": "object",
82+
"properties": {
83+
"txid": {
84+
"type": "string"
85+
},
86+
"tx": {
87+
"type": "string"
88+
}
89+
},
90+
"required": [
91+
"txid",
92+
"tx"
93+
]
94+
}
95+
}
96+
}
97+
},
98+
"500": {
99+
"description": "Internal Server Error",
100+
"content": {
101+
"application/json": {
102+
"schema": {
103+
"type": "object",
104+
"properties": {
105+
"error": {
106+
"type": "string"
107+
},
108+
"details": {
109+
"type": "string"
110+
}
111+
},
112+
"required": [
113+
"error",
114+
"details"
115+
]
116+
}
117+
}
118+
}
119+
}
120+
}
121+
}
122+
},
9123
"/api/{coin}/wallet/{walletId}/consolidate": {
10124
"post": {
11125
"parameters": [
@@ -142,9 +256,6 @@
142256
"backup"
143257
]
144258
},
145-
"walletPassphrase": {
146-
"type": "string"
147-
},
148259
"feeRate": {
149260
"type": "number"
150261
},
@@ -503,6 +614,7 @@
503614
},
504615
"required": [
505616
"label",
617+
"multisigType",
506618
"enterprise"
507619
]
508620
}

0 commit comments

Comments
 (0)