@@ -2,6 +2,7 @@ import * as superagent from 'superagent';
22import debug from 'debug' ;
33import { config } from '../config' ;
44import { isMasterExpressConfig } from '../types' ;
5+ import https from 'https' ;
56
67const debugLogger = debug ( 'bitgo:express:enclavedExpressClient' ) ;
78
@@ -25,6 +26,7 @@ export class EnclavedExpressClient {
2526 private readonly url : string ;
2627 private readonly sslCert : string ;
2728 private readonly coin ?: string ;
29+ private readonly enableSSL : boolean ;
2830
2931 constructor ( coin ?: string ) {
3032 const cfg = config ( ) ;
@@ -41,6 +43,7 @@ export class EnclavedExpressClient {
4143 this . url = cfg . enclavedExpressUrl ;
4244 this . sslCert = cfg . enclavedExpressSSLCert ;
4345 this . coin = coin ;
46+ this . enableSSL = ! ! cfg . enableSSL ;
4447 debugLogger ( 'EnclavedExpressClient initialized with URL: %s' , this . url ) ;
4548 }
4649
@@ -69,6 +72,12 @@ export class EnclavedExpressClient {
6972 const { body : keychain } = await superagent
7073 . post ( `${ this . url } /api/${ this . coin } /key/independent` )
7174 . ca ( this . sslCert )
75+ . agent (
76+ new https . Agent ( {
77+ rejectUnauthorized : this . enableSSL ,
78+ ca : this . sslCert ,
79+ } ) ,
80+ )
7281 . type ( 'json' )
7382 . send ( params ) ;
7483 return keychain ;
0 commit comments