@@ -457,17 +457,6 @@ export class NodeCommand extends BaseCommand {
457
457
}
458
458
459
459
// TODO: move to KeyManager
460
- async copyNodeKeysToStaging ( nodeKey , destDir ) {
461
- for ( const keyFile of [ nodeKey . privateKeyFile , nodeKey . certificateFile ] ) {
462
- if ( ! fs . existsSync ( keyFile ) ) {
463
- throw new FullstackTestingError ( `file (${ keyFile } ) is missing` )
464
- }
465
-
466
- const fileName = path . basename ( keyFile )
467
- fs . cpSync ( keyFile , path . join ( destDir , fileName ) )
468
- }
469
- }
470
-
471
460
async initializeSetup ( config , k8 ) {
472
461
// compute other config parameters
473
462
config . keysDir = path . join ( validatePath ( config . cacheDir ) , 'keys' )
@@ -801,7 +790,7 @@ export class NodeCommand extends BaseCommand {
801
790
for ( const nodeId of ctx . config . nodeIds ) {
802
791
const config = /** @type {NodeSetupConfigClass } **/ ctx . config
803
792
const tlsKeyFiles = self . keyManager . prepareTLSKeyFilePaths ( nodeId , config . keysDir )
804
- await self . copyNodeKeysToStaging ( tlsKeyFiles , config . stagingKeysDir )
793
+ await self . keyManager . copyNodeKeysToStaging ( tlsKeyFiles , config . stagingKeysDir )
805
794
}
806
795
}
807
796
}
@@ -1888,7 +1877,7 @@ export class NodeCommand extends BaseCommand {
1888
1877
const config = /** @type {NodeAddConfigClass } **/ ctx . config
1889
1878
for ( const nodeId of config . allNodeIds ) {
1890
1879
const tlsKeyFiles = self . keyManager . prepareTLSKeyFilePaths ( nodeId , config . keysDir )
1891
- await self . copyNodeKeysToStaging ( tlsKeyFiles , config . stagingKeysDir )
1880
+ await self . keyManager . copyNodeKeysToStaging ( tlsKeyFiles , config . stagingKeysDir )
1892
1881
}
1893
1882
}
1894
1883
}
@@ -2151,11 +2140,11 @@ export class NodeCommand extends BaseCommand {
2151
2140
switch ( keyFormat ) {
2152
2141
case constants . KEY_FORMAT_PEM : {
2153
2142
const signingKeyFiles = this . keyManager . prepareNodeKeyFilePaths ( nodeId , keysDir , constants . SIGNING_KEY_PREFIX )
2154
- await this . copyNodeKeysToStaging ( signingKeyFiles , stagingKeysDir )
2143
+ await this . keyManager . copyNodeKeysToStaging ( signingKeyFiles , stagingKeysDir )
2155
2144
2156
2145
// generate missing agreement keys
2157
2146
const agreementKeyFiles = this . keyManager . prepareNodeKeyFilePaths ( nodeId , keysDir , constants . AGREEMENT_KEY_PREFIX )
2158
- await this . copyNodeKeysToStaging ( agreementKeyFiles , stagingKeysDir )
2147
+ await this . keyManager . copyNodeKeysToStaging ( agreementKeyFiles , stagingKeysDir )
2159
2148
break
2160
2149
}
2161
2150
0 commit comments