Skip to content

Commit ade43be

Browse files
authored
Merge pull request #198 from BitGo/WCN-397
chore: add SigningMode config and refactor KeyProviderClient HTTP layer
2 parents 788469b + 76457ed commit ade43be

20 files changed

Lines changed: 128 additions & 59 deletions

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ curl -X POST http://localhost:3081/ping/advancedWalletManager
169169
| ------------------------------ | ---------------------------------- | ------- | -------- |
170170
| `ADVANCED_WALLET_MANAGER_PORT` | Port to listen on | `3080` ||
171171
| `KEY_PROVIDER_URL` | URL to your key provider API implementation | - ||
172+
| `SIGNING_MODE` | Signing mode (`local` or `external`). Use `external` to delegate key generation and signing to your key provider — the private key never leaves the HSM. | `local` ||
172173

173174
> **Note:** The `KEY_PROVIDER_URL` points to your implementation of the key provider API interface. You must implement this interface to connect your KMS/HSM. See [Prerequisites](#prerequisites) for the specification and examples.
174175

docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ services:
4343
# Logging and debug
4444
- HTTP_LOGFILE=logs/http-access.log
4545
- RECOVERY_MODE=true
46+
# Default to local signing mode
4647
- NODE_ENV=production
4748
- LOG_LEVEL=info
4849
restart: always

src/__tests__/api/advancedWalletManager/keyProviderClient.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { AppMode, AdvancedWalletManagerConfig, TlsMode } from '../../../initConfig';
1+
import { AppMode, AdvancedWalletManagerConfig, TlsMode, SigningMode } from '../../../initConfig';
22
import { app as expressApp } from '../../../advancedWalletManagerApp';
33

44
import express from 'express';
@@ -24,6 +24,7 @@ describe('postMpcV2Key', () => {
2424
// app config
2525
cfg = {
2626
appMode: AppMode.ADVANCED_WALLET_MANAGER,
27+
signingMode: SigningMode.LOCAL,
2728
port: 0, // Let OS assign a free port
2829
bind: 'localhost',
2930
timeout: 60000,

src/__tests__/api/advancedWalletManager/mpcFinalize.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import 'should';
33
import * as sinon from 'sinon';
44
import * as express from 'express';
55
import * as request from 'supertest';
6-
import { AppMode, AdvancedWalletManagerConfig, TlsMode } from '../../../shared/types';
6+
import { AppMode, AdvancedWalletManagerConfig, TlsMode, SigningMode } from '../../../shared/types';
77
import { app as enclavedApp } from '../../../advancedWalletManagerApp';
88
import { BitGoAPI } from '@bitgo-beta/sdk-api';
99
import * as middleware from '../../../shared/middleware';
@@ -23,6 +23,7 @@ describe('MPC Finalize', () => {
2323
// app config
2424
cfg = {
2525
appMode: AppMode.ADVANCED_WALLET_MANAGER,
26+
signingMode: SigningMode.LOCAL,
2627
port: 0, // Let OS assign a free port
2728
bind: 'localhost',
2829
timeout: 60000,

src/__tests__/api/advancedWalletManager/mpcInitialize.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import 'should';
33
import * as sinon from 'sinon';
44
import * as express from 'express';
55
import * as request from 'supertest';
6-
import { AppMode, AdvancedWalletManagerConfig, TlsMode } from '../../../shared/types';
6+
import { AppMode, AdvancedWalletManagerConfig, TlsMode, SigningMode } from '../../../shared/types';
77
import { app as enclavedApp } from '../../../advancedWalletManagerApp';
88

99
describe('MPC Initialize', () => {
@@ -24,6 +24,7 @@ describe('MPC Initialize', () => {
2424
// app config
2525
cfg = {
2626
appMode: AppMode.ADVANCED_WALLET_MANAGER,
27+
signingMode: SigningMode.LOCAL,
2728
port: 0, // Let OS assign a free port
2829
bind: 'localhost',
2930
timeout: 60000,

src/__tests__/api/advancedWalletManager/nonRecovery.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import 'should';
22
import * as request from 'supertest';
33
import nock from 'nock';
44
import { app as expressApp } from '../../../advancedWalletManagerApp';
5-
import { AppMode, AdvancedWalletManagerConfig, TlsMode } from '../../../shared/types';
5+
import { AppMode, AdvancedWalletManagerConfig, TlsMode, SigningMode } from '../../../shared/types';
66
import sinon from 'sinon';
77
import * as middleware from '../../../shared/middleware';
88
import { BitGoRequest } from '../../../types/request';
@@ -13,6 +13,7 @@ describe('Non Recovery', () => {
1313
const coin = 'tbtc';
1414
const config: AdvancedWalletManagerConfig = {
1515
appMode: AppMode.ADVANCED_WALLET_MANAGER,
16+
signingMode: SigningMode.LOCAL,
1617
port: 0,
1718
bind: 'localhost',
1819
timeout: 60000,

src/__tests__/api/advancedWalletManager/postIndependentKey.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import 'should';
33
import * as request from 'supertest';
44
import nock from 'nock';
55
import { app as advancedWalletManagerApp } from '../../../advancedWalletManagerApp';
6-
import { AppMode, AdvancedWalletManagerConfig, TlsMode } from '../../../shared/types';
6+
import { AppMode, AdvancedWalletManagerConfig, TlsMode, SigningMode } from '../../../shared/types';
77
import express from 'express';
88

99
import * as sinon from 'sinon';
@@ -30,6 +30,7 @@ describe('postIndependentKey', () => {
3030
// app config
3131
cfg = {
3232
appMode: AppMode.ADVANCED_WALLET_MANAGER,
33+
signingMode: SigningMode.LOCAL,
3334
port: 0, // Let OS assign a free port
3435
bind: 'localhost',
3536
timeout: 60000,

src/__tests__/api/advancedWalletManager/postMpcV2Key.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { AppMode, AdvancedWalletManagerConfig, TlsMode } from '../../../initConfig';
1+
import { AppMode, AdvancedWalletManagerConfig, TlsMode, SigningMode } from '../../../initConfig';
22
import { app as advancedWalletManagerApp } from '../../../advancedWalletManagerApp';
33

44
import express from 'express';
@@ -32,6 +32,7 @@ describe('postMpcV2Key', () => {
3232
// app config
3333
cfg = {
3434
appMode: AppMode.ADVANCED_WALLET_MANAGER,
35+
signingMode: SigningMode.LOCAL,
3536
port: 0, // Let OS assign a free port
3637
bind: 'localhost',
3738
timeout: 60000,

src/__tests__/api/advancedWalletManager/recoveryMpc.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import 'should';
22
import * as request from 'supertest';
33
import nock from 'nock';
44
import { app as expressApp } from '../../../advancedWalletManagerApp';
5-
import { AdvancedWalletManagerConfig, AppMode, TlsMode } from '../../../shared/types';
5+
import { AdvancedWalletManagerConfig, AppMode, TlsMode, SigningMode } from '../../../shared/types';
66

77
describe('recoveryMpc', () => {
88
let agent: request.SuperAgentTest;
@@ -19,6 +19,7 @@ describe('recoveryMpc', () => {
1919

2020
const config: AdvancedWalletManagerConfig = {
2121
appMode: AppMode.ADVANCED_WALLET_MANAGER,
22+
signingMode: SigningMode.LOCAL,
2223
port: 0, // Let OS assign a free port
2324
bind: 'localhost',
2425
timeout: 60000,

src/__tests__/api/advancedWalletManager/recoveryMpcV2.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { AppMode, AdvancedWalletManagerConfig, TlsMode } from '../../../initConfig';
1+
import { AppMode, AdvancedWalletManagerConfig, TlsMode, SigningMode } from '../../../initConfig';
22
import { app as advancedWalletManagerApp } from '../../../advancedWalletManagerApp';
33

44
import express from 'express';
@@ -56,6 +56,7 @@ describe('recoveryMpcV2', async () => {
5656
// app config
5757
cfg = {
5858
appMode: AppMode.ADVANCED_WALLET_MANAGER,
59+
signingMode: SigningMode.LOCAL,
5960
port: 0, // Let OS assign a free port
6061
bind: 'localhost',
6162
timeout: 60000,

0 commit comments

Comments
 (0)